Author Topic: Help with buttons please?  (Read 5882 times)

MisterPeacher

  • Posts: 2
    • View Profile
Help with buttons please?
« on: September 03, 2013, 08:00:55 PM »
So I wanted to have a special kind of door in my custom game, but I didn't want it to be the generic bronze/silver/gold key and the appropriate door.

I wanted to have it so that when the player pushed a button on the wall, a gate disappeared and allowed the way through. I have a small screenshot of how I have this laid out.

Is this possible to do?


Heretic

  • Moderator
  • Posts: 305
  • Castle Runner
    • View Profile
Re: Help with buttons please?
« Reply #1 on: September 03, 2013, 08:28:49 PM »
Very possible! And easy so I'm glad I can help :P Thanks for the screenshot!

1. Make a "objectEventTrigger" script.
 - Set event to "hit"
 - Set Object: (0+0) to the button (by clicking on it, escape when done)
2. Make a Hide Object script.
 - Set State to Hide
 - Object set to the gate (by clicking on it, escape when done)
3. Join the two scripts by clicking on the "objecteventtrigger" and CTRL+ALT+CLICK the Hide Object script.

This should successfully make it to where the button gets hit and hides the gate.


Since there is also collision on the gate, we will need to remove the collision as well.

4. Make a TogglePhysics script.
 - State: Disable
 - Doodad: The gate.
5. Link the ObjectEvenTtrigger to the Toggle Physics script by selecting the trigger and ctrl+alt+click the Toggle Physics script.

MisterPeacher

  • Posts: 2
    • View Profile
Re: Help with buttons please?
« Reply #2 on: September 03, 2013, 08:43:36 PM »
Thanks for telling me how to do this. :)

Unfortunately it doesn't seem to be working for me. I have done everything that you have explained but it seems as though it's acting like the button is just decoration, because nothing happens when I go to trigger it in the game. :(

KptnKook

  • Posts: 45
  • Immersive or DIE!!!!!
    • View Profile
Re: Help with buttons please?
« Reply #3 on: September 03, 2013, 09:29:48 PM »
i had similiar problems. the buttons have no collision. in order for the system to recognize any hit, the object needs a collision.

to kind of work around it, you could take an little areatrigger, which is directly in front of the button, and activates on entering of a player/enemy etc..

or for generally having a hitable object, you could make a new little (maybe invisible) square object, with a collision copied from another object like a wall. this new hitable_object you can now put in front of your button.

and easy way would also be to just add a collision to your button.xml. you can copy and edit accordignly the coordinates from any other object, with a collision (wall for example).
« Last Edit: September 03, 2013, 09:33:51 PM by KptnKook »

Kavex

  • Posts: 62
  • Modder/Support
    • View Profile
Re: Help with buttons please?
« Reply #4 on: September 03, 2013, 10:19:02 PM »
This is the way I've been doing it

XML Download: http://d-h.st/d5l