Ring Lua help

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.
 
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.
Put that second section in a MobjThinker hook, and as long as the specified object is in the map, you'll recieve rings.
Seems like it's made like this because of the tying to the boss.
 
Put that second section in a MobjThinker hook, and as long as the specified object is in the map, you'll recieve rings.
Seems like it's made like this because of the tying to the boss.
Alright, how do I do that? As a non-coder, this kind of stuff is puzzling. Do I just change one of the mobj lines into a thinker?
 

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

Back
Top