Quote:
Originally Posted by FawFul
I would really love to see a Respawn trigger crate script for any ID explained, short and with variables!
|
Two notes:
1) Trigger crates only query their Trigger ID when they're destroyed, so it's a question of the xOrg/yOrg bitfeld, not setting some other property to the desired ID.
2) Unless you're doing a single player level, you should probably use a generator object instead, so that the trigger crate is shared throughout the server. Otherwise you run the risk of the crate only existing locally and thus only changing a trigger locally.
If you still want such a script, though, I'd be tempted to do something like this pseudocode:
Code:
class myTriggerCrateGenerator:
uint16 xOrg;
uint16 yOrg;
uint respawnCounter = 0;
uint respawnDelay;
int object = 0;
void myTriggerCrateGenerator(uint16 x, uint16 y, uint d) {
xOrg = x*32; yOrg = y*32; respawnDelay = d;
}
void do() {
switch (respawnCounter) {
case 0:
jjOBJ@ o = jjObjects[object];
if (!(o.isActive && o.eventID == OBJECT::TRIGGERCRATE && o.xOrg == xOrg && o.yOrg == yOrg))
respawnCounter = 1;
break;
case respawnDelay: //this doesn't work, but in pseudo-code it does!
respawnCounter = 0;
object = jjAddObject(OBJECT::TRIGGERCRATE, xOrg, yOrg);
break;
default:
++respawnCounter;
}
}
And then have an array of myTriggerCrateGenerator objects and call do() on each of them every tick. But this is really just reinventing the wheel.
__________________
|