Resource icon

[Open Assets] Simple Key System

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
  • srb20037.gif
    srb20037.gif
    7.8 MB · Views: 733
Author
Xelork
Views
2,786
First release
Last update

Share this resource

Back
Top