Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #17  
Old 06-21-2012, 10:30 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
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.
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.