Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Timer_Expired
Re: Timer_Expired [message #372653 is a reply to message #371858] Thu, 19 February 2009 16:02 Go to previous messageGo to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3813
Registered: July 2006
Location: USA
Karma:
General (3 Stars)
danpaul88 wrote on Thu, 12 February 2009 16:17

Jerad Gray wrote on Thu, 12 February 2009 23:06

danpaul88 wrote on Thu, 12 February 2009 10:40

Just use the Custom system instead, make it send a custom to itself with an x second delay and put the players ID as the parameter to the custom. Easy.

Kind of removes the whole delay part though...


Quote:

typedef void (*_Send_Custom_Event) (GameObject *Sender,GameObject *Reciever,int Message,int Param,float Delay);


Highlighting added for emphasis. Why else do you think the Send_Custom_Event takes a delay parameter if not to delay the delivery of the custom?



Example;
float delay = 10.0f;   // delay in seconds
int message = 12345;  // unique message code to identify this from other customs
int param = Get_Player_ID( enter );  // ID of player (use Commands->Get_ID(obj) to get the player object ID, which is probably what you really need)
Commands->Send_Custom_Event ( obj, obj, message, param, delay );



No need to create the variables, you can condense it into a single line statement, I added them for clarity only. You need to decide if you want to send the player ID (as seen from FDS) or the player's object ID (which also makes it work for AI units and makes it easy to cancel triggering if the player died before the delay was triggered)

Either way you still have the same possible issue as you would with a timer, which my code is designed to go around, as in, you walk in the zone, out of the zone, back in, back out, back in, and then you get hit by 3 customs because you weren't checking to make sure there wasn't a custom delayed/timer running.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Link To This Skin?
Next Topic: Script for aircrafts needed...
Goto Forum:
  


Current Time: Mon Dec 23 22:27:57 MST 2024

Total time taken to generate the page: 0.00813 seconds