Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   putleaps function? (https://forums.graalonline.com/forums/showthread.php?t=79763)

Stryke 05-17-2008 07:26 PM

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)?

[email protected] 05-17-2008 07:34 PM

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);



Stryke 05-17-2008 07:37 PM

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);



Tigairius 05-17-2008 07:40 PM

Are you on a gmap..?

[email protected] 05-17-2008 07:42 PM

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});

cbk1994 05-17-2008 08:03 PM

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;
    }
  }



Stryke 05-17-2008 08:05 PM

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);
}


cbk1994 05-17-2008 08:14 PM

Try this:

PHP Code:

leapcontrol.drawLeap( ... ); 


Also, try making sure all your functions are even being called with an echo().

Stryke 05-17-2008 10:31 PM

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

Chompy 05-17-2008 11:08 PM

is 'Board' clientside?

Stryke 05-17-2008 11:24 PM

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..

cbk1994 05-17-2008 11:36 PM

is _type allowed? Try changing that variable name.

Stryke 05-17-2008 11:55 PM

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]);



cbk1994 05-18-2008 12:27 AM

Quote:

Originally Posted by cbk1994 (Post 1391264)
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.

DustyPorViva 05-18-2008 12:57 AM

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.

Stryke 05-18-2008 01:16 AM

That script won't work for me.. forget it too much trouble. thanks guys

cbk1994 05-18-2008 02:09 AM

Quote:

Originally Posted by Stryke (Post 1391325)
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 :)

[email protected] 05-18-2008 09:22 AM

i agree with Dusty, don't do the players loop use a gani instead

cbk1994 05-18-2008 04:27 PM

Quote:

Originally Posted by DustyPorViva (Post 1391315)
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.

Chompy 05-18-2008 07:39 PM

Quote:

Originally Posted by cbk1994 (Post 1391400)
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)"?

cbk1994 05-18-2008 08:10 PM

Quote:

Originally Posted by Chompy (Post 1391434)
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.


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.