EarthQuake
9.5 on the Richter!

Posts: 2710
Registered: 05-03 |
Not quite sure what you're asking here.
You want a single script to continuously loop through each spark thing and activate it? Not sure what you mean by an extra argument though, as scripts can only have three (not quite sure if functions can have more).
If it were me, I would have a script that loops through each spark thing (using a range of tids, or an array that holds all tids of the spark things), and calls another script via ACS_ExecuteAlways() that waits a random amount of time (so the sparks don't "sync") and the spark is activated.
Maybe something like:
code: #define MINSPARK 100 // All spark things in the map use a TID
#define MAXSPARK 120 // between 100 and 120...
Script 100 Open
{
// Loop through each spark thing and call "sparking" script.
For ( int X = MINSPARK; X <= MAXSPARK; X++)
{
// The first script argument (third below), is
// the TID of the spark thing to activate.
ACS_ExecuteAlways(200, 0, X, 0, 0);
}
Delay(70); // Give all sparks enough time to finish.
Restart; // Fire off all sparks again.
}
// Sparking script. First argument (X from above) is the TID.
Script 200 (int TID)
{
Delay(Random(0, 70)); // Get a random time to wait before sparking.
Thing_Activate(TID); // Now spark that bitch!
}
The first script controls sparking indefinitely, while the second script would actually activate the spark. A random delay is used so that the sparks do not all spark at the same instant. ACS_ExecuteAlways() is used, so the same script can be used under multiple instances, although each time it's called, the TID is different, and the random delay is as well.
Edit: You can also use the second script directly if you want to activate a particular spark. So, if you want to call the second script from another script, just copy the above ACS_ExecuteAlways() line and change the X to the TID you want to spark.
I didn't test it (thus I don't know how it looks in-game), and I might have got something wrong, so don't hold it against me. This is probably how I would approach the problem, although it would inevitably require some tweaking. :)
|