Random frame duration without using A_Jump

Moderator: GZDoom Developers

Post Reply
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Random frame duration without using A_Jump

Post by Snarboo »

This sounds confusing, but what I'm asking for here is the ability to make an animation frame last a random amount of tics rather than using a series of A_Jump's to do the same thing. Basically, I want to be able to use the RANDOM(Small#,Large#) variable for frame durations.

Kind of like this:

Code: Select all

Psuedocode:
ACTOR BagOfPopcorn
{
  states
  {
  Spawn:
  TNT1 A RANDOM(2,20) A_CustomMissile("Popcorn1")
  TNT1 A RANDOM(2,20) A_CustomMissile("Popcorn2")
  TNT1 A RANDOM(2,20) A_CustomMissile("Popcorn3")
  Stop
  }
}
This sort of thing can already be done with bullet attacks to randomize their damage. This could be valuable for objects with unpredictable behavior such as a bag of popcorn without having to use a bunch of A_Jump's. If this can already be done like the above example, I apologize.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Sorry, but the state definitions don't allow it. The best you might get is a code pointer that sets a state's duration.
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Post by Snarboo »

Ah, I see. What would such a code pointer do, exactly?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

It would set the duration that is stored inside the actor to any value you'd specify. You could do it like

Code: Select all

  TNT1 A 1 A_SetDuration(random(2,20)*2)
  TNT1 A 0 A_CustomMissile("something")
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Post by Snarboo »

Ooh, that looks nifty. Something like that could be very useful. :)
User avatar
KeksDose
 
 
Posts: 596
Joined: Thu Jul 05, 2007 6:13 pm
Location: my laboratory
Contact:

Post by KeksDose »

Indeed, that makes my particle spawn codes way shorter than normal ;) Never heard of this action :P I should check the Wiki more often :P

[EDIT] O_o The Wiki doesn't cover this? Oh my god :shock:
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Post by Snarboo »

I don't believe this feature has been implemented yet, Keks. ;) Graf was just showing how such a feature might work.
User avatar
KeksDose
 
 
Posts: 596
Joined: Thu Jul 05, 2007 6:13 pm
Location: my laboratory
Contact:

Post by KeksDose »

OH!! :laff: NEVER MAKE POINTLESS POSTS WHEN YOU HAVE A HEADACHE :P Would be cool if that would be in.
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Never post large amount of text in caps either, it gives other people a headache. :?
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”