The "How do I..." Thread

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: The "How do I..." Thread

Post by NeuralStunner »

Jekyll Grim Payne wrote:Why the hell does it interpret 'goto Scale' like 'goto super::scale'?
This isn't the problem. The child actor doesn't have a "Scale" state, so the jump goes to the aprent's. There it's told Goto Spawn, so it goes to the Spawn state. Goto is absolute, I.E. always jumps within the current state table (unless told a parent class). The wiki does not describe this well at all. (But then, I'm not sure if I did either.)

Also, you could do away with the state jump altogether:

Code: Select all

TNT1 A 0 A_SetScale(0.3 + (Random(1,5) * 0.2))
You can use a Random directly in the scale value, and you also don't have to specify both scale parameters if they're the same.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: The "How do I..." Thread

Post by Jekyll Grim Payne »

Nash wrote:^ I ran into this problem too and there were some really good technical answers but I kind of forget what they were and was just advised to use A_Jump with 255 chance instead.

Also for the Scale state you can use the #### # sprite names, it will use whatever sprite that came before it.
Hmm... that's interesting. I'll try to check it out.
User avatar
TheBadHustlex
Posts: 1914
Joined: Thu Oct 03, 2013 12:50 am
Location: 'stria

Re: The "How do I..." Thread

Post by TheBadHustlex »

I need help with LANGUAGE.

I tried to replace the "you need the [somekey]"-messages that are displayed when you try to open a locked door without having the key. I defined them in the language-lump of my project:
Spoiler:
However, the vanilla messages are still displayed.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: The "How do I..." Thread

Post by NeuralStunner »

Nash wrote:A_Jump with 255 chance
[wiki=A_Jump]256[/wiki], unless you want a small chance of it imploding.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: The "How do I..." Thread

Post by Jekyll Grim Payne »

NeuralStunner wrote:This isn't the problem. The child actor doesn't have a "Scale" state, so the jump goes to the aprent's. There it's told Goto Spawn, so it goes to the Spawn state. Goto is absolute, I.E. always jumps within the current state table (unless told a parent class). The wiki does not describe this well at all. (But then, I'm not sure if I did either.)
Well, that's new. So unless I'm defining an object that enters specific states for external reasons (like a monster's death state), I have to redefine all of them, otherwise goto will send to the parent.
NeuralStunner wrote:Also, you could do away with the state jump altogether:

Code: Select all

TNT1 A 0 A_SetScale(0.3 + (Random(1,5) * 0.2))
You can use a Random directly in the scale value, and you also don't have to specify both scale parameters if they're the same.
Oh, I know about random. It's just that originally I only had 2 size variations and it seemed enough but then I decided to add some smoothness and I kinda forgot that I can use random and some arithmetics for that. Or maybe I tried using random(0.01,0.05) and it didn't work back then... Also I didn't know you can use only one number to set XY scale, I thought it only worked for X and Y separately.
NeuralStunner wrote:
Nash wrote:A_Jump with 255 chance
[wiki=A_Jump]256[/wiki], unless you want a small chance of it imploding.
I actually had questioned that sometimes. I mean, from 0 to 256 means having 257 possible values. Doesn't seem entirely right.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

Actually you can't do "A_Jump(0,"Whatever")"... because then it'll never jump. What's the point of giving it a jump chance of 0?
Gez
 
 
Posts: 17942
Joined: Fri Jul 06, 2007 3:22 pm

Re: The "How do I..." Thread

Post by Gez »

Jekyll Grim Payne wrote:I actually had questioned that sometimes. I mean, from 0 to 256 means having 257 possible values. Doesn't seem entirely right.
That's the thing, the random value will be from 0 to 255 exclusively, not from 0 to 256. A_Jump will jump if the result is lesser than the value you gave it. 255 is lesser than 256. 255 is not lesser than 255. So if you roll 255, then with a value of 255 there's no jump, and with a value of 256 there's a jump.

You can use 257, 300, or 168000 too if you want, they'll be safe values as well.
DoomKrakken wrote:Actually you can't do "A_Jump(0,"Whatever")"... because then it'll never jump. What's the point of giving it a jump chance of 0?
Disabling a jump without deleting it? So that you may debug some other behavior or whatever? I guess it's an alternative to commenting things out; and also it doesn't force you to change state offsets everywhere contrarily to commenting out state lines (but you shouldn't use state offsets anyway).
User avatar
jpalomo
Posts: 772
Joined: Mon May 17, 2010 9:45 am

Re: The "How do I..." Thread

Post by jpalomo »

TheBadHustlex wrote:I need help with LANGUAGE.

I tried to replace the "you need the [somekey]"-messages that are displayed when you try to open a locked door without having the key. I defined them in the language-lump of my project:
Spoiler:
However, the vanilla messages are still displayed.
Did you remember to replace the strings for [wiki=LOCKDEFS]RemoteMessage[/wiki]? You can check the LOCKDEFS file in zdoom.pk3 for the string names. Did you also provide a language code at the start of the LANGUAGE file?

Code: Select all

[enu default]
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: The "How do I..." Thread

Post by edward850 »

NeuralStunner wrote:
Nash wrote:A_Jump with 255 chance
[wiki=A_Jump]256[/wiki], unless you want a small chance of it imploding.
As an additional fun fact, painchance works by the same rules, and the player's default painchance is 255, not 256. :P
Cansteam
Posts: 86
Joined: Fri Aug 01, 2014 9:20 pm

Re: The "How do I..." Thread

Post by Cansteam »

How do I determine how many tics a floor or ceiling lower/raise by value will take?
For example, how fast would
floor_raisebyvalue(17,30,144);
take?
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: The "How do I..." Thread

Post by edward850 »

(Distance) / (Speed / 8). Which all needs to be handled in fixed point, thus your exact formulae is;

Code: Select all

fixeddiv((144<<16),fixeddiv((30<<16),8.0))>>16
To return the approximated value in tics. It's not guaranteed to be exact (that exact calculation is 38.4 tics, and you cannot have .4 of a tic), it's a horrible waste of calculation time, and it also isn't even going to be correct if something interrupts the movement.

Basically, don't even think about doing it that way and just let ACS do it for you in a way that's 100% accurate, 100% of the time.
Gez
 
 
Posts: 17942
Joined: Fri Jul 06, 2007 3:22 pm

Re: The "How do I..." Thread

Post by Gez »

You can optimize that to ((144<<19) / 30)>>16 if you need this value for something else than waiting until it's complete, but yeah, use [wiki]TagWait[/wiki].
Cansteam
Posts: 86
Joined: Fri Aug 01, 2014 9:20 pm

Re: The "How do I..." Thread

Post by Cansteam »

so it would be
floor_raisebyvalue(17,30,144);
tagwait(17);
?
Gez
 
 
Posts: 17942
Joined: Fri Jul 06, 2007 3:22 pm

Re: The "How do I..." Thread

Post by Gez »

Yes.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: The "How do I..." Thread

Post by edward850 »

That is indeed correct as it shows you on that wiki page you hopefully looked at, yes. :P
Locked

Return to “Editing (Archive)”