Custom mapping and Mods > Editor Discussion

Custom vendors

(1/3) > >>

Flemse:
I'm having some trouble creating a custom vendor. I'm trying to create a vendor that only holds one custom item, which should enable a flag on the item I have made. I've already made it as a pickup, and the GUI works as intended, but I can't figure out how to put it in a vendor.

Any help is much appreciated.

rpc190:
Okay I think I know what you're going for, here's how to do it.

Your custom campaign should be a full directory containing the same folder found within C:/..../Hammerwatch/editor. If not, well read this thread on how to make it so: http://hammerwatch.com/forum/index.php?topic=2026.0

So once you have that setup, the Tweak is where most of the script for each shop is. I've attached the script they used to the gamble shop in the desert campaign. You should probably just copy that into your Tweak folder and rename it whatever you want. Now let's at setting up the shop, it should look something like this:


--- Code: ---<tweak>
<params>
<dictionary>
</dictionary>
</params>
<upgrades>
<dictionary id="shopid" cost="99" cat="shopcategory" shared="true"
name="shopname" desc="shopdescription" />
</upgrades>
</tweak>
--- End code ---

Some of these are self explanatory, what's mostly important are dictionary id and cat.

Dictionary ID will be the global event that is fired whenever this is purchased. More on this in a moment.
Cat refers to which vendor to hold the item, which you must reference in your Shop script within the Hammerwatch editor.

For your item to appear you will need to create a GlobalEventTrigger script with Event: set to match your Dictoinary ID. Then attach that to a SpawnObject script that will create your item.

Hopefully this is what you were looking for.



Flemse:
Oh my, you are exactly right(except that I needed to set a global flag, not spawn the object), and I had already done it ... but I did not copy it to my campaign folder, I was editing in the assets folder! What a dumb mistake. It works now, thanks for your help.

Short side question you might be able to answer. I made an entry into the english.xml for name and description of the item:

<string name="flower-uname">Flower</string>
<string name="flower-udesc">A faul smelling flower</string>

But the name just show up in-game as flower-uname and description as flower-udesc. And i remembered to edit the right place this time :) It's not a big issue, I could just change it in the shared.xml file, but if you have any idea what I'm doing wrong here, I'd be nice to fix.

rpc190:
I only once ever tried to use that technique for strings and it didn't work. Maybe copy the whole english.txt to your map folder if you haven't tried that. I've always just named things in their .xml.

Flemse:
I already tried that and it didn't work. Doesn't matter, I'll just change it in the xml. Thanks for your help.

Navigation

[0] Message Index

[#] Next page

Go to full version