Box thaler chest help! - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Box thaler chest help! (/thread-27604.html) |
Box thaler chest help! - A.M Team - 12-10-2014 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! RE: Box thaler chest help! - Mudbill - 12-10-2014 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? RE: Box thaler chest help! - A.M Team - 12-10-2014 (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. 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. RE: Box thaler chest help! - Mudbill - 12-11-2014 PHP Code: 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. PHP Code: GiveItemFromFile(string& asName, string& asFileName); Here you just enter internal name and entity filename, like potion_health.ent. RE: Box thaler chest help! - A.M Team - 12-11-2014 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. RE: Box thaler chest help! - Mudbill - 12-11-2014 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. |