Need help with ACS and puking

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
TGVaporeon
Posts: 12
Joined: Mon Mar 06, 2017 2:58 pm
Graphics Processor: Intel (Modern GZDoom)

Need help with ACS and puking

Post by TGVaporeon »

Is there a way that I can have my ACS script "puke" when someone gets a frag?
User avatar
KeksDose
 
 
Posts: 595
Joined: Thu Jul 05, 2007 6:13 pm
Contact:

Re: Need help with ACS and puking

Post by KeksDose »

Yup, I think it can be done with the [wiki=PlayerFrags]PlayerFrags[/wiki] function in an enter-script. It'll cover all players. Check if the frag count increases and it should work as imagined:

Code: Select all

script "On frag" enter {
   bool check_frags = true;
   int frags = 0;
   int prev_frags = frags;

   while(check_frags) {
      prev_frags = frags;
      frags = PlayerFrags();
      
      if(prev_frags < frags) {
         Acs_NamedExecuteAlways("got a frag", 0);
      }

      Delay(const:1);
   }
} 
edit: And of course you can execute the script as often as frags - prev_frags, if you want to account for multiple frags in the same tic by the same player!
User avatar
TGVaporeon
Posts: 12
Joined: Mon Mar 06, 2017 2:58 pm
Graphics Processor: Intel (Modern GZDoom)

Re: Need help with ACS and puking

Post by TGVaporeon »

Thanks a bunch!
Post Reply

Return to “Scripting”