Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-25-2005, 07:26 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Googi
Okay. So say I have an event and I want to do five things. Two are serverside, three are clientside. How do I do this? More realisticly, say I have sixteen events and want each to do 8 things, 4 serverside and 4 clientside. Is there a way to do it without running the script twice (once above the //#CLIENTSIDE and once below it)?
Well, you wouldn't want to run the same script on both clientside and serverside for the obvious reason - the clientside will do some things that the serverside won't and the serverside will do some things that the clientside won't. The NPC-Server won't exactly spit fire if you, say, try to use showimg on the serverside, but it's overall not recommended.

What you need to do is arrange your script so that the serverside and clientside can work together; that's if I've understood what you're trying to do properly, of course. For example, if you want to display pictures on the clientside that warp players when you click them, then you'll want to have the image display and the click detection on the clientside, and triggeraction to the serverside to warp the player.

If you're using a weapon, you can do the following (GScript2):
NPC Code:
function onActionserverside()
{
if (params[0] == "foo")
{
sendtonc("bar");
}
}
//#CLIENTSIDE
function onMouseDown()
{
triggeraction(0, 0, "serverside", "Weapon/Name", "foo");
}


Or GScript:
NPC Code:

if (actionserverside)
{
if (strequals(#p(0), foo))
{
sendtonc bar;
}
}
//#CLIENTSIDE
if (mousedown)
{
triggeraction 0, 0, serverside, Weapon/Name, foo;
}



In these examples, you would put the player warping (or whatever) on the serverside, and the detection of you clicking on the clientside.

If you're not using weapons, then you can still triggeraction to the serverside by triggeractioning on the NPC's coordiates instead of triggeractioning to (0,0).

I hope this is of some help.
__________________
Skyld
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 02:57 PM.


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