GameSalad

How would I do this?

I have a chest object and I want to make it so the player can open it and inside is an item that can be equipped. How would I go about making this work? Thanks.

Comments

  • KevinCrossKevinCross London, UKPosts: 1,889Member
    edited July 2016

    Have a chest actor that has a boolean attribute called opened and leave it as false.

    When the actor interacts with the chest, collides with it, or clicks on it (however you choose) change the attribute to true and spawn some treasure. Something along the lines of:

    Chest Actor:
    Rule: If collides with player and self.opened is false
    Change Attribute: self.opened = true
    Spawn Actor (Insert treasure/item actor here)

    With this boolean attribute you can have the image of the chest change i.e. if self.opened is false then show the closed image, and if self.opened is true show the opened image. If you want to animate the chest opening then add the animate behaviour in the rule above before the treasure is spawned.

    You will need to decide whether or not you want to spawn random treasure at each chest or set what each chest spawns (no randomness).

    Treasure could be drawn randomly from a table.

  • IceboxIcebox Posts: 1,467Member, PRO

    This depends on the way your planning to equip the item , is the item a seperate actor that you want to stick to the player the whole time? or do you have an animation/image after the item is equipped.

  • PixelateddaddyPixelateddaddy Posts: 20Member

    Thank you very much and the contents of the chest would be a weapon that can be switched out with the current weapon

Sign In or Register to comment.