HUD drawing action

metalharbor

Member
I'm trying to make a new HUD element...this is very simple but runs on level load.

hud.add(function(myTarget, player) myTarget.drawString(270, 10, "BONUS", V_SNAPTORIGHT|V_SNAPTOTOP) end)

I'm trying to turn it into an action like this

local function A_actTarget() hud.add(function(myTarget, player) myTarget.drawString(270, 10, "BONUS", V_SNAPTORIGHT|V_SNAPTOTOP) end
But it doesn't seem to be working when it call it from another script.
 
I now have this

local function A_actTarget() hud.add(function(myTarget, player) myTarget.drawString(270, 10, "BONUS", V_SNAPTORIGHT|V_SNAPTOTOP) end) end

but still no luck. Not sure the syntax is correct.

Does the action/function have to be in the same lua file that is calling it, or at least loaded first?

(Btw the script calling it is an existing Open Asset that works with other actions, so I don't think that is the issue. Specifically I am trying to get the target in @RoyKirbs cool objects to call this action.)
 
I now have this

local function A_actTarget() hud.add(function(myTarget, player) myTarget.drawString(270, 10, "BONUS", V_SNAPTORIGHT|V_SNAPTOTOP) end) end

but still no luck. Not sure the syntax is correct.

Does the action/function have to be in the same lua file that is calling it, or at least loaded first?

(Btw the script calling it is an existing Open Asset that works with other actions, so I don't think that is the issue. Specifically I am trying to get the target in @RoyKirbs cool objects to call this action.)
the hud system acts upon an entirley different hook, hud.add can substitute addHook for this, but you'll never be able to get rid of the hook through other code.

instead, have the code try to make a variable and set it to something in the target, and in the hud hook, if player.mo has that, then do your drawString call
 
That is still a bit beyond me to be honest

I've tried using @clairebun's HUD objects but can't really figure it out either


I realize we aren't supposed to ask for anyone to make things outright, but if anyone is willing to work with me on this please get in touch via DM and I'll explain exactly what I need with a demo map etc.

This is for a project that is 90% finished and set for release in September...if you contribute, you'll be credited of course
 

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

Back
Top