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 01-21-2006, 01:12 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
What's Wrong?

I'm having trouble making a script that, after a certain amount of time (seconds) it warps you to a level.

NPC Code:
//#CLIENTSIDE
if (playerenters||created) {
timeout = 1;
}
if (timeout) {
this.warp==1;
}
if (this.warp==1) {
setlevel2 onlinestartlocal.nw,30,30;
}

__________________

Reply With Quote
  #2  
Old 01-21-2006, 01:19 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
o.O

HTML Code:
//#CLIENTSIDE
if (playerenters || created) {
  timeout = 1;
}

if (timeout) {
  setlevel2 onlinestartlocal.nw,30,30;
}
Reply With Quote
  #3  
Old 01-21-2006, 01:22 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Doesn't work...
__________________

Reply With Quote
  #4  
Old 01-21-2006, 01:27 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Oh, I just realized. That script is clientside. setlevel2 doesn't work clientsidely.
Reply With Quote
  #5  
Old 01-21-2006, 01:35 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
So, how would I make a script that after a certain amount of seconds or whatever, it warps you from the level you are, to the OSL?
__________________

Reply With Quote
  #6  
Old 01-21-2006, 03:28 PM
Kronan Kronan is offline
yo
Kronan's Avatar
Join Date: May 2001
Location: Florida, USA
Posts: 682
Kronan is on a distinguished road
Send a message via ICQ to Kronan Send a message via AIM to Kronan Send a message via Yahoo to Kronan
HTML Code:
if (actionserverside) {
  setlevel2 onlinestartlocal.nw,30,30;
}

//#CLIENTSIDE
if (playerenters || created) {
  timeout = 1;
}

if (timeout) {
  triggeraction 0,0,serverside,#n;
}
__________________
Reply With Quote
  #7  
Old 01-21-2006, 06:27 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Something isn't right, it still refuses to work online.
__________________

Reply With Quote
  #8  
Old 01-21-2006, 06:58 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by Kronan
HTML Code:
if (actionserverside) {
  setlevel2 onlinestartlocal.nw,30,30;
}

//#CLIENTSIDE
if (playerenters || created) {
  timeout = 1;
}

if (timeout) {
  triggeraction 0,0,serverside,#n;
}
...dont give bad advice, i'm assuming this is a level npc
NPC Code:

if (actionserverside) setlevel2 onlinestartlocal.nw,30,30;
//#CLIENTSIDE
if (created || playerenters) timeout = 1;
if (timeout) triggeraction x,y,serverside,;


i dont really mind giving this out since its just 4 lines, but you should really look over some of the documents graal give you or visit Graal Wiki.
__________________
Reply With Quote
  #9  
Old 01-21-2006, 07:03 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Would it help if I said that's not working either? ;-;
__________________

Reply With Quote
  #10  
Old 01-21-2006, 07:19 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
. . .
Wtf is wrong with you people

PHP Code:
if (created) {
  
setshape 1,16,16;
}
if (
actiondowarp) {
  
with (getplayer(#p(0))) {
    
setlevel2 onlinestartlocal.nw,30,30;
  }
}
//#CLIENTSIDE
if (playerenters) {
  
timeout 1;
}
if (
timeout) {
  
triggeraction x+.5,y+.5,dowarp,#a;

You can't trigger something unless it has a shape.
Reply With Quote
  #11  
Old 01-21-2006, 07:24 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Heh, I should have taken your word on your scripting skills before and hired you. But I guess it was protocol. O_o
__________________

Reply With Quote
  #12  
Old 01-21-2006, 07:27 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 Yen
. . .
Wtf is wrong with you people

PHP Code:
if (created) {
  
setshape 1,16,16;
}
if (
actiondowarp) {
  
with (getplayer(#p(0))) {
    
setlevel2 onlinestartlocal.nw,30,30;
  }
}
//#CLIENTSIDE
if (playerenters) {
  
timeout 1;
}
if (
timeout) {
  
triggeraction x+.5,y+.5,dowarp,#a;

You can't trigger something unless it has a shape.
Do not always trust the information that the client sends.

You do not actually need to send the account name, and you do not actually need to use getplayer() to warp the player.
__________________
Skyld
Reply With Quote
  #13  
Old 01-21-2006, 07:33 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
You don't? How would it know which player to warp, if there's more than one?
Reply With Quote
  #14  
Old 01-21-2006, 07:36 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
It automatically uses the account name of the player triggering it. It's a lot more secure without sending #a, since clientside info can be edited. Plus, you don't have to +.5 to the xy coordinates of the level npc, it should trigger just fine. =\
__________________
Reply With Quote
  #15  
Old 01-21-2006, 07:54 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Neh, I've never had it trigger using x,y.
I didn't know it automatically referenced the player that sent the trigger O-o
Reply With Quote
  #16  
Old 01-21-2006, 08:04 PM
RavenofEarth RavenofEarth is offline
Registered User
RavenofEarth's Avatar
Join Date: Jan 2005
Posts: 86
RavenofEarth is on a distinguished road
Send a message via AIM to RavenofEarth
Eh, it works though, appreciate it Yen.
__________________

Reply With Quote
  #17  
Old 01-21-2006, 08:07 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
what's wrong with just doing this

HTML Code:
if (created || playerenters)
 {
  sleep 1;
  setlevel2 onlinestartlocal.nw,30,30;
 }
Reply With Quote
  #18  
Old 01-21-2006, 08:08 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
If a player enters before the first one is warped, one player won't be warped.
Reply With Quote
  #19  
Old 01-21-2006, 09:04 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 Yen
If a player enters before the first one is warped, one player won't be warped.
Not quite!

sleep causes a loss of focus on the player.
__________________
Skyld
Reply With Quote
  #20  
Old 01-22-2006, 12:28 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by RavenofEarth
I'm having trouble making a script that, after a certain amount of time (seconds) it warps you to a level.

NPC Code:
//#CLIENTSIDE
if (playerenters||created) {
timeout = 1;
}
if (timeout) {
this.warp==1;
}
if (this.warp==1) {
setlevel2 onlinestartlocal.nw,30,30;
}

First, it would be wise to tell us if this is supposed to be a level NPC or a weapon NPC. The best solution to this problem differs between the two.

The main problem with your script is that your last block is a conditional block instead of an event block. Rick suggested how to best fix that.

The secondary problem with your script is that setlevel2 is a serverside command and must be executed on serverside.

---

There has been a lot of bad advice in this thread, and it has not made me very happy.

Quote:
Originally Posted by Rick
o.O

HTML Code:
//#CLIENTSIDE
if (playerenters || created) {
  timeout = 1;
}

if (timeout) {
  setlevel2 onlinestartlocal.nw,30,30;
}
I know you know that setlevel2 isn't a clientside command, but please look more carefully in the future to avoid making the same mistake.

Quote:
Originally Posted by Kronan
HTML Code:
if (actionserverside) {
  setlevel2 onlinestartlocal.nw,30,30;
}

//#CLIENTSIDE
if (playerenters || created) {
  timeout = 1;
}

if (timeout) {
  triggeraction 0,0,serverside,#n;
}
You are suggesting a weapon script. Not only would it be wise to note this, but it would probably be wise not to suggest a weapon script that tries to trigger to a weapon sharing the same name as the player's current nickname.
Quote:
Originally Posted by ZeLpH_MyStiK
...dont give bad advice, i'm assuming this is a level npc
NPC Code:

if (actionserverside) setlevel2 onlinestartlocal.nw,30,30;
//#CLIENTSIDE
if (created || playerenters) timeout = 1;
if (timeout) triggeraction x,y,serverside,;


i dont really mind giving this out since its just 4 lines, but you should really look over some of the documents graal give you or visit Graal Wiki.
Bad assumption to make at this point without further information. Also, as Yen pointed out, it would require a setshape (or an image) to function properly.

However.

Quote:
Originally Posted by Yen
. . .
Wtf is wrong with you people

PHP Code:
if (created) {
  
setshape 1,16,16;
}
if (
actiondowarp) {
  
with (getplayer(#p(0))) {
    
setlevel2 onlinestartlocal.nw,30,30;
  }
}
//#CLIENTSIDE
if (playerenters) {
  
timeout 1;
}
if (
timeout) {
  
triggeraction x+.5,y+.5,dowarp,#a;

You just suggested a script that would allow malicious people to warp any player on the server to the onlinestartlocal, regardless of where they are or what they're doing. You've become a trainer enabler; good job!

Quote:
Originally Posted by Prozac
what's wrong with just doing this

HTML Code:
if (created || playerenters)
 {
  sleep 1;
  setlevel2 onlinestartlocal.nw,30,30;
 }
Mostly just that it wouldn't work. As Skyld noted, sleep changes the scope. You can check out the effect yourself with a simple script:

NPC Code:
function onPlayerEnters() {
echo("1:" @ player.account);
sleep(1);
echo("2:" @ player.account);
}



---

Please, in the future, take care not to give bad advice. Remember, folks who consistently give bad advice will be masked from this forum. If you want to help (this part is appreciated) but have no idea what you're talking about or don't take the time to look at your solution carefully (this part is not), please don't confuse the person you're trying to help.
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 09:34 PM.


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