Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-05-2007, 07:12 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Gralats

HTML Code:
function onCreated()
{
  this.showcharacter();
  this.updategani();
}

if (updategani)
{
  this.updategani();
}

function updategani() 
{
  temp.gType = 1;
  temp.rupeeAmounts = {{5, 2}, {30, 3}, {100, 4}};
  for (temp.curAmount: temp.rupeeAmounts)
  {
    if (rupees >= temp.curAmount[0])
    {
      temp.gType = temp.curAmount[1];
    }
  }
  this.setcharani("gralats", temp.gType);
}

function onPlayerTouchsMe()
{
  player.rupees += rupees;
  this.destroy();
}

//#CLIENTSIDE
function onCreated()
{
  this.blockAgain();
}
Some fun
Reply With Quote
  #2  
Old 05-05-2007, 07:15 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
I never understood how Gani params work and still don't, explain.
Reply With Quote
  #3  
Old 05-05-2007, 07:19 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Rapidwolve View Post
I never understood how Gani params work and still don't, explain.
Your best bet is to have fun with it.


Basically, treat the gani as an array. [Each param to that ''array'' is classed as the frame]
Reply With Quote
  #4  
Old 05-05-2007, 07:24 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
...What?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #5  
Old 05-05-2007, 07:25 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
ganiName[1] = frame 1 of the ganiName gani
walk[0] = frame 0 of the walk gani.

Easier?
Reply With Quote
  #6  
Old 05-05-2007, 08:49 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Kind of, I've already tried to learn. I've noticed that with gani params on the sprites inside of the gani it has a (#). Is that needed?

No idea if I explained that correctly
Reply With Quote
  #7  
Old 05-05-2007, 09:01 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
setAni( "GANINAME", PARAM1, PARAM2, PARAM3, [...] );

that explain?

In the gani script, use if (created) and then params[0], etc.
You have to use if (created) because onCreated as a function erases those params. To access the params in the gani, use PARAM1, PARAM2, PARAM3, PARAM4

for example, you could make a gani of a 32x32 image you want to drop for example, do this:
setCharAni( "dropitem", "block.png" );
than instead of in the gani putting an image when you add a sprite, put PARAM1.
__________________
Reply With Quote
  #8  
Old 05-05-2007, 09:07 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Wait wait wait, What?

So basically I could use that for equipping things to my player like if I had custom bodies?

Like I could use that to set the images or something? Example:

PHP Code:
function onKeyPressedkeynrkeyname )
{
  if ( 
keyname == "s" )
  {
    
setani"od_custom_swing"clientr.equippedWep[3] );
  }

So it would swing with the current image that is set to that index of the clientr array set to the player of their currently equipped weapon?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #9  
Old 05-05-2007, 09:09 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by killerogue View Post
So it would swing with the current image that is set to that index of the clientr array set to the player of their currently equipped weapon?
Yes, thats how most servers do it, they have one gani and fixed images rather then alot of gani's. I just don't know how to read the param in the actual gani o-o
Reply With Quote
  #10  
Old 05-05-2007, 09:11 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Ho ho! I'm about to have a field day, I was planning on doing something similar to that but didn't know how! For loops will do just fine. =D
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #11  
Old 05-05-2007, 09:12 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
You're passing parameters to the GANI. Inside the gani, either through graalshop or notepad, you can access those parameters.
Like in Chandler's script he is passing the numbers 0-4, for each type of gralat. In the gani, the sprite being displayed is the number of the parameter. So if it's a green gralat, the number 0 is being passed as the parameter, and sprite 0 is being displayed. It's best to look at the gani's as well, so you can understand what they're being used for.
Reply With Quote
  #12  
Old 05-05-2007, 10: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
The sprite should be PARAM1.

then do
setAni( "ANINAME", "swordimage.png" );

then if all your swords use the same template, it's a hell of a lot less ganis.
__________________
Reply With Quote
  #13  
Old 05-06-2007, 03:19 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Yeah I get it now.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #14  
Old 05-06-2007, 08:05 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
whats this do?
and whats it for?
__________________
**FLIP OUT**
Reply With Quote
  #15  
Old 05-06-2007, 08:07 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
The gralat class re-scripted.
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 03:46 PM.


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