View Single Post
  #18  
Old 06-21-2012, 10:16 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to 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;
  }

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;
  }

Reply With Quote