1.0
24 Feb 2013 18:33
array<int> holder(33, 32);
array<int> holdID(33, 32);
array<int> svHoldID(33, 32);
array<int> svHolder(33, 32);
array<bool> locker(33, false);
array<bool> svLocker(33, false);
//"32" is a default value; it's not player 32 because that would be 31.
void onPlayer() {
for(int i=0;i<32;i++) {
if(jjEventGet(jjPlayers[i].xPos/32, jjPlayers[i].yPos/32) == 255) { //if you wish, you can change 255 here to any other event. use AREA::TRIGGERZONE or 246 for trigger zone event.
int triggerID = jjParameterGet(jjPlayers[i].xPos/32, jjPlayers[i].yPos/32, 0, 5);
int on = jjParameterGet(jjPlayers[i].xPos/32, jjPlayers[i].yPos/32, 5, 1);
int svitch = jjParameterGet(jjPlayers[i].xPos/32, jjPlayers[i].yPos/32, 6, 1);
// I used "svitch" instead of "switch" because "switch" would give me an error, because it already exists in angelscript not as a variable.
int hold = jjParameterGet(jjPlayers[i].xPos/32, jjPlayers[i].yPos/32, 7, 1);
if(hold == 1) {
if(jjTriggers[triggerID] != (on == 1)) {
if(locker[triggerID]) if(i != holder[triggerID]) return;
if(!jjTriggers[triggerID]) {
jjTriggers[triggerID] = true;
if(!locker[triggerID]) {
locker[triggerID] = true;
holder[triggerID] = i;
holdID[i] = triggerID;
}
}
}
} else {
if(svitch == 1) {
if(!svLocker[triggerID]) {
svLocker[triggerID] = true;
bool oldState = jjTriggers[triggerID];
jjTriggers[triggerID] = (true != oldState);
svHolder[triggerID] = i;
svHoldID[i] = triggerID;
}
} else {
if(jjTriggers[triggerID] != (on == 1)) jjTriggers[triggerID] = (on == 1);
}
}
} else {
for(int j=0;j<32;j++) {
if(i == holder[holdID[j]] && holdID[j] != 32) {
if(jjTriggers[holdID[j]]) jjTriggers[holdID[j]] = false;
if(locker[holdID[j]]) locker[holdID[j]] = false;
holder[holdID[j]] = 32; holdID[j] = 32;
}
}
for(int k=0;k<32;k++) {
if(svLocker[svHoldID[k]] && i == svHolder[svHoldID[k]] && svHolder[svHoldID[k]] != 32) {
svLocker[svHoldID[k]] = false;
svHolder[svHoldID[k]] = 32;
}
}
}
}
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.