A.M Team
Banned
Posts: 811
Threads: 63
Joined: Sep 2014
|
Box thaler chest help!
Hi! I'm wondering how you can make an ordinary wooden box turn into a thaler chest. It will work by:
- Purchasing the box
- Picking it up (like an item)
- Sanity/health potions would appear inside your inventory (instead of the box)
I would like to know if this is possible and if so, how would you go around to solving it.
Thanks and all the best!
(This post was last modified: 12-10-2014, 09:09 PM by A.M Team.)
|
|
12-10-2014, 09:09 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Box thaler chest help!
I'm sure you can figure out how to pay to pick it up. Well, use one entity you can't pick up, then check for the amount of money you need before switching the entity out for one that can be picked up.
After you pick it up, use an EntityCallbackFunc with PickUp type to trigger the event, then remove the item of the box through script, then add the items you want to give, as in GiveItem with the sanity and health potions.
Simple enough?
|
|
12-10-2014, 09:27 PM |
|
A.M Team
Banned
Posts: 811
Threads: 63
Joined: Sep 2014
|
RE: Box thaler chest help!
(12-10-2014, 09:27 PM)Mudbill Wrote: I'm sure you can figure out how to pay to pick it up. Well, use one entity you can't pick up, then check for the amount of money you need before switching the entity out for one that can be picked up.
After you pick it up, use an EntityCallbackFunc with PickUp type to trigger the event, then remove the item of the box through script, then add the items you want to give, as in GiveItem with the sanity and health potions.
Simple enough?
Thanks, but can I ask how you would add the sanity and health potions through the GiveItem script.
I don't know how to script the function you see.
|
|
12-10-2014, 10:04 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Box thaler chest help!
GiveItem(string& asName, string& asType, string& asSubTypeName, string& asImageName, float afAmount);
This will add an item. Parameters are: Internal name, Entity type, Lang Entry, Icon filename, amount.
You can also use the GiveItemFromFile. It seems to be a lot easier, but it's tagged as a debug function although I do not know why.
GiveItemFromFile(string& asName, string& asFileName);
Here you just enter internal name and entity filename, like potion_health.ent.
|
|
12-11-2014, 12:29 AM |
|
A.M Team
Banned
Posts: 811
Threads: 63
Joined: Sep 2014
|
RE: Box thaler chest help!
Can you explain how to do THIS part
(12-10-2014, 09:27 PM)Mudbill Wrote: Well, use one entity you can't pick up, then check for the amount of money you need before switching the entity out for one that can be picked up.
|
|
12-11-2014, 07:26 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Box thaler chest help!
How do you purchase the box? Do you interact with it?
The way I see it is that there's a normal box with an interaction callback on it. You click it, and it will say "You ain't got no money" if you don't have enough thalers.
If you DO have enough, it will switch out the entity. I'm unsure if you can check for a certain amount of items, but you can certainly add a variable for when you pick up some thalers. Say, you pick up 30 thalers, you run AddGlobalVarInt("Thalers", 30);
Now, when you interact with the box, it will GetGlobalVarInt("Thalers") and if it => (equals or greater than) the amount you require to buy it, run the script that switches it out. To do that, simply run SetEntityActive to disable the normal box and enable the Item version. This would also be a good time to play a coin-like sound, to indicate the purchase.
The Item version will be its own entity, set to Item > Puzzle type in the model editor. You'll need to add an icon to it (I think), but since the box is removed as you pick it up, you might as well just use the _temp_hand.tga or whatever it was called.
(This post was last modified: 12-11-2014, 09:37 PM by Mudbill.)
|
|
12-11-2014, 09:35 PM |
|
|