Jump to content

Recommended Posts

Hello, I have a question!

So, on a certain event is there a code or something I can do to swap the health badge's textures with "gelid_health" I made? And then on another event a code to make the health badge's textures back to default again?

Any help would be appreciatedFrozen Heart.png! Also, thanks so much for reading my question & have a wonderful day/night :D!

Edited by SuperDavid

dont know specific code, but if I got it right, you simply want to hide/remove the heart and show another icon you made?
Why not just hiding the heart and show your icon? Put them at the same location and everything is fine.

I'm not experienced on how to do this, but it sounds quite easy, so I wonder why you don't do this? To find out how to hide/show and set position of icons you can look at any mods that modding these icons, like combined status or PartyHUD - Team Health Display

10 hours ago, Serpens said:

I'm not experienced on how to do this, but it sounds quite easy, so I wonder why you don't do this? To find out how to hide/show and set position of icons you can look at any mods that modding these icons

I don't understand those mods, most of the time they're extremely complicated but i'll try to take a look but I probably won't be able to do anything..

Edited by SuperDavid

Okay, so I have something like this in my modmain.lua

table.insert(Assets, Asset("ANIM", "anim/gelid_health.zip"))

local function GelidHealthBadge(class, inst)
	if GLOBAL.ThePlayer.prefab == "adam" and inst.gelid_mode == true then
	   class.heart.anim:GetAnimState():SetBuild("gelid_health")
	   elseif GLOBAL.ThePlayer.prefab == "adam" and inst.gelid_mode == nil then
	   class.heart.anim:GetAnimState():SetBuild("health")
	end
end

AddClassPostConstruct("widgets/statusdisplays", GelidHealthBadge)

and it works the only problem is I have  no idea how to activate this function in other functions  inside modmain.lua  or inside  mycharacter.lua :(...

If anyone can help with those that would be great because I don't know how to do this :(...

Thanks for reading have a wonderful day/night :D!

 

Edited by SuperDavid
2 minutes ago, SuperDavid said:

You can put functions in other functions :shock:?

you can call functions within function =P

But I don't know the way to call this specific function... and of course you have to make sure, that you don't call a function that belongs to a bigger complex. I mean you have to know what the function does and what is the original purpose of this function. If the function is ment to be called only if xy happens and you call it at xz, it might cause problems. So you have to understand if there will be problems or not.

What you did was to put a function into the StatusDisplay script... I don't think this is good way to do it... But as I already stated, I have not much knowledge with dealing icons and such stuff...
And why are you using ThePlayer and inst in your code? Isn't "inst" the player?

.... hm no, sry I can't help you more.  I would need to dig deeper ind learn on my own how to do it properly. And therefore I would need one or two hours I can't afford at the moment.

All I can tell you, that you could try when the mode activates:
 

local StatusDisplays = require "widgets/statusdisplays"
StatusDisplay.GelidHealthBadge(inst)

But don't know if this will work. And I don't know if your code will work for everyone and with caves...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...