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.


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

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