Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   shooting part of rc helicopter wont work (https://forums.graalonline.com/forums/showthread.php?t=134261494)

callimuc 01-01-2011 10:56 PM

shooting part of rc helicopter wont work
 
hey guys. i made a rc helicopter and it works just like i want it. now i added a shooting part but it hurts only a few people not everyone (i think just the people who have it). here is the part i think where the problem could be:
PHP Code:

     if(key "d"){
      
setshootparams("callihelimissle"player.account);
      
shoot(this.plane_x vecx(this.plane_dir), this.plane_y vecy(this.plane_dir), playerz, (this.plane_dir+1) * pi random0,0), NULLNULL"callihelimissle"2);
     }
     function 
onActionProjectile()
      {
        
player.hearts-=0.5;
        
setAni("hurt",NULL);
    } 

could anyone help me or tell me what i should fix?

cbk1994 01-01-2011 11:06 PM

You need to move the onActionProjectile stuff to a system weapon which every player has.

Also, use == for comparison, = is for assigning.

PHP Code:

if(key "d"){ 

needs to be
PHP Code:

if(key == "d"){ 

You should also use player.z instead of playerz, although either works.

callimuc 01-01-2011 11:17 PM

so you mean i should just add a new weapon for the callihelimissle?

if yes do i have to change anything in the script than or is it ok than

cbk1994 01-01-2011 11:24 PM

Quote:

Originally Posted by callimuc (Post 1619473)
so you mean i should just add a new weapon for the callihelimissle?

if yes do i have to change anything in the script than or is it ok than

You should probably just have a weapon named "-Projectiles" or so that deals with all projectiles. All players need to have this weapon.

PHP Code:

//#CLIENTSIDE
function onActionProjectile(projType) {
  switch (
projType) {
    case 
"callihelimissile":
      
player.hearts-=0.5
      
setAni("hurt",NULL); 
    break;
  }


Once you've done that you just need to remove the onActionProjectile stuff from the helicopter script and fix the == thing I pointed out.

callimuc 01-01-2011 11:34 PM

ok i´ve fixed the == and made a projectile weapon for all weapons. but what you mean with remove that one part? could you give an example what you mean?

cbk1994 01-01-2011 11:39 PM

PHP Code:

     if(key "d"){ 
      
setshootparams("callihelimissle"player.account); 
      
shoot(this.plane_x vecx(this.plane_dir), this.plane_y vecy(this.plane_dir), playerz, (this.plane_dir+1) * pi random0,0), NULLNULL"callihelimissle"2); 
     } 
     function 
onActionProjectile() 
      { 
        
player.hearts-=0.5
        
setAni("hurt",NULL); 
    } 

becomes

PHP Code:

     if(key == "d"){ 
      
setshootparams("callihelimissle"player.account); 
      
shoot(this.plane_x vecx(this.plane_dir), this.plane_y vecy(this.plane_dir), player.z, (this.plane_dir+1) * pi random0,0), NULLNULL"callihelimissle"2); 
     } 

You should learn to script rather than just taking other peoples' code without understanding it.

callimuc 01-01-2011 11:41 PM

ok thank you for it and i´m learning to script xP


All times are GMT +2. The time now is 07:20 PM.

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