EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::General Support (https://www.eqemulator.org/forums/forumdisplay.php?f=598)
-   -   Assigning Perl Scripts to in game objects (Entity) (https://www.eqemulator.org/forums/showthread.php?t=42842)

Bytebait 03-06-2020 02:27 AM

Assigning Perl Scripts to in game objects (Entity)
 
I'm trying to figure out how everything works and absorbing as much as I can from EQEmu Server but I'm missing some info.

I want to make a Merchant that sells a Cloth Cap #1001 and can be Hailed with a response.

I can make the merchant in game with #spawn, #npcspawn, #npcedit, #repop


Can I add inventory with a perl script? If so, how do I link that script to the newly added Entity

Bytebait 03-06-2020 01:41 PM

Ok, it looks like the name of the NPC needs to be the same name as the pl file for it to trigger.

joligario 03-06-2020 02:02 PM

Or NPC ID. It's all in the manual.

Uleat 03-06-2020 02:45 PM

I don't know if you can add merchant inventory items through script..would need to dig in and see how that's handled.

At the very least, it's probably not in the scripting apis.

nilbog 03-06-2020 05:20 PM

It looks like you can use quest::MerchantSetItem to add merchant inventory through a perl script. I have never used this but maybe? Replace npcid with the npc's ID, and howmanycaps with the total number you would like the npc to stock.

Code:

sub EVENT_SAY {
        if ($text=~/hail/i)
        {
                quest::say("a response.");
        }
}

sub EVENT_SPAWN {
        #quest::MerchantSetItem(uint32 npc_id, uint32 item_id, [uint32 quantity])
        quest::MerchantSetItem(npcid, 1001, howmanycaps);
}


Bytebait 03-06-2020 05:35 PM

Quote:

Originally Posted by joligario (Post 264579)
Or NPC ID. It's all in the manual.

If there is a manual different than the one I linked I would love to know about it. If it is in the eqemu.gitbook.io site, I haven't been able to find where to setup and manage merchants.

joligario 03-06-2020 07:41 PM

Not sure what specifically you aren't finding on merchants. My comment was to the question title and your response about assigning scripts based on NPC name.

Huppy 03-07-2020 10:51 AM

Quote:

Originally Posted by Bytebait (Post 264576)
I want to make a Merchant

I'm assuming, once you created the npc, you set it's npc class to 41 (to enable merchant) ? You can do that in-game by targetting the npc and typing #npcedit set class 41 (then #repop) or if using an editor, you go into the npc_types table and change it there.

Bytebait 03-08-2020 01:53 AM

Quote:

Originally Posted by Huppy (Post 264584)
I'm assuming, once you created the npc, you set it's npc class to 41 (to enable merchant) ? You can do that in-game by targetting the npc and typing #npcedit set class 41 (then #repop) or if using an editor, you go into the npc_types table and change it there.

I did, I'm able to sell, though haven't figured out how to assign items to sell and it also doesn't store the items sold to it.

Huppy 03-08-2020 04:28 AM

Even though there is various tools for editing the database, (EOC, etc.) I use George's Tools for editing merchants, spawns, etc. Few steps to installing it but works for me.
http://www.georgestools.chrsschb.com/

As far as merchants keeping items sold to them, make sure, in variables table MerchantsKeepItems is set to 1 and in rule_values table World:ClearTempMerchantlist is set to false

Bytebait 03-08-2020 11:52 PM

Quote:

Originally Posted by Huppy (Post 264586)
Even though there is various tools for editing the database, (EOC, etc.) I use George's Tools for editing merchants, spawns, etc. Few steps to installing it but works for me.
http://www.georgestools.chrsschb.com/

As far as merchants keeping items sold to them, make sure, in variables table MerchantsKeepItems is set to 1 and in rule_values table World:ClearTempMerchantlist is set to false

you're awesome, thank you.


All times are GMT -4. The time now is 10:20 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.