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 11-05-2009, 11:17 AM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
gunscript: Yeah i know how unoriginal

Okay so im working on a gunscript.

PHP Code:
//#CLIENTSIDE

function onWeaponFired()
{
  
shoot(player.1.5 vecx(player.dir), player.vecy(player.dir), player.z, (playerdir 1) * pi 2NULLNULL"era_bulletfx"NULL);
  
setani("firegani"NULL);
  
freezeplayer(0.5);
  
}
function 
onActionProjectile()
{
   
player.hearts -= 2;

I don't know what im doing wrong, i don't really understand the shoot command yet, but it's not showing the bullet flying.
Oh and, sometimes if i shoot while walking and shoot again i hurt myself :s
as for this one.
PHP Code:
//#CLIENTSIDE
function onKeyPressed()
{
  
temp.equip 1;
  if (
keydown(5))
  {
    if(
temp.equip == 1)
    {
      
temp.equip 0;
      
setani("gunequip"NULL);
      
sleep(1);
      
setani("gunidle"NULL);
    } 
    else
    {
      
temp.equip 1;
      
setani("idle"NULL);
    }
  }
}
function 
onWeaponFired()
{
  if(
temp.equip == 0)
  {
    
shoot(player.1.5 vecx(player.dir), player.vecy(player.dir), player.z, (playerdir 1) * pi 2NULLNULL"era_bulletfx"NULL);
    
setani("gunidlegani"NULL);
    
freezeplayer(0.1);
  }
}
function 
onActionProjectile()
{
   
player.hearts -= 2;

I need to figure out if the player is moving or standing still, to add a walking/idle gani to it, but i have no idea how to check it, also, the ganis don't seem to be working on this one, i haven't made any gani's myself yet, so i used those of a server, and i even uploaded them to testbed, but they still don't work.

i would've checked the wiki for the shoot command, but as we all know that's temporarily down.

I myself think i need a timeout function that will constantly check if the player is moving or standing still
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.

Last edited by Liberated; 11-05-2009 at 11:35 AM..
Reply With Quote
  #2  
Old 11-05-2009, 12:07 PM
Demisis_P2P Demisis_P2P is offline
Kanto League Champion
Demisis_P2P's Avatar
Join Date: Jan 2005
Posts: 2,357
Demisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud of
Quote:
Originally Posted by Liberated View Post
Okay so im working on a gunscript.

I need to figure out if the player is moving or standing still, to add a walking/idle gani to it, but i have no idea how to check it, also, the ganis don't seem to be working on this one, i haven't made any gani's myself yet, so i used those of a server, and i even uploaded them to testbed, but they still don't work.

i would've checked the wiki for the shoot command, but as we all know that's temporarily down.

I myself think i need a timeout function that will constantly check if the player is moving or standing still
You don't need to figure out if the player is walking or not, just use replaceani instead of setani.

PHP Code:
      client.replaceani = {"idle""gunidlegani"};
      
client.replaceani =  {"walk""gunwalkgani"}; 
__________________
Reply With Quote
  #3  
Old 11-05-2009, 12:31 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
oh awesome! didn't know that.
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #4  
Old 11-05-2009, 01:34 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
it fires, and uses the firing gani when i use the fire button, but then i go back to the normal idle gani, and my way of turning the weapon on and off also isn't working.
PHP Code:
//#CLIENTSIDE

function onWeaponFired()
{
  if(
temp.equip == 0)
  {
    
shoot(player.1.5 vecx(player.dir), player.vecy(player.dir), player.z-1, (playerdir 1) * pi 2NULLNULL"arrow"NULL);
    
setani("era_deagle-fire"NULL);
    
client.replaceani =  {"idle""era_deagle-idle"};
    
client.replaceani =  {"walk""era_deagle-walk"};
    
freezeplayer(0.1);
  }
  else
  {
  
player.chat "hi";
  }
}
function 
onActionProjectile()
{
  
player.hearts -= 2;
}  
function 
onKeyPressed(code,key)


  if(
key == "f" && temp.equip == 1)
  {
    
client.replaceani =  {"era_deagle-reload"};
    
client.replaceani =  {"idle""era_deagle-idle"};
    
client.replaceani =  {"walk""era_deagle-walk"};
    
temp.equip 0;
  } 
  else if(
key == "f" && temp.equip == 0)
  {
    
setani("idle");
    
temp.equip 1;
  }

__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #5  
Old 11-05-2009, 03:27 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
PHP Code:
client.replaceani =  {"walk""era_deagle-walk"}; 
... is most likely a string that a system in Era reads to determine what ganis to replace.

The "proper" way of doing it would be like this:

PHP Code:
replaceAni("walk""era_deagle-walk"); 
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #6  
Old 11-05-2009, 03:30 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by xXziroXx View Post
... is most likely a string that a system in Era reads to determine what ganis to replace.
Exactly What have you done, Demisis?
__________________
Reply With Quote
  #7  
Old 11-05-2009, 03:31 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
ah thanks, hopefully it will work now

edit: so far so good,
only 1 problem, my gun always fires when i press D, and my script to turn it on/off doesn't respond at all.
PHP Code:
//#CLIENTSIDE

function onWeaponFired()
{
  if(
temp.equip == 0)
  {
    
shoot(player.1.5 vecx(player.dir), player.vecy(player.dir), player.z-1, (playerdir 1) * pi 2NULLNULL"arrow"NULL);
    
setani("era_deagle-fire"NULL);
    
replaceAni("idle""era_deagle-idle");
    
replaceAni("walk""era_deagle-walk");
    
freezeplayer(0.1);
  }
  else
  {
  
player.chat "hi";
  }
}
function 
onActionProjectile()
{
  
player.hearts -= 2;
}  
function 
onKeyPressed()
{
  if (
keydown(5))
  {
    if(
temp.equip == 1)
    {
      
setani("era_deagle-reload");
      
replaceani("idle""era_deagle-idle");
      
replaceani("walk""era_deagle-walk");
      
temp.equip 0;
    }

    else
    {
      
replaceAni("idle""idle");
      
replaceAni("walk""walk");
      
temp.equip 1;
    }
  }

editedit:
actually it does turn it off, but not on, and it also slashes my sword so i need to find a fix for that.

editeditedit: Yay got it working, thanks for the help! I also played a bit with the shoot settings, i now get how they work.
PHP Code:
//#CLIENTSIDE
function onKeyPressed()
{
  if (
keydown(6))
  {
    
this.equip this.equip;
    
    if (
this.equip == NULL)
    {
      
replaceAni("idle""idle");
      
replaceAni("walk""walk");
      
setani("walk");
    }
    else
    {
      
setani("era_deagle-reload");
      
replaceAni("idle""era_deagle-idle");
      
replaceAni("walk""era_deagle-walk");
    }
  }
}
function 
onWeaponFired()
{
  if(
this.equip == 1)
  {
    
shoot(player.0.5 vecx(player.dir), player.vecy(player.dir), player.z-1, (playerdir 1) * pi 2NULLNULL"arrow"NULL);
    
setani("era_deagle-fire"NULL);
    
freezeplayer(0.1);
  }
  else
  {
  
player.chat "no gun equiped";
  }
}
function 
onActionProjectile()
{
  
player.hearts -= 2;

__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.

Last edited by Liberated; 11-05-2009 at 04:08 PM..
Reply With Quote
  #8  
Old 11-05-2009, 08:49 PM
Demisis_P2P Demisis_P2P is offline
Kanto League Champion
Demisis_P2P's Avatar
Join Date: Jan 2005
Posts: 2,357
Demisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud ofDemisis_P2P has much to be proud of
Quote:
Originally Posted by Crow View Post
Exactly What have you done, Demisis?
I DIDN'T KNOW! Oh god, I accidentally gave away an Era secret.

(tbh I just suck at gs2)
__________________
Reply With Quote
  #9  
Old 11-05-2009, 09:02 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Demisis_P2P View Post
I DIDN'T KNOW! Oh god, I accidentally gave away an Era secret.

(tbh I just suck at gs2)
What a secret Been leaked a hundred times already anyway. But you gave false advice! That's far worse
__________________
Reply With Quote
  #10  
Old 11-06-2009, 01:02 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
Quote:
Originally Posted by Demisis_P2P View Post
I DIDN'T KNOW! Oh god, I accidentally gave away an Era secret.

(tbh I just suck at gs2)
That's not even the proper way to do it on Era .
__________________
Reply With Quote
  #11  
Old 11-06-2009, 07:03 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
That's not even the proper way to do it on Era .
It was, if I recall correctly. Been a while.
__________________
Reply With Quote
  #12  
Old 11-06-2009, 11:12 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 Crow View Post
It was, if I recall correctly. Been a while.
They're going to overwrite each other.

Quote:
Originally Posted by Demisis_P2P View Post
You don't need to figure out if the player is walking or not, just use replaceani instead of setani.

PHP Code:
      client.replaceani = {"idle""gunidlegani"};
      
client.replaceani =  {"walk""gunwalkgani"}; 
You'll also need to call the movement system and tell it the GANIs have been updated.
__________________
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 12:23 AM.


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