Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-17-2008, 07:26 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
putleaps function?

PHP Code:
function onActionServerSide(pa,plx,ply) {
  if(
pa == "board") {
    
triggerclient("weapon",this.name,pa,plx,ply);
  }
}

//#CLIENTSIDE
function onTimeout() {
  if(
onwater(player.x,player.y) && this.waterTimer == 0) {
    
triggerserver("weapon",this.name,"board",player.xplayer.y);
  }
  
this.waterTimer += 1;
  if(
this.waterTimer >= 3)this.waterTimer 0;
  
setTimer(0.05);
}

function 
onActionClientSide(pa,plx,ply) {
  if(
pa == "board") {
    
putleaps(5,plx,ply);
  }

The above code doesn't seem to work. It only displays the water splash leap on my screen, not the others screen. Yes, they do have this weapon also. The putleaps() function only works on the Clientside correct? So how would I make it display to the other players (serverside)?

Last edited by Stryke; 05-17-2008 at 07:38 PM..
Reply With Quote
  #2  
Old 05-17-2008, 07:34 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
can't call it oncreated, make it a function etc

PHP Code:
function onKeyPressed(codekey) {
  if (
temp.key == "s"triggerserver("weapon"this.name"board"player.xplayer.y);

Reply With Quote
  #3  
Old 05-17-2008, 07:37 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
It's just an example, the actual code is in a onTimeout().
My mistake. I'll edit that in first post.

PHP Code:
function onTimeout() {
  if(
onwater(player.x,player.y) && this.waterTimer == 0) {
    
triggerserver("weapon",this.name,"board",player.xplayer.y);
  }
  
this.waterTimer += 1;
  if(
this.waterTimer >= 3)this.waterTimer 0;
  
setTimer(0.05);

Reply With Quote
  #4  
Old 05-17-2008, 07:40 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Are you on a gmap..?
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 05-17-2008, 07:42 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
hmm use a public function....

weapon name: MYWEAPONTESTLOL/HI

HTML Code:
function onTimeout() { 
  if(onwater(player.x, player.y) && this.waterTimer == 0) { 
    findWeapon("MYWEAPONTESTLOL/HI").drawLeap(1, {player.x, player.y});
  } 

  this.waterTimer += 1; 
  if(this.waterTimer >= 3) this.waterTimer = 0; 

  setTimer(0.05); 
}  
inside the weapon 'MYWEAPONTESTLOL/HI' add
HTML Code:
public function drawLeap(type, position) {
  putleaps(temp.type, temp.position[0], temp.position[1]);
}
you could even do this if you wanted to be advanced:-

inside the weapon 'MYWEAPONTESTLOL/HI' also add [normally on the onCreated function]

HTML Code:
leapcontrol = this;
then you can just call the function from any weapon clientside by doing

HTML Code:
leapcontrol.drawLeap(type, {x, y});
Reply With Quote
  #6  
Old 05-17-2008, 08:03 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
If you want it to appear for all players instead of just you, something like this:

PHP Code:
function onActionServerSidecmddx,dy )
{
  switch ( 
cmd )
  {
    case 
"putLeaps":
    {
      for ( 
temp.players )
      {
        
a.triggerclient"gui"name"putLeaps"dxdy );
      }
      break;
    }
  }

__________________
Reply With Quote
  #7  
Old 05-17-2008, 08:05 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Doesn't show the leaps.

Weapon: Board
PHP Code:
function onTimeout() {
if(
onwater(player.x,player.y) && this.waterTimer == 0) {
  
findWeapon("-System/LeapControl").drawLeap(5,playerx,playery);
 }
this.waterTimer += 1;
if(
this.waterTimer >= 3)this.waterTimer 0;
timeout=0.05;

Weapon: -System/LeapControl
NPC Code:
//#CLIENTSIDE
function onCreated() {
leapcontrol = this;
}

public function drawLeap(_type, positionx, positiony) {
putleaps(_type, positionx, positiony);
}

Reply With Quote
  #8  
Old 05-17-2008, 08:14 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
Try this:

PHP Code:
leapcontrol.drawLeap( ... ); 

Also, try making sure all your functions are even being called with an echo().
__________________
Reply With Quote
  #9  
Old 05-17-2008, 10:31 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
It says this: Function leapcontrol.drawLeap not found in script of Weapon Board

and says this when i use findweapon:

Function Weapon -System/LeapControl.drawLeap not found in script of Weapon Board
Reply With Quote
  #10  
Old 05-17-2008, 11:08 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
is 'Board' clientside?
__________________
Reply With Quote
  #11  
Old 05-17-2008, 11:24 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
thx.. made it serverside..

BUT

PHP Code:
public function drawLeap(_typepositionxpositiony) {
  echo(
"LOL");
  
putleaps(_typepositionxpositiony);

doesnt work on the clientside OR the serverside because putleaps is clientside


echo appears though..
Reply With Quote
  #12  
Old 05-17-2008, 11:36 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
is _type allowed? Try changing that variable name.
__________________
Reply With Quote
  #13  
Old 05-17-2008, 11:55 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
It only shows on my screen now.

BTW: it wouldnt show up my screen if _type wasnt allowed

PHP Code:
function onCreated() {
  
leapcontrol this;
}

public function 
drawLeap(_typepositionxpositiony) {
  
triggerclient("weapon",this.name,"leap",_type,positionx,positiony);
}

//#CLIENTSIDE
function onActionClientSide()
{
  if(
params[0] == "leap")
  
putleaps(params[1], params[2], params[3]);

Reply With Quote
  #14  
Old 05-18-2008, 12:27 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 cbk1994 View Post
If you want it to appear for all players instead of just you, something like this:

PHP Code:
function onActionServerSidecmddx,dy )
{
  switch ( 
cmd )
  {
    case 
"putLeaps":
    {
      for ( 
temp.players )
      {
        
a.triggerclient"gui"name"putLeaps"dxdy );
      }
      break;
    }
  }

This will solve your problem.
__________________
Reply With Quote
  #15  
Old 05-18-2008, 12:57 AM
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
Seems excessive for just some leaps. I'd say if you can't get it working clientside, perhaps think about creating your own leap gani and showing it with an index under 200.
Reply With Quote
  #16  
Old 05-18-2008, 01:16 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
That script won't work for me.. forget it too much trouble. thanks guys
Reply With Quote
  #17  
Old 05-18-2008, 02:09 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 Stryke View Post
That script won't work for me.. forget it too much trouble. thanks guys
It's actually a fairly simple script, but fair enough.

Be sure to leave reputation for the ones who help you
__________________
Reply With Quote
  #18  
Old 05-18-2008, 09:22 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
i agree with Dusty, don't do the players loop use a gani instead
Reply With Quote
  #19  
Old 05-18-2008, 04:27 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 DustyPorViva View Post
Seems excessive for just some leaps. I'd say if you can't get it working clientside, perhaps think about creating your own leap gani and showing it with an index under 200.
That or just show a GANI with the putleaps in the script?

PHP Code:
SCRIPT
if ( created )
{
  
putleapsparams[0], params[1], params[2] );
}
SCRIPTEND 
If you don't use if ( created ) you will lose the params sent, for some reason. You could do the same thing with attrs as well though.
__________________
Reply With Quote
  #20  
Old 05-18-2008, 07:39 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbk1994 View Post
That or just show a GANI with the putleaps in the script?

PHP Code:
SCRIPT
if ( created )
{
  
putleapsparams[0], params[1], params[2] );
}
SCRIPTEND 
If you don't use if ( created ) you will lose the params sent, for some reason. You could do the same thing with attrs as well though.
PHP Code:
SCRIPT

function onPlayerEnters(typexxyy) {
  
putleaps(typexxyy);
}

SCRIPTEND 
:o and why do you use "if (created)"?
__________________
Reply With Quote
  #21  
Old 05-18-2008, 08:10 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 Chompy View Post
PHP Code:
SCRIPT

function onPlayerEnters(typexxyy) {
  
putleaps(typexxyy);
}

SCRIPTEND 
:o and why do you use "if (created)"?
I already answered that

Unless it's changed since last I tried.
__________________
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:16 PM.


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