NPC functions to JS......Please!?

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

NPC functions to JS......Please!?

Post by stranf »

The players on my shard had an interesting request: Use the pet commands to create mercenaries.

Here is how I would implement it, one would be easy, the other would take a bit more work:


1- Treat an NPC as a packhorse. Export a function from C++ to .js that allows the PC to treat the NPC as a packhorse. Give the NPC all the AI functions that the pet has, IE, transfer, stay follow, etc. The only function that probably should NOT be included is RENAME.

2- This would be ideal, but I think it would require a bit more coding. Since NPCs can also be "outfitted" by GMs, allow the owning "PC" to equip via the paperdoll like the GM his hired mercenary. That would be ideal, but may require some more programming. If someone has time to do the C++ coding for this, it would be appreciated.

Thanks for your help, any other tips would be great. Once the functions are exported to .js I think I can code up a mercenary script to allow for the hiring of mercenaries with my limited knowlege of .js.

Thanks!
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Could you not simply set up the mercenaries as "pets" and command them around just like ordinary pets? Just create a script where the mercenary NPC, when the players say "hire" or whatever and drop X gold on them, you set the player as owner of the mercenary NPC.
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Xuri, that would be great but how do I set up an NPC as a pet?




How would you go about allowing a PC the GM ability of adding/removing armor from said mercenary, while still preventing him from doing it to other players?
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

I wrote a quick script where a GM can set up an NPC as a "pet" and give ownership to a PC. It works like a charm, but interestingly enough if you tell the NPC to guard it dosen't say "guarded" like a pet does, but the script works perfectly.


The only thing now is that I don't have access to the pack, and the PC also can not equip the NPC like a GM can. I don't know how to script those functions.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Hm. You'll probably have to script custom commands like .equip and .disarm then, and check for ownership before allowing, as well as checking if anything's already occupying the layer they're trying to equip something to.
-= Ho Eyo He Hum =-
Post Reply