Pedestals/Keys and Events.

#1
I am making this post because someone had a request how to handle multiple keys/pedestals and getting them to work with events. ‎  You can use the below information in any similar scenario, so I figured I would post it here in case anyone else had a similar question.

=========================
Scenario: ‎  I want to create a lock in my game that requires you fill 2 pedestals with a key that will be used one time to unlock the the box (similar to Orladin's keys or Corridor keys in KF2 US).

OK this situation really isnt that difficult, but there are some concepts in SOM that you must realize first before proceeding. SOM has some features I like to call bugs, that can make this a bit tricky, so lets note them first shall we?

#1 - Make sure your keys are not consumable! ‎  SOM has really poor range and angle refinements when it comes to using a key at a specific door or chest or pedestal. ‎  Because SOM doesnt have a developed AI, it doesnt know whether or not you meant to waste a key if youre not facing the pedestal just right, so using the key would mean waving bye bye to it forever if you werent standing right where you need to be for it to activate the lock. ‎  So for all purposes, one use keys should always be NON-consumable.

#2 - SOM doesnt consume a key when you place it in a pedestal, so you will always have to create an event that consumes this key when placed in the pedestal else you will have unlimited keys in no time. ‎  This is important to note and needs to be dealt with to keep your game from having this flaw!

Ok with those two key points stated, we can proceed with creating the proper events.

First we will need three counters, lets call them pedestal 1, pedestal 2, and magic box. ‎  One for each pedestal that is modified when the key is placed, and one for the box that we will have appear when the two keys are in their slots.

For the first pedestal counter (the one we named pedestal 1): we will have it toggle the counter when the key is placed. ‎  Also make sure the key can't be removed from the pedestal (these are both settings on the pedestal object itself).

Now attach an event to the pedestal object. ‎  This event should be 'always on' with a starting trigger of [counter value = 1, of the pedestal 1 counter]
-For the first leaf of the event, add a sequence 'change player parameter'. ‎  Edit this sequence so that it 'changes number of item, pedestal key, decrease by 1'.
-Also add a 'alter counter value' sequence to this leaf, and set it to alter a the third counter you made 'magic box' by increasing it by one.
-Lastly add a sequence for 'control active leaf' and set it to 'move this event forward one leaf'. ‎  This just makes sure that nothing screwy will happen by reapplying this event more than once.

Now thats finished, we can do the same thing to the second pedestal, except that it will toggle the pedestal 2 counter.

Once both of the pedestals have their keys in place, the player will no longer have those two keys in their inventory, and you have also adjusted a counter (magic box) to a value of 2. ‎  Since it will only become 2 once it is increased 1 time by each pedestal key, you can have an always on event triggered by the counter value = 2 of magic box to 'display object' on for the hidden box you want to appear.

- Todd DuFore (DMPDesign)
Site Founder
Reply

#2
This sort of thing should be on the website in some form I'd think.

Instead of pages, maybe there could be a hidden category for posts called "mini-howtos" or something that is listed/highlighted on a page like /mini/howtos/.

Not that it isn't worth discussing in the forums, but useful info just gets buried in forums / not rated high in search indexes.
Reply

#3
Perhaps if you have an easy way to copy global events into all of your maps, you can have a single global event (on all maps) that fires whenever a type of consumable key is used, then checks to make sure there are the right number of keys in/out of play and puts the key back if not. This might not work depending on when the always on key used event would fire (before or after the pedestal sets its counter) ...I'm thinking it would fire afterward however based on my assumptions about how events are processed, which is the way you'd want it.

Also this method would have the advantage of always insuring an extra key is never gained or any key is ever disappeared from the game, which could theoretically happen for any number of reasons.
Reply

#4
I think it would be good to make a simple, minimalist project demo for each little scenario like this pedestal setup, and then sticky a single post with links to all the little demo projects.

The text/pictorial tutorial section here is great, but there's no substitute for a 'hands-on' actual project.
Reply





Users browsing this thread:
3 Guest(s)