Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Box thaler chest help!
A.M Team Offline
Banned

Posts: 811
Threads: 63
Joined: Sep 2014
#1
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! Smile
(This post was last modified: 12-10-2014, 09:09 PM by A.M Team.)
12-10-2014, 09:09 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
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
Find
A.M Team Offline
Banned

Posts: 811
Threads: 63
Joined: Sep 2014
#3
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. Blush
12-10-2014, 10:04 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Box thaler chest help!

PHP Code: (Select All)
GiveItem(stringasNamestringasTypestringasSubTypeNamestringasImageNamefloat 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: (Select All)
GiveItemFromFile(stringasNamestringasFileName); 

Here you just enter internal name and entity filename, like potion_health.ent.

12-11-2014, 12:29 AM
Find
A.M Team Offline
Banned

Posts: 811
Threads: 63
Joined: Sep 2014
#5
RE: Box thaler chest help!

Can you explain how to do THIS part Undecided

(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
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
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
Find




Users browsing this thread: 1 Guest(s)