Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   triggeraction doesnt work second time (https://forums.graalonline.com/forums/showthread.php?t=79777)

Stryke 05-19-2008 08:23 PM

Questions about a Skateboard Class NPC
 
Control-NPC:
PHP Code:

function onPlayerLogOut(pl)
{
  if(
pl.client.RideStatus == 1)
  {
    
pl.client.CurrentRide.destroy();
    
triggerserver("weapon","-System/Main","boardstay",pl);
  }


-System/Main Weapon:
PHP Code:

function onActionServerSide(id)
{
  switch(
id)
  {
    case 
"boardstay":
      
temp.pl params[1];
      
temp.putnpc2(temp.pl.x,temp.pl.y,"join(\"object_rideitem\");");
      
temp.r.owner temp.pl.account;
      
temp.r.ani "silence_woodenboardidle2";
      
temp.pl.client.CurrentRide temp.r;
    break;
  }


It gave me a error trying to use the "putnpc2" command in the Control-NPC, so I tried to get around it by making the Control-NPC send a triggerserver to another Weapon, in this case (-System/Main). However, it is never received. (Checked with echo multiple times). How would I get around this?

I need this because I don't want the skateboard to disappear after the player logs out while is on the skateboard.

triggerserver gives an error too.

[email protected] 05-19-2008 08:27 PM

PHP Code:

function onActionGrabbed() {
//Don't parse through the account! it'll make the players account automatically
  
if(player.account != this.owner) return; 
  
with(player) {
    
ani "skateboardidle"//I don't think this is even it [setani?]
    
client.ridestatus 1;
    
triggerclient("weapon""-System/Main""boarddisable");
  }
  
this.hide();


PHP Code:

triggeraction(this.xthis.y"Grabbed"0); 


Thinking about it, you should generally have the getting off the skateboard in the actual weapon, not a class...

Stryke 05-19-2008 08:39 PM

I can't even get on the skateboard now..
BTW ani = gs1 (#m). And yes, it does work.
Its cause setani is clientside.

Even though whats ur saying is true, if it works the 1st time,
why shouldn't it work the 2nd time?

BTW: The actual weapon, is just a blank putnpc2.

[email protected] 05-19-2008 08:58 PM

because you needed to be standing near it to get off the skateboard, check your triggeraction.

you do have a strange way of making this a weapon i must say o-o

Stryke 05-19-2008 09:04 PM

I'm trying to make them like Era cars.

There seems to be nothing wrong with the triggeraction's arguments...
It echoed:

PHP Code:

First time
x
-42.5
y
-50
acct
-Graal711249

Second time
x
-42.5
y
-51.34
acct
-Graal711249 

But it never displays the second "BLAH"..

PHP Code:

function onActionGrabbed(acct)
{
  echo(
"BLAH"); 
  ....
  .....


Well for now I resorted to using a new putnpc2.. Tell me if anyone has any ideas though.

[email protected] 05-19-2008 09:24 PM

to destroy the putnpc2 once the player enters the car, then to create a new putnpc2 once the player leaves the car...

Stryke 05-19-2008 09:31 PM

Yeah, thats what I'm doing, and it works now.
However, there's another problem:

PHP Code:

if (timeout) {
  if (
client.RideStatus==1) {
    for (
this.k=0;this.k<4;this.k++) {
      if (
keydown(this.k)) {
        
player.dir=this.k;
        if (
client.minSpeed client.maxSpeedclient.minSpeed += 0.11;
          if (!
onwall(playerx+vecx(this.k)*client.minSpeed,playery+vecy(this.k)*client.minSpeed))
          {
            
playerx+=vecx(this.k)*client.minSpeed;
            
playery+=vecy(this.k)*client.minSpeed;
          }
      }
      else if(
client.minSpeed>1client.minSpeed -= 0.1;
    }
  }
  
timeout=0.05;


This seems to affect all the players, not just me. How do i fix this
so it only affects me? Like if there was only 1 board on the map it would be normal speed, 2 boards then 2x speed, 3 boards 3x speed, etc and so on.

Also, this.owner seems to only work on the serverside. x.x. How do I access it on the clientside?

[email protected] 05-19-2008 09:39 PM

by sending it through a trigger action.
the other people must have 'client.RideStatus = 1' in their flags. make sure you are resetting this flag to null on login maybe

Stryke 05-19-2008 09:43 PM

Yeah client.RideStatus is already set to NULL on login.

"by sending it through a trigger action"
Send what, for what?

[email protected] 05-19-2008 10:05 PM

"Also, this.owner seems to only work on the serverside. x.x. How do I access it on the clientside?"

blazeingonix 05-19-2008 10:25 PM

What are this codes?

Stryke 05-19-2008 10:29 PM

Quote:

Originally Posted by blazeingonix (Post 1391586)
What are this codes?

?? What are this codes? lol

Anyway, Sidney do you mean this?

PHP Code:

triggeraction(x,y,"owner",this.owner);

//#CLIENTSIDE
function onActionOwner(pl)
{
  
this.owner pl;



[email protected] 05-19-2008 11:12 PM

no... as in triggerclient?
HTML Code:

triggerclient("weapon", "weaponname", params);

Stryke 05-19-2008 11:41 PM

Nevermind,.

cbk1994 05-20-2008 12:51 AM

Quote:

Originally Posted by Stryke (Post 1391591)
Nevermind,.

Use an attr, as I've said multiple times throughout your threads.

Also, please post your solution for others with similar problems. :)

Stryke 05-20-2008 01:12 AM

attr's never work for me, can you please show me a proper example script using attr's? BTW, it's solved anyway. My new problem is that when the NPC-Control won't send a triggerserver to one of my NPCs in the Weapon List, (I tried multiple times with echo). The reason I need the NPC-Control is because of the "function onPlayerLogOut(pl)" check. I need it so that the board isn't deleted when they player leaves while is on the board.

cbk1994 05-20-2008 01:18 AM

You won't be able to perform triggerserver on serverside ...

Stryke 05-20-2008 01:59 AM

So how would I do this?

Script execution errors:
Function putnpc2 not found at line 102

Why the hell isn't putnpc2 allowed?

cbk1994 05-20-2008 02:13 AM

Is it on clientside?

putnpc2 is only serverside.

Stryke 05-20-2008 02:53 AM

It's on the Control-NPC, and no it's not clientside.

cbk1994 05-20-2008 02:58 AM

Control-NPC can't putnpc2 since it isn't in a level.

Stryke 05-20-2008 05:39 AM

So should I use attrs or something?
Can u show me an example..

cbk1994 05-20-2008 06:07 AM

PHP Code:

function onCreated()
{
  
this.attr[8] = "secret code :)";
}
//#CLIENTSIDE
function onPlayerTouchsMe()
{
  
chat this.attr[8];



Stryke 05-21-2008 12:20 AM

Since I can't use putnpc2 on the NPC server, what should I do?

cbk1994 05-21-2008 12:50 AM

Quote:

Originally Posted by Stryke (Post 1391693)
Since I can't use putnpc2 on the NPC server, what should I do?

Trigger an NPC?


All times are GMT +2. The time now is 02:07 PM.

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