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 08-12-2010, 11:09 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Hat Weapon

Hi all, I'm trying to make a simple NPC when player fires it, it checks if the player has tht hat on, if he does it sets the hat to hat.png, if not it sets the players hat to the hat filename, someone please help me, this is what ive got so far

PHP Code:
//#CLIENTSIDE

function onWeaponFired()
{
  {
  if (
player.attr[1] = "ds-gasmask.png")
  
player.attr[1] = "hat.png"
  }
  else
  {
  
player.attr[1] = "ds-gasmask.png";
  }

Thanks!
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
  #2  
Old 08-12-2010, 11:24 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by iSlayer View Post
Hi all, I'm trying to make a simple NPC when player fires it, it checks if the player has tht hat on, if he does it sets the hat to hat.png, if not it sets the players hat to the hat filename, someone please help me, this is what ive got so far

PHP Code:
//#CLIENTSIDE

function onWeaponFired()
{
  {
  if (
player.attr[1] = "ds-gasmask.png")
  
player.attr[1] = "hat.png"
  }
  else
  {
  
player.attr[1] = "ds-gasmask.png";
  }

Thanks!
Your brackets are off.

PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
  if (
player.attr[1] = "ds-gasmask.png") {
  
player.attr[1] = "hat.png"
}
  else if (
player.attr[1] = "hat.png") {
  
player.attr[1] = "ds-gasmask.png'";

I think that'll work.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #3  
Old 08-12-2010, 11:45 AM
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 Fulg0reSama View Post
Your brackets are off.

PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
  if (
player.attr[1] = "ds-gasmask.png") {
  
player.attr[1] = "hat.png"
}
  else if (
player.attr[1] = "hat.png") {
  
player.attr[1] = "ds-gasmask.png'";

I think that'll work.
Not quite what he wanted though, and your equal signs are off This should do:
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
  if (
player.attr[1] == "ds-gasmask.png") {
    
player.attr[1] = "hat.png"
  } else {
    
player.attr[1] = "ds-gasmask.png'";
  }

Remember: When comparing stuff, you need two equal signs.
Reply With Quote
  #4  
Old 08-12-2010, 12:24 PM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Thanks guys!
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
  #5  
Old 08-12-2010, 12:43 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Crow View Post
Remember: When comparing stuff, you need two equal signs.
Thanks for reminding, I haven't scripted in a long while.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #6  
Old 08-12-2010, 10:19 PM
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
Tip: Create a -Hat system, and have your Hat weapons call one it's functions. That way if you want to add an haton, hatoff animation you don't have change all your Hat weapons.

I.e:

-Hat

PHP Code:
//#CLIENTSIDE

public function changeHat(hatimg) {
  if (
player.attr[1] == hatimg) { 
    
player.attr[1] = "hat.png";  
  } else { 
    
player.attr[1] = hatimg
  }

Hats/Gasmask:

PHP Code:
//#CLIENTSIDE

function onWeaponFired() {
  (@
"-Hat").changeHat("ds-gasmask.png");

__________________
Quote:
Reply With Quote
  #7  
Old 08-13-2010, 12:56 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
and would I just put a command which sets the animation?
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
  #8  
Old 08-13-2010, 01:24 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
Quote:
Originally Posted by iSlayer View Post
and would I just put a command which sets the animation?
You would use setani in -Hat instead of in all of the Hats/*.
__________________
Quote:
Reply With Quote
  #9  
Old 08-13-2010, 06:07 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
so if I make the gani hat_puton.gani for example and I put that after it sets the hat the gani should display the player putting on the specified hat, in other words. Thanks
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
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 07:23 AM.


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