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.