Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   only works for leader (https://forums.graalonline.com/forums/showthread.php?t=9115)

Luigi223 08-08-2001 05:58 AM

only works for leader
 
why do some of the npcs i make only work for the leader of the level ... is there a way to make them work for everyone ? :confused:

LiquidIce00 08-08-2001 06:37 AM

i know i hate that
sometimes timereverywhere helps with that
sometimes it doesnt.

BocoC 08-08-2001 07:18 AM

That is the downfall of non-npcserver scripting. Timereverywhere might help. Just code and code and code till you find a way to get around it.

LiquidIce00 08-08-2001 07:26 AM

sometimes nothing u can do about it

Tyhm 08-08-2001 08:09 AM

if(playerenters) timeout=0.05; sets the only instance of timeout for the NPC for the first player who enters. Every subsequent player enters, and it does nothing because the timeout's already in use.
Timereverywhere makes a new timer for that player when it's called. If you don't have timereverywhere before your timeouts, it'll set the NPC's public timeout instead of the NPC's private timeout.
so:
if(playerenters||timeout){
shootball;
timereverywhere;
timeout=2;
}
will shoot a ball at the leader every 2 seconds.
if(playerenters||timeout){
shootball;
timereverywhere;
timeout=2;
}
will shoot a ball at everyone in the level every 2 seconds.
if(playerenters||timeout){
x=(x+1)%62;
timereverywhere;
timeout=0.05;
}
will move the NPC right one tile for EVERY PLAYER IN THE LEVEL.
if(playerenters||timeout){
x=(x+1)%62;
timeout=0.05;
}
will keep it at a constant speed.

LiquidIce00 08-08-2001 09:43 AM

u messed up with the first and second code. they the same.

Luigi223 08-08-2001 11:57 AM

i tryed making a stairs u auto walk up ... it has stuff like


playerx=43;
playery=32;
sleep0.5;
playery=32.5;


and so forth


but when i got it uploaded it only works for the first person in the level and it messes up .... whould timereverywhere work with that ?

08-08-2001 02:16 PM

Quote:

Originally posted by Luigi223
i tryed making a stairs u auto walk up ... it has stuff like


playerx=43;
playery=32;
sleep0.5;
playery=32.5;


and so forth


but when i got it uploaded it only works for the first person in the level and it messes up .... whould timereverywhere work with that ?

For the auto walking up the stairs i will try something like

NPC Code:

if (playertouchsme) {
set moveplayer;
timeout=.05;
}
if (timeout&&moveplayer) {
if (!playery>=30) {
playery-=.5;
setani walk,;
}else {
unset moveplayer;
}
timeout=.05;
}


LiquidIce00 08-09-2001 01:33 AM

no ice pick that would only work for the leader

Luigi223 08-09-2001 01:36 AM

so what do i do :confused:

LiquidIce00 08-09-2001 01:47 AM

what i said in the beggining

08-09-2001 09:25 AM

umm try this:

NPC Code:

if(playertouchsme) {
this.stairs = 1;
if(playery = y to stop at) {
this.stairs = 2;
}
}

if(this.stairs = 1) {
playery-= 0.02;
setani walk,;
timeout = 0.05;
}
if(this.stairs = 2) {
playery = playery;
playerx = playerx;
}



that should work if any player touches it.


All times are GMT +2. The time now is 01:21 AM.

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