MacroPoli13
Member
So, Boss Plus (The addon. don't know how to add links into text) has a set of code in its Lua that gives the player 10 rings every so often in the final boss, both lines looking like this:
local function bossplus_givesrings()
for player in players.iterate
if player.powers[pw_super] <= 0 and player.playerstate == PST_LIVE and player.lives > 0 and player.spectator == false then
P_GivePlayerRings(player,10)
S_StartSound(nil,sfx_s3k33,player)
end
end
end
if mobj.health > 0 then
if mobj.getringovertime == nil then
mobj.getringovertime = 0
end
mobj.getringovertime = $1+1
if mobj.getringovertime >= TICRATE*10 then
bossplus_givesrings()
mobj.getringovertime = 0
end
end
end
As someone with minimal Lua knowledge, could someone explain (or alter the code themselves) so that it would work at all times, not just during the final boss? I want to use it for some things.
local function bossplus_givesrings()
for player in players.iterate
if player.powers[pw_super] <= 0 and player.playerstate == PST_LIVE and player.lives > 0 and player.spectator == false then
P_GivePlayerRings(player,10)
S_StartSound(nil,sfx_s3k33,player)
end
end
end
if mobj.health > 0 then
if mobj.getringovertime == nil then
mobj.getringovertime = 0
end
mobj.getringovertime = $1+1
if mobj.getringovertime >= TICRATE*10 then
bossplus_givesrings()
mobj.getringovertime = 0
end
end
end
As someone with minimal Lua knowledge, could someone explain (or alter the code themselves) so that it would work at all times, not just during the final boss? I want to use it for some things.