Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » START_TIMER Parameters
Re: START_TIMER Parameters [message #434541 is a reply to message #434519] Wed, 11 August 2010 02:44 Go to previous messageGo to previous message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma:
General (1 Star)
You indeed don't need a timer for that. Though if you are still interested here is a little example for the timer.
This script shows 2 timers in one.

Header
class MyTimerScript : public ScriptImpClass
{
    void Created(GameObject *obj);
    //'GameObject *obj' is the gameobject the script runs on

    void Timer_Expired(GameObject *obj, int number);
    //obj see above
    //'int number' takes an int value that you can use to check which timer ended.
};


CPP
#include "engine.h"
#include "scripts.h"
#include "MyTimerScript.h"

void MyTimerScript::Created(GameObject *obj)
{
    Commands->Start_Timer(obj, this, 10.0f, 1);
    //param 1 (obj) = object to run the timer on
    //param 2 (this) = a ScriptImpClass class or sub-class (in the header you extended ScriptImpClass so 'this' is a sub-class)
    //param 3 (10.0f) = time in seconds before the timer expires
    //param 4 (1) = number used to check which timer ended (timer ID)

    Commands->Start_Timer(obj, this, 20.0f, 2);
    //param 1 (obj) = see above
    //param 2 (this) = see above
    //param 3 (20.0f) = see above
    //param 4 (2) = see above (number is now 2 so this timer ID is different from the previous one)
}

void MyTimerScript::Timer_Expired(GameObject *obj, int number)
{
    if(number == 1) //if timer with number (ID) 1 ended (the 10 second timer)
    {
        //Do stuff
    }
    else if(number == 2) //else, if timer with number (ID) 2 ended (the 20 second timer)
    {
        //Do other stuff
    }
}


I hope this clears thing up. And you dont have to make scripts in existing CPP or H files. You can add your own. Making your own and adding the above code should work immediately (if you name the header file 'MyTimerScript.h' in this case)


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Wed, 11 August 2010 03:00]

Report message to a moderator

 
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: build error
Next Topic: Update_PT_Data
Goto Forum:
  


Current Time: Wed Dec 18 03:21:27 MST 2024

Total time taken to generate the page: 0.00766 seconds