Quote:
Originally Posted by ffcmike
The problem now is that you are checking if conditions are true having already determined if a previous condition was true, and so both actions are happening within the same fire.
While there are better ways to go about this, this script could be compressed down to:
PHP Code:
if (weaponfired){
if(client.bomb == 1){
setani shoot,remote.png;
setimg remotebomb1.png;
client.explosion = 1;
client.bomb = 0;
}
else{
if(playerdir == 0){
this.placex = playerx + 0.5;
this.placey = playery - 1;
}
else if(playerdir == 1){
this.placex = playerx - 1.5;
this.placey = playery + 1;
}
else if(playerdir == 2){
this.placex = playerx + 0.5;
this.placey = playery + 2.5;
}
else if(playerdir == 3){
this.placex = playerx + 2.5;
this.placey = playery + 1;
}
putnpc remotebomb1.png,remotebomb.txt,this.placex,this.placey;
client.bomb = 1;
}
}
This won't work because the if condition is not occurring within an action.
You could try:
PHP Code:
//weapon
if (weaponfired){
if(client.bomb == 1){
setani shoot,remote.png;
setimg remotebomb1.png;
triggeraction this.placex,this.placey,explode,;
client.bomb = 0;
}
}
//npc
if(actionexplode){
canbecarried;
setimg remotebomb2.png;
sleep 0.5;
putexplosion 2,x,y;
client.explosion=0;
destroy;
}
or
PHP Code:
if(created){
setimg remotebomb1.png;
timeout = 0.05;
}
if(timeout){
if(client.explosion){
canbecarried;
setimg remotebomb2.png;
sleep 0.5;
putexplosion 2,x,y;
client.explosion=0;
destroy;
}
else{
timeout = 0.05;
}
}
|
It still did not work, I tried all of those, the first one would place either a bomb that does not blow up or a bomb that does blow up instead of placing one and it changes into the other. Then I forget which one does which, but one of the bottom ones allows you to place more than one bomb and they still don't blow up, and the other does not place bombs, and if your wonder, I know that the second last one only replaced the last flag of the script.