Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-25-2012, 04:05 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Need help with shoot()

I have tried testing it to see if it would shoot a arrow or anything, but it was a no go, I don't even see a shadow being shot. so if anyone could point out what i need to do to get this working, it would be nice, thanks in advance.

Also, additional constructive criticism about the script i have would be nice too. like what i should do instead, or something i should not have done on it would be helpful.


PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.equip false;
  
this.gunout false;
}

function 
onKeyPressed(codekey) {
  if (
key == "d") {
    if (
this.gunout == true) {
      
onFire();
    } else {
      
onGani();
    }
  }
  if (
key == "a") {
    
this.equip this.gunout false;
    
setani("idle"null);
    
replaceani("idle""idle");
    
replaceani("walk""walk");
    
player.chat "Gun off!";
  }
}

function 
onGani() {
  
this.equip true;
  
setani(this.gani_idlenull);
  
replaceani("idle"this.gani_idle);
  
replaceani("walk"this.gani_walk);
  
player.chat "Gun on!";
  
this.gunout true;
}

//problems below

function onFire() {
  
player.chat "Firing!";
  
setani(this.gani_firenull);
  
setshootparams("arrow"player.account);
  
temp.angle getangle(vecx(player.dir), vecy(player.dir));
  
temp.zangle pi 4;
  
temp.power 1.5;
  
shoot(player.xplayer.yplayer.ztemp.angletemp.zangletemp.power"arrow""barrow0.png");

also, whats that second parameter in setani()?
Reply With Quote
  #2  
Old 01-25-2012, 05:32 AM
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
At first glance I'd guess bullets are probably hitting the player after being fired. Have you tried changing the initial x/y?
__________________
Reply With Quote
  #3  
Old 01-25-2012, 05:40 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Not solving your problem directly but...

This scripted Bow example may be of use to you:

PHP Code:
//#CLIENTSIDE

function onWeaponfired() {
  
freezeplayer(0.1);
  
setani("shoot""wbow1.png"); 
  
setshootparams("classic""arrow"player.dirplayer.account);
  
temp.angl getangle(vecx(player.dir), vecy(player.dir));
  
shoot(player.0.5 vecx(player.dir), player.vecy(player.dir), player.ztemp.angl00"classic_arrow"player.dir);

The additional parameters in setani are well.. parameters in the gani:
setani(ani, param1, [param2, param3, ...]);
__________________
Quote:
Reply With Quote
  #4  
Old 01-25-2012, 06:08 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
At first glance I'd guess bullets are probably hitting the player after being fired. Have you tried changing the initial x/y?
I modified it a little bit by adding vecx and vecy but that was it.

and thanks fowlplay4 i'll give it a shot.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:35 PM.


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