Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   destroy; (https://forums.graalonline.com/forums/showthread.php?t=25651)

happyme 03-14-2002 07:27 AM

destroy;
 
NPC Code:

if (created||playerenters) {
timereverywhere;
timeout=.05;
}
if (playertouchsme&&strequals(playing,#s(etegg))) {
say2 You found it!;
setstring server.eteggwinner,#a;
setlevel2 eteggprize.nw,30,30;
destroy;
}

if (timeout) {
timereverywhere;
timeout=.05;
if (strequals(ended,#s(server.etegg)))
destroy;
}


anyone know why destroy dont work...

Python523 03-14-2002 07:41 AM

once you leave a level the script stops running and thats one of the most pathetic attemps of doing a strequals for a string I've seen
strequals for a string is like this
if (playerhurt&&strequals(#s(client.armor),3)){
blah;
}
for the setlevel2 thing, put the destroy before it, and also remember this, destroy destroys the npc for the WHOLE server

screen_name 03-14-2002 10:47 AM

does destroy delete it from database if it is a database npc??

Python523 03-14-2002 10:52 AM

Quote:

Originally posted by screen_name
does destroy delete it from database if it is a database npc??
Im not sure, I would test it but since Providence is down...x.x

Saga2001 03-14-2002 05:07 PM

Quote:

screen_name
does destroy delete it from database if it is a database npc??
Not to my knowledge.

Quote:

Python523

thats one of the most pathetic attemps of doing a strequals for a string I've seen
strequals for a string is like this
if (playerhurt&&strequals(#s(client.armor),3)){
blah;
}

It only matters with strcontains() with strequals() you are comparing 2 strings to make sure they are the same, why would it matter the order?

Admins 03-14-2002 07:18 PM

Quote:

Originally posted by screen_name
does destroy delete it from database if it is a database npc??
Yes, but your script looked more liked client-side
thing (0.05 seconds timeout?)

SaijinGohan 03-14-2002 09:17 PM

ooooooooh Stefan showed you all up!:p

happyme 03-14-2002 10:02 PM

Quote:

Originally posted by SaijinGohan
ooooooooh Stefan showed you all up!:p
lolz

Quote:

Originally posted by Python523
thats one of the most pathetic attemps of doing a strequals for a string I've seen
strequals for a string is like this
if (playerhurt&&strequals(#s(client.armor),3)){
blah;
}

I dont see whats wrong with it? It does the job doesnt it?

so anyone got any ideas why it doesnt work?
and it is for non-p2p
btw, this is my first time using destroy so im not that familiar.

Saga2001 03-14-2002 10:51 PM

Quote:

Originally posted by happyme

lolz

I dont see whats wrong with it? It does the job doesnt it?

so anyone got any ideas why it doesnt work?
and it is for non-p2p
btw, this is my first time using destroy so im not that familiar.

its probably better to do this, make it destroy before it leaves the level, if you don't the command is not run because the player executing the command is not on the level anymore.
NPC Code:

if (created||playerenters) {
timereverywhere;
timeout=.05;
}
if (playertouchsme&&strequals(playing,#s(etegg))) {
say2 You found it!;
setstring server.eteggwinner,#a;
destroy;
setlevel2 eteggprize.nw,30,30;
}

if (timeout) {
// you don't need timereverywhere more than once.
timeout=.05;
if (strequals(ended,#s(server.etegg)))
destroy;
}


Python523 03-15-2002 06:40 AM

Didn't I say a few posts up that you have to put it above the setlevel/2?

Saga2001 03-15-2002 07:09 AM

Quote:

Originally posted by Python523

for the setlevel2 thing, put the destroy before it, and also remember this, destroy destroys the npc for the WHOLE server

indeed you did...

Python523 03-15-2002 11:54 AM

If I said that, then I ment you would put it right before the setlevel2 since the client stops running scripts once it leaves the level

screen_name 03-15-2002 01:09 PM

Quote:

Originally posted by Stefan


Yes, but your script looked more liked client-side
thing (0.05 seconds timeout?)

thanks

:D

Saga2001 03-15-2002 02:07 PM

Quote:

Originally posted by Kaimetsu
Wha...? You're saying to put the destroy before anything? Nothing will run after a destroy; has been found!
omi, i didn't even think of that...
hmph...
well yeah you could do things with p2p easily...
but with non-p2p you would have to go thru some mondo trouble, but if the player is leaving, i see no reason the npc should be terminated.

neomaximus2k 03-15-2002 04:14 PM

Quote:

Originally posted by Saga2001


omi, i didn't even think of that...
hmph...
well yeah you could do things with p2p easily...
but with non-p2p you would have to go thru some mondo trouble, but if the player is leaving, i see no reason the npc should be terminated.

my point exactly, if the player leaves the level then it is not active for them, why destroy it?
and if you really wanted to destroy it you could but there would have to be 2 people in the room and another NPC to control the destroying process but there is no point

mikepg 03-16-2002 10:16 AM

umm
 
if it's a client side NPC, it wont work, because once you leave the level, it's not going to go to the destroy command.

If it's a server side NPC, it wont work, because the timeout is 0.05

To get it to work serverside, change it to .1 or higher

to get it to work, the client would have to have some kind of weapon that is triggered, or does a timeout check when a new level is entered.

1st NPC (Part of timeout section) :
NPC Code:

if (strequals(#s(server.etegg),ended)) {
for (i=0; i<playerscount; i++; ) {
if (strequals(#s(etegg),playing)) {
client.eteggwon=1;
destroy;
}
}
}


The Weapon
NPC Code:

if (playerenters) {
sleep 1;
if (client.eteggwon=1) {
client.eteggwon=0;
setlevel2 yourlevel,x,y;
}
}


Saga2001 03-16-2002 05:42 PM

Re: umm
 
Quote:

Originally posted by mikepg
<stuff>[/code]
yeah, looks good. i think that you could probably just leave the npc.

happyme 03-17-2002 06:13 AM

Quote:

Originally posted by Saga2001


its probably better to do this, make it destroy before it leaves the level, if you don't the command is not run because the player executing the command is not on the level anymore.
NPC Code:

if (created||playerenters) {
timereverywhere;
timeout=.05;
}
if (playertouchsme&&strequals(playing,#s(etegg))) {
say2 You found it!;
setstring server.eteggwinner,#a;
destroy;
setlevel2 eteggprize.nw,30,30;
}

if (timeout) {
// you don't need timereverywhere more than once.
timeout=.05;
if (strequals(ended,#s(server.etegg)))
destroy;
}


ok would this prevent that enter lv thing??
thanks to all that try to help


All times are GMT +2. The time now is 09:48 AM.

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