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-19-2008, 08:23 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.

Last edited by Stryke; 05-20-2008 at 01:22 AM..
Reply With Quote
  #2  
Old 05-19-2008, 08:27 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
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...
Reply With Quote
  #3  
Old 05-19-2008, 08:39 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.

Last edited by Stryke; 05-19-2008 at 08:54 PM..
Reply With Quote
  #4  
Old 05-19-2008, 08:58 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
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
Reply With Quote
  #5  
Old 05-19-2008, 09:04 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.
Reply With Quote
  #6  
Old 05-19-2008, 09:24 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
to destroy the putnpc2 once the player enters the car, then to create a new putnpc2 once the player leaves the car...
Reply With Quote
  #7  
Old 05-19-2008, 09:31 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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?
Reply With Quote
  #8  
Old 05-19-2008, 09:39 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
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
Reply With Quote
  #9  
Old 05-19-2008, 09:43 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Yeah client.RideStatus is already set to NULL on login.

"by sending it through a trigger action"
Send what, for what?
Reply With Quote
  #10  
Old 05-19-2008, 10:05 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
"Also, this.owner seems to only work on the serverside. x.x. How do I access it on the clientside?"
Reply With Quote
  #11  
Old 05-19-2008, 10:25 PM
blazeingonix blazeingonix is offline
† Ðяΰм & βâsş †
blazeingonix's Avatar
Join Date: Apr 2007
Location: PlayBoy Mansion
Posts: 537
blazeingonix is an unknown quantity at this point
Send a message via MSN to blazeingonix
What are this codes?
__________________
Reply With Quote
  #12  
Old 05-19-2008, 10:29 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Quote:
Originally Posted by blazeingonix View Post
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;

Reply With Quote
  #13  
Old 05-19-2008, 11:12 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
no... as in triggerclient?
HTML Code:
triggerclient("weapon", "weaponname", params);
Reply With Quote
  #14  
Old 05-19-2008, 11:41 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Nevermind,.

Last edited by Stryke; 05-20-2008 at 12:45 AM..
Reply With Quote
  #15  
Old 05-20-2008, 12:51 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
Nevermind,.
Use an attr, as I've said multiple times throughout your threads.

Also, please post your solution for others with similar problems.
__________________
Reply With Quote
  #16  
Old 05-20-2008, 01:12 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.
Reply With Quote
  #17  
Old 05-20-2008, 01:18 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
You won't be able to perform triggerserver on serverside ...
__________________
Reply With Quote
  #18  
Old 05-20-2008, 01:59 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
So how would I do this?

Script execution errors:
Function putnpc2 not found at line 102

Why the hell isn't putnpc2 allowed?
Reply With Quote
  #19  
Old 05-20-2008, 02:13 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
Is it on clientside?

putnpc2 is only serverside.
__________________
Reply With Quote
  #20  
Old 05-20-2008, 02:53 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
It's on the Control-NPC, and no it's not clientside.
Reply With Quote
  #21  
Old 05-20-2008, 02:58 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
Control-NPC can't putnpc2 since it isn't in a level.
__________________
Reply With Quote
  #22  
Old 05-20-2008, 05:39 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
So should I use attrs or something?
Can u show me an example..
Reply With Quote
  #23  
Old 05-20-2008, 06:07 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
PHP Code:
function onCreated()
{
  
this.attr[8] = "secret code :)";
}
//#CLIENTSIDE
function onPlayerTouchsMe()
{
  
chat this.attr[8];

__________________
Reply With Quote
  #24  
Old 05-21-2008, 12:20 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Since I can't use putnpc2 on the NPC server, what should I do?
Reply With Quote
  #25  
Old 05-21-2008, 12:50 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
Since I can't use putnpc2 on the NPC server, what should I do?
Trigger an NPC?
__________________
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 01:24 AM.


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