PDA

View Full Version : darck ss lua tutorials



Xader
April 7th, 2015, 21:17
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.


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)

7504
download it down.
more will come.