Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-01-2011, 10:56 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Red face 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?
Reply With Quote
  #2  
Old 01-01-2011, 11:06 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #3  
Old 01-01-2011, 11:17 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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
Reply With Quote
  #4  
Old 01-01-2011, 11:24 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by callimuc View Post
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.
__________________
Reply With Quote
  #5  
Old 01-01-2011, 11:34 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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?
Reply With Quote
  #6  
Old 01-01-2011, 11:39 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #7  
Old 01-01-2011, 11:41 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
ok thank you for it and i´m learning to script xP
Reply With Quote
Reply


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 01:20 AM.


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