Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Server (https://forums.graalonline.com/forums/forumdisplay.php?f=14)
-   -   canwarp2 (https://forums.graalonline.com/forums/showthread.php?t=38700)

R0b1n-NPC 09-29-2002 04:32 AM

canwarp2
 
ok here is my script:

NPC Code:

// NPC Made by R0bin
if (created) {
showcharacter;
setstring this.bird,2;
setcharani nickpet_walk#s(this.bird),;
this.speed = 0.2;
canwarp2;
move();
}
function move() {
this.dircounter++;
if (this.dircounter>100) {
this.dircounter=0;
this.rando1=int(random(0,2));
dir = (dir+1+this.rando1*2)%4;
}
x=x+vecx(dir)*this.speed;
y=y+vecy(dir)*this.speed;
sleep 0.1;
move();
}



and here is my problem:

When the bird gets to the edge of the level, it just stays there and does nothing. why?

(yes the map is set properly)

Graal2001_Developer1 09-29-2002 04:36 AM

are you sure recursive functions work in the next level?
I think the loop stops here so it doesn't move any further but I'm not sure...

R0b1n-NPC 09-29-2002 04:44 AM

I tried it with a timeout also.
But to no avail.

R0b1n-NPC 09-29-2002 10:33 PM

Riot suggested that, but it didnt warp around for me. rudora npc server just blows.

CheeToS2 09-29-2002 11:31 PM

Did you bother going into the level it was headed towards? :P

Theres a canwarp2 bug where.. when the npc goes to a different level, the people who were in the level it moved from still see it at the edge of the level until they go to the new level it went to.

R0b1n-NPC 09-30-2002 03:20 AM

yes i did, and i was monitoring it on the npc server as well and it stayed in the same level for about 30 mins without the x or y changing. :-P

emortylone 10-02-2002 11:11 PM

If I'm not mistaken, Canwarp2 is for moving inside levels that aren't on the map. Canwarp though is for regular outside levels?? I haven't used it in a while, but I believe I'm correct in this assumption? You can always have it warp once it gets to another level. I'm sure it is, but just for the obvios, it's a Database NPC correct?
---Shifter

R0b1n-NPC 10-03-2002 04:40 AM

Correct.

I assume because of rudora's wierd level nameing (rudora_5,2.graal etc.)

So i had to make my own function x.x

Com013 10-03-2002 10:52 AM

Quote:

canwarp is for npcs which already know the way
and want to be warped exactly like a player
(good when you use the waytracker item for
recording a way for police npcs or so);
Quote:

canwarp2 is for overworld npcs which move
randomly, so this is using the normal links
and check for onwall on the destination level,
it also doesn't let the npc go into small
links (houses)
And I really wouldn't do it recursive, and you should use move to make things look less laggy.


All times are GMT +2. The time now is 03:00 PM.

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