Resource icon

[Open Assets] Simple Key System

This content may be freely modified and/or maintained by anyone.

Xelork

What can I type here?
Welcome!

A friend of mine asked me if i could code some sort of key that can open doors on maps, and then, with help of the #scripting at the SRB2 Discord Server, this is now real and also re-usable for everyone!

Very simple to use, you just need to set an activating sector with a tag that will activate a linedef with Call Lua Action, a poly object to work as a door, and a control sector that will rotate the polyobject with a different tag from the sector, and type some things in the lua to make it work. Like this for example:

Code:
local function open1(line, p, sec)
    if keycount == 0
        S_StartSound(p, sfx_kc5d)
    end
    if keycount > 0
        sec.tag = 3
        keycount = $ - 1
        S_StartSound(p, sfx_kc5c)
    elseif keycount == 0
        S_StartSound(p, sfx_kc5d)
    end
end

 addHook("LinedefExecute", open1, "DOOR1")
An example wad is available for reference, and you're free to modify everything!


Major thanks to my friend, TorLes, for the idea and HUD & Key sprites. <3
 

Attachments

  • Simple Key System.zip
    5.1 KB · Views: 469
  • srb20037.gif
    srb20037.gif
    7.8 MB · Views: 805
Last edited:
This thing is cool for mazes
Example:
The level starts in small room like in start of DSZ act 1 from Demo 2 development map. Then you fall into maze itself. The maze is big. Also there's could be multiple ways into one point of maze. Also there's could be some platforming segments, like in MMZ of Demo 2 development map. Later the player find the exist, but the problem is that is to unlock exit it requires key. Later player finds the key and goes to exit,later what opens the room with finish
Someone should make level like this
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top