Results 1 to 1 of 1

Thread: darck ss lua tutorials

  1. #1
    Join Date
    February 14th, 2015
    Posts
    104
    Level
    18

    Post darck ss lua tutorials

    Lua is a simplified programming language that was introduced to SRB2 in version 2.1. This is a guide for beginner Lua users.
    Keep in mind that I'm also fairly new to Lua, so if you find an error in my coding, please point it out.

    COLOR:

    1-change the color of something (LJSonic)
    first we need green sprites of that thing if it isnt a player lets try robohood because he's or change the palette of the sprites to become green: past this code in a lua and it will make robohood red.
    Code:
    Code:
    local robohood = CV_RegisterVar({"robohood", SKINCOLOR_RED, CV_NETVAR, {MIN = 1, MAX = MAXSKINCOLORS - 1}, do robohoodChanged = true end}) 
    local robohoodColorChanged = true
     
    addHook("MobjSpawn", function(mo)
            mo.color = robohood.value
    end, MT_ROBOHOOD)//after the end we put the MT_THING to aply the hook at it
     
    addHook("ThinkFrame", do
            if robohoodChanged
                    for mo in thinkers.iterate("mobj")
                            if mo.type == MT_ROBOHOOD mo.color = robohood.value end
                    end
     
                    robohoodChanged = false
            end
    end)
    srb20002.png
    download it down.
    more will come.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •