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;
}
}
Quote:
PHP Code:
if (created) {
setimg remotebomb1.png;
}
if (client.explosion==1) {
canbecarried;
setimg remotebomb2.png;
sleep 0.5;
putexplosion 2,x,y;
client.explosion=0;
destroy;
}
|
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;
}
}