Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Changing the levels of an NPC (https://forums.graalonline.com/forums/showthread.php?t=66869)

Bl0nkt 06-24-2006 01:27 AM

Changing the levels of an NPC
 
I need to change the level of a moving NPC. It's on a GMAP, and I'm currently just increasing its x to move it. It works, but sometimes it will stop when changing levels. It's currently clientside.

Any help? I'm thinking it's possible, since I've seen GK's ships before.

ApothiX 06-24-2006 07:36 AM

Well, GK's ships are using x and y modifiers (obviously) But there is a 'warpto' command you can use for DB NPCs (I believe putnpc's are also DB NPCs)

calani 06-24-2006 05:42 PM

GK's ships use a DB, not a levelnpc.
and putnpcs are -not- db's. they are local levelnpcs (and thus can be removed with /clearnpcs).

if you drop a gralat in a level, you can find the script listed in rc ftp (i think its scripts/, but i don't remember) as a localnpc with the npcid and x and y in its filename

Skyld 06-24-2006 06:09 PM

Quote:

Originally Posted by calani
GK's ships use a DB, not a levelnpc.
and putnpcs are -not- db's. they are local levelnpcs (and thus can be removed with /clearnpcs).

Yes, they are. They are treated the same as 'regular' Database NPCs by the server (not tied to or in any way attached to one level, ability to warp about, be accessed using findNPC() by their this.name, etc).
Quote:

Originally Posted by calani
if you drop a gralat in a level, you can find the script listed in rc ftp (i think its scripts/, but i don't remember) as a localnpc with the npcid and x and y in its filename

It's npcs/, and it is stored there along with the other Database NPCs.

calani 06-24-2006 06:12 PM

*blinks*
now this I'm going to have to play with.

JustBreathe 06-24-2006 07:03 PM

Only serverside NPCs can warp.

canwarp2(); [ or canwarp() ]

serverside this.x ++; should warp it. ( if on GMap )

You can also set it's level manually.

Bl0nkt 06-24-2006 08:32 PM

I need it to move swiftly though. And it's very jagged while on the serverside. I'd use move() but that doesn't update x/y of an NPC. I might just have to manually set the level of it and use normal, non-gmap levels. How do I set the level of an NPC?

Yen 06-24-2006 10:50 PM

I was once told (by Stefan, I think?) that canwarp2() makes the NPC warp when it touches a link.

ApothiX 06-25-2006 03:25 AM

Quote:

Originally Posted by JustBreathe
You can also set it's level manually.

You can't set it's level manually. You have to use the warpto command to warp it.

Quote:

Originally Posted by Bl0nkt
I need it to move swiftly though. And it's very jagged while on the serverside. I'd use move() but that doesn't update x/y of an NPC. I might just have to manually set the level of it and use normal, non-gmap levels. How do I set the level of an NPC?

I told you in the first post in this thread. I suggest you read it.

Quote:

Originally Posted by Yen
I was once told (by Stefan, I think?) that canwarp2() makes the NPC warp when it touches a link.

Indeed, that's what it's for.

Bl0nkt 06-25-2006 03:39 AM

I understand there's a warpto command, but what's the syntax? Is it the same as warpto x y level?

warpto(x, y, level.name); ?

ApothiX 06-25-2006 04:37 AM

Quote:

Originally Posted by Bl0nkt
I understand there's a warpto command, but what's the syntax? Is it the same as warpto x y level?

warpto(x, y, level.name); ?

Check commands.rtf, or newfeatures. I am on Linux right now and without the editor, I do not have a commands.rtf to check for you.

Edit: Nevermind, found it within 5 minutes on the wiki. You really should try searching for yourself, though.

Quote:

warpto(str, float, float)
Incase you still don't know, warpto(level, x, y)

Bl0nkt 06-25-2006 04:59 AM

Quote:

Originally Posted by ApothiX
Check commands.rtf, or newfeatures. I am on Linux right now and without the editor, I do not have a commands.rtf to check for you.

Edit: Nevermind, found it within 5 minutes on the wiki. You really should try searching for yourself, though.


Incase you still don't know, warpto(level, x, y)

I'm capable of common sense. And that's DB NPCs only?

VulcanP2P 06-25-2006 07:24 AM

Quote:

Originally Posted by Bl0nkt
I'm capable of common sense. And that's DB NPCs only?

No.

Python523 06-25-2006 11:11 AM

If you're using a gmap, why are you worrying about level warping? To an NPC, a gmap is just one huge level. Just change it's x/y positions.

Admins 06-25-2006 11:57 AM

warpto(level, x, y), same format as player.setlevel2

About npcs on a gmap:
1. There are local npcs, which are added with the level editor, directly in the .nw or .graal file. They can move freely on the whole gmap. It is recommended to do that on serverside though. Use move() for smooth movement.
2. The other npcs are called 'database npcs' - the npcs you see in the RC npcs list, the putnpc2s, and the items (gralats) although those are not often used anymore. They can freely move everywhere, and 'warpto' other levels. You can remove them with /clearnpcs levelname (only the npcs listed in the RC npcs list are protected), and watch their files in the "npcs/" folder.

contiga 06-25-2006 12:25 PM

Is there a line in serveroptions or so to protect a few classes that were put with 'putnpc2'? Like protectedclasses=gralats,...,... so that they don't get removed when saying '/clearnpcs'?

Bl0nkt 06-25-2006 07:33 PM

I've tried move() on the serverside on this gmap. It would move, but not through levels. The second it hit a level link it froze.

I've been thinking about getting rid of the gmap and making them individual levels. The gmap is good for some things, but for this project more of a disturbance if anything. I can't really say what this project is.

Python523 06-25-2006 08:50 PM

Quote:

Originally Posted by Bl0nkt
I've tried move() on the serverside on this gmap. It would move, but not through levels. The second it hit a level link it froze.

I've been thinking about getting rid of the gmap and making them individual levels. The gmap is good for some things, but for this project more of a disturbance if anything. I can't really say what this project is.

Then your gmap is faulty.

Bl0nkt 06-26-2006 01:48 AM

Quote:

Originally Posted by Python523
Then your gmap is faulty.

Keep in mind the "project" is not another server. The GMAP is also not very supportive when using setfocus() rapidly.

zokemon 06-26-2006 03:36 AM

Quote:

Originally Posted by contiga
Is there a line in serveroptions or so to protect a few classes that were put with 'putnpc2'? Like protectedclasses=gralats,...,... so that they don't get removed when saying '/clearnpcs'?

I don't think so. Just don't let anyone do /clearnpcs and make your own script for clearing putnpc'ed npcs :)

calani 06-26-2006 04:50 AM

Quote:

Originally Posted by bl0nkt
... The GMAP is also not very supportive when using setfocus() rapidly.

I've noticed this as well, and have been fighting with it for quite some time.
Have you been able to get it to work, or able to give any pointers on it?

Bl0nkt 06-26-2006 05:09 AM

Quote:

Originally Posted by calani
I've noticed this as well, and have been fighting with it for quite some time.
Have you been able to get it to work, or able to give any pointers on it?

Not much you can do when you're using an 0.05 timeout to update it. It's still very jerky.

ApothiX 06-26-2006 09:59 AM

Quote:

Originally Posted by Bl0nkt
I've tried move() on the serverside on this gmap. It would move, but not through levels. The second it hit a level link it froze.

I've been thinking about getting rid of the gmap and making them individual levels. The gmap is good for some things, but for this project more of a disturbance if anything. I can't really say what this project is.

I'll say this one more time, and it will be the last. warpto is the command you are looking for.

NPCs put with putnpc2 are consider DB NPCs, and they work with warpto.

Bl0nkt 06-26-2006 07:50 PM

Quote:

Originally Posted by ApothiX
I'll say this one more time, and it will be the last. warpto is the command you are looking for.

NPCs put with putnpc2 are consider DB NPCs, and they work with warpto.

I understand that. I'm not trying to tackle that issue anymore.


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

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