Jump to content
Ane

How to: the game logic objects

Recommended Posts

Dear Ylanders,

We created a dungeon full of obstacles from scratch by setting up several game logic objects within the scenario editor. Check it out!

 

 

if you want to know how it came into being step by step and learn a trick or two, sit back and enjoy this no-so-long explanation :P

Game logic.png

 Torches_s.png

We want the torches to automatically light up as someone runs through the corridor. 

  • We place the trigger zone
  • We place the torch
  • In the trigger zone settings we set up the actions to run when entering it: 
    • We select “perform action with an entity” 
    • We choose the torch we want to be lit                                          
    • The action to run is “Light

Screenshot_2_s.png

If we want to light up multiple torches as we walk:

  • We select both the torch and the trigger zone
  • We duplicate them (both the items and the settings will be copied). We can do this either by pressing CTRL-D or via the context menu (right mouse button).
  • We place them wherever we want

 

Trapped_chest_s.png

We want the dart shooters to be triggered when someone steps on the stepstone placed in front of the chest. 

  • We place the chest
  • We place the stepstone in front of it
  • We place the dart shooters in a way that whoever is standing on the stepstone gets shot
  • We put the trigger zone in the stepstone (and adjust it to its size)
  • In the trigger zone settings we set up the actions to run when entering it:
    • We select “perform action with an entity
    • We choose the dart shooter we want to be triggered
    • The action to run is “Fire

Screenshot_1_s.png

If we want to trigger more than one dart shooter:

  • In the same trigger zone, we add a new action 
  • The settings would be the same, only now we would select the other dart shooter(s)


Darts_s.png

We want the dart shooters in the walls to be triggered gradually and to shoot non-stop as someone runs through the corridor. 

  • We place the trigger zone
  • We place the time trigger (which is an object that is used to perform some action - once, several times or continuously - as long as it's active)
  • We place the dart shooter in the wall
  • In the time trigger settings we set up when we want the dart shooter to start shooting, for how long and how often:
    • If we want it to start shooting as someone enters the trigger zone, the initial delay would be 0
    • If we want it to shoot non-stop, we set the repeat count to -1. You can specify how many times something should be done, 0 means never and -1 means indefinitely.
    • To set up how often we want the dart to shoot, we set the duration we want in the “time between repeats
    • We add the action: perform action with an entity
    • We choose the dart shooter we want to be triggered
    • The action to run is “Fire

Screenshot_3_s.png

If we want multiple shooters to be triggered as we walk:

  • We select both the dart shooter and the time trigger
  • We duplicate them (both the items and the settings will be copied)
  • We place them wherever we want

 

This way they would be all triggered at the same time. If we want them to be triggered gradually:

  • In the time trigger settings, we change the initial delay duration (adding extra 0,5 seconds to each shooter, for example). This way some triggers will - after they have been enabled - wait longer than others before they start executing their actions.

 

By default the time triggers are enabled, and this way they would be triggered as soon as the level is loaded. But we want the shooters to start shooting only once someone is close enough to the corridor.

  • In the time trigger settings, we disable them one by one by clicking on the tick next to their names (changing their names to know which one is which might be a good idea, because we will need to be able to tell them apart in the list later on)

Screenshot_4_s.png

  • In the trigger zone settings, we set the event “enable game logic” when entering it 
  • We choose which one to enable (this is where having different names comes in handy)
  • Click on enable
  • Add as many events as objects you want to enable

 

Platforms_s.png

We want the platforms to go up whenever someone steps on the correct panels, but in order to make it more difficult, we also want to reset all the platforms if they step on an incorrect panel.

For the “correct” panels (the ones that would make the platforms go up):

  • We place the platforms in the walls up
  • We place a stone panel
  • We put the trigger zone in the panel (and adjust it to its size)
  • We store the rotation of one of the platforms by right clicking on it (this is the rotation we want the platform to have whenever someone steps on the correct panel)
  • In the trigger zone settings we set up the actions to run when entering it:
    • We select “rotate entity instantly
    • We choose the platform we want to be rotated
    • We paste the previously stored rotation 

Screenshot_5_s.png

  • We duplicate the panel (as many times as we want to have “correct” panels)
  • In each new panel we need to choose the platform it will affect to (without changing the rotation values). We can use the one we got from the first platform because we want the other platforms to be rotated exactly the same way.

 

For the “incorrect” panels: 

  • We put the platforms down (this is how they will be rotated when the game starts and whenever they get reset by a player stepping on the incorrect panel)
  • We store the rotation of one of the platforms
  • We duplicate one of the panels
  • We paste the stored rotation
  • We add a new action: rotate entity instantly 
  • We repeat this with the other platforms
  • We duplicate the panels as many times as we want to have “incorrect” panels

 

We want the last platform to go up when someone shoots the stepstone.

  • We place the stepstone in the wall 
  • We put the trigger zone in the stepstone (and adjust it to its size)
  • We store the rotation of the platform
  • In the trigger zone settings we set up what triggers it:
    • We select “any projectile
    • We set up the actions to run when entering it: rotate entity instantly
    • We choose the platform we want to be rotated
    • We paste the stored rotation 
  • We put the platform down

Screenshot_6_s.png


Puzzle_s.png

We want the chest to unlock only when the correct answer is provided. 

  • We place the chest
  • We lock the chest with a blank key (in the character mode)
  • We place an event listener
  • In the event listener settings we set what happens when someone tries to open the locked chest:
    • We choose the chest (meaning "listen/wait for something to happen to this chest")
    • Activate on: blocked (meaning "someone did something with the specified item (the chest) but the action wasn't successful (the player tried to open it, but they couldn't because it was locked))
    • We set the action: ask player
    • We choose the questioner: the chest (this is who/what is asking the question. This shows in the question itself but also affects where will the bubble text be shown in the scene)
    • We write the question
    • In possible answers we choose the action to happen when a specific answer is provided: show message

 

Screenshot_8_s.png Screenshot_9_s.png

 

If the answer is incorrect:

  • We chose the speaker: the chest
  • We write the answer that is shown

 

If the answer is correct:

  • We add the event: perform action with an entity
  • We choose the object: the chest
  • We set the action: unlock
  • We set the responder to “trigger object

 

Screenshot_10_s.png

Prize_s.png

We want a message to be shown when someone picks up the prize. 

  • We place the prize
  • We put the trigger zone in the prize (and adjust it to its size)
  • In the trigger zone settings we set up the actions to run when leaving it:
    • Is triggered by: specific entity
    • We choose the object: the prize
    • We set the action: show message
    • We choose who “says” it: the pillar the prize is standing on, for example
    • We write the message

 

Screenshot_12_s.png

In other words - if the specific entity we selected leaves the trigger zone (for example whenever someone picks it up), a message will be shown. The alternative way of doing this would be to create an event listener that would "listen" for a player taking this specific object.

 

Multiplayer_s.png

We want the door to unlock when someone stands on the panel, and to lock when someone leaves the panel. 

  • We place the door
  • We lock the door with a blank key (in the character mode)
  • We place the panel
  • We put the trigger zone in the panel (and adjust it to its size)
  • In the trigger zone settings we set up the actions to run when entering it:
    • We select “perform action with an entity” 
    • We choose the door
    • The action to run is “Unlock

Screenshot_13_s.png

  • In the trigger zone settings we set up the actions to run when leaving it:
    • We select “perform action with an entity” 
    • We choose the door
    • The action to run is “Lock

 

Tips.png

  • Some objects are, after you select them from the list, ready to be placed in a way that they are facing you (especially objects like paintings, dart shooters etc.), therefore it makes things easier to be facing the spot where you will be facing them as you select them from the list. This can save you some unnecessary rotating.
  • Whenever you select a game logic object that affects some other objects in some way (like a trigger zone that upon entering does something with a stone block) you can see lines linking those - that way you can quickly tell if things are set up properly.

Screenshot_14_s.png

  • Although the events are run only when you play (test) the game, in the editor the console is your friend. If you want to see if you've set up a trigger zone correctly, switch to the character mode and see what (if anything) the console tells you after you enter it.

Screenshot_15.png

  • Clicking the right mouse button displays the context menu - one of the things you can do via this menu is to store the position or rotation (both are stored separately in the clipboard) of the selected object, so that you can later copy those to other item - either by the context menu or by pasting them in the appropriate fields in the game logic object panel. Not only you can quickly copy the position/rotation this way - this is also very useful whenever you want to adjust the location/rotation of an object at some point (usually when someone toggles something/enters a trigger zone). Instead of "guessing" how the object should then be rotated/where it should be placed, you can position/rotate it yourself, copy the values and then return it to its original state.

 

Screenshot_16.png

  • You can rename any game logic object by clicking its name in the panel. This comes in handy if you have a lot of those in your level.
  • Game logic objects perform actions only when they are active. You can enable/disable them with the help of other game logic objects (trigger zones), after some time (time triggers), when something specific happens in the game (event listeners) - this way some very cool things can be achieved.

 

Let me know if there's something unclear or if you have any doubts!

Ane

  • Upvote 4

Share this post


Link to post
Share on other sites

Could you please share the world? :) I would like to see it and experiment with functions by changing some numbers and stuffs. :D  PS: Really helpful post and video! Thank you! :)

  • Upvote 1

Share this post


Link to post
Share on other sites

Hi Michal,

we definitely want to make this yland a standard part of the game exactly because of what you mentioned - so that players can experiment with it. Unfortunately, we won't be able to include it in the upcoming update (0.13) which is pretty much ready to be released. It is very likely, though, that it will be present in 0.14.

  • Upvote 1

Share this post


Link to post
Share on other sites

We mentioned possibly making the Ylander Jones scenario available for everyone to play in the 0.14 update. Sadly it wasn't possible to have it ready by today, but we'll be releasing a patch that will include this scenario in the following days :) 

Share this post


Link to post
Share on other sites

I got question. how you make items in stack. like when I palce bullet it adds 1 but how you make them like (20) - (100) from 1 item placed.

Share this post


Link to post
Share on other sites
19 minutes ago, Lauris Ostapko said:

I got question. how you make items in stack. like when I palce bullet it adds 1 but how you make them like (20) - (100) from 1 item placed.

Double click on item > window pops up > stack > input number

Share this post


Link to post
Share on other sites
2 hours ago, Chris Young Noize G. said:

Double click on item > window pops up > stack > input number

o darn, thanks bro

Share this post


Link to post
Share on other sites

Not to bump an old thread, but my point is actually that the game could use another more updated tutorial on events/triggers (and your video in the original post is missing, so I wasn't able to learn from that.)

I had a bunch of questions (actually posted it first over on the Steam forum, might as well just link that). It'd be good if you gave us more guides/tutorials/help on how to create stuff like this, because that results in creating content for other players to enjoy and populating the Ylands.

I'd also love to be able to see/manipulate game logic objects from an Explore map that's already been played. I like to actually go in-game to fully test my stuff, and the Editor's 'character mode' doesn't actually show stuff like spawning entities, etc. But I'm pretty much penalized for starting up the map in Explore mode, as it prevents me from accessing game logic objects in the Editor anymore after that.

I've got a wonderful map I'd been building on (and unfortunately had loaded into Explore with it), and wanted to make a graveyard and move the Spawn Point object into that... and yet I can't see it to move it.

Edited by Aerofluff
  • Like 1

Share this post


Link to post
Share on other sites

A request: Can we get some extra game logic functions:

The ability to select groups of blocks instead of separate entities, or having to label a group of blocks. I'd like to be able to move groups of blocks in one go.

The ability to move and rotate things (including groups), but not direct. So to make them move fluently from their current position, either to a location or a certain amount of blocks/degrees. Movement speed should ideally be adjustable, and also have options to be linear or have an acceleration and deceleration.

Adrie

  • Upvote 1

Share this post


Link to post
Share on other sites

At any stage will the logic system be available to use in the editor mode to add them to an already existing explorer map?

Thanks 

  • Upvote 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×