![]() |
gs2 obstacles
I am getting the hang of gs2, but there are a couple of situations that I have not been able to find a way around.
(all examples //#CLIENTSIDEd) Old gscript : you can check for created and playerenters in one line NPC Code: but how do you check for multiple events with gs2 other than this cumbersome repetition? NPC Code: Also, how do you have two separate timeout loops in one npc that operate intependently depending on a boolean flag (variable that is 1 or 0) Old gscript example NPC Code: This script woked fine, and then it was unchanged when my server was switched to gscript2, then it did not function in switching to the second timeout loop. I tried switching it to gscript2, even changing the flag to a client.string and breaking the timeout loops into two separate npcs and it still did not work. Why not??? example of gs2 NPC Code: I also tried it with 2 separate timeout loops NPC Code: and neither one of those worked ... what am I doing wrong??? the first timeout is to see if an "on" key is pressed and to hide images, The second timeout is to show the images and allow the image positions to be changed through a function if other keys are pressed, and to see if the "off" key is pressed. Any help would be appreciated |
Quote:
PHP Code:
|
Quote:
PHP Code:
|
oops - forgot to add the timeout reset!
re-read the code above, it now shows the timeouts as loops where appropriate. |
HTML Code:
//#CLIENTSIDE |
Just a general question...
Is it bad if you don't use this.setTimer(float)? (ex: setTimer(float);) I'm guessing that it wouldn't be, since commands without the "this." prefix are already being called to the current 'object'? |
Quote:
I do it in accordance to Era's Scripting Guidelines. |
object.catchevent(name,event,newevent);
It calls 'newevent' every time 'event' is called. It's main use is in GUI Controls, when you use a for() to create multiple buttons. You can use a catchevent to make clicking each button call the same event. npc.catchevent(#N,"onPlayerEnters","onCreated"); This calls 'onCreated' each time 'onPlayerEnters' is called. By the way, I only think npc. is required when it's used in an NPC Weapon. I don't know for sure, as I haven't tried it without the npc. prefix. |
New question: I have tried for hours to get a very simple thing to work:
when you enter a level, your y is set to 0 and is increased through a timeout. this part works fine. What I can't get to work is when the playery is greater than 55 it warps the player to another level. Since the timeout and playery manipulation is clientside, and setlevel2 is serverside, I need a triggeraction, right? I have tried to no avail: -putting the whole script as a serverside event -doing a triggeraction in the npc that is in the level on the npc's x and y, and above the clientside line in the npc, placing the actionserverside and setlevel commands -leaving the triggeraction in the npc in the level but moving the action part into a weapon npc with a unique action name -moving the entire script into the weapon npc and the level adds the weapon npc when you enter the level -adding a warp box at the bottom of the level nothing works!!! the player goes from the top to the bottom of the level (y increases) but it will not warp the player - the triggeraction never gets to the serverside command regardless of where the setlevel2 command is. please help! |
| All times are GMT +2. The time now is 04:59 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.