Jump to content

Recommended Posts

like it says, I MUST know this code!

(debugman gave me some code for it but I couldn't figure out how to use it correctly)

 

I need the ability to change absolutely anything in the mod at all how the hat gives sanity, what powers that sword has, and even add a prefab that is only available to you if you enable RoG I need to learn how to take full control of this! so please tell me how to check for DLC RoG thanks ;)

GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS)

 

 

For inside modmain.lua:

For outside modmain.lua:

IsDLCEnabled(REIGN_OF_GIANTS)

ok to test this I did this in the modmain:

 

if GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then
 
AddPrefabPostInit("nightmarehelmet", function(inst)
inst:AddTag("dlc_on")
end)
 
elseif not GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then
 
AddPrefabPostInit("nightmarehelmet", function(inst)
inst:AddTag("dlc_off")
end)
end
 
and this in the nightmarehelmet:
 
if (inst:HasTag("dlc_on")) then
 
inst.AnimState:SetBank("hat_football")
inst.AnimState:SetBuild("hat_football")
 
elseif (inst:HasTag("dlc_off")) then
 
inst.AnimState:SetBank("hat_feather")
inst.AnimState:SetBank("hat_feather")
end

 

just to see if it is different in a nondlc world (it stayed a football helmet in both RoG and vanilla worlds)

so I am obviously using it incorrectly or something... any ideas?

 

Edited by Fidooop

Well, for one, you don't need those tags at all. In nightmarehelmet, just do:

if IsDLCEnabled(REIGN_OF_GIANTS) then    inst.AnimState:SetBank("hat_football")    inst.AnimState:SetBuild("hat_football")else    inst.AnimState:SetBank("hat_feather")    inst.AnimState:SetBank("hat_feather")end
Add print statements like so if you want to make sure it's doing what you expect it to:

if IsDLCEnabled(REIGN_OF_GIANTS) then    print("setting nightmarehelmet to hat_football")    inst.AnimState:SetBank("hat_football")    inst.AnimState:SetBuild("hat_football")else    print("setting nightmarehelmet to hat_feather")    inst.AnimState:SetBank("hat_feather")    inst.AnimState:SetBank("hat_feather")end
and then look in the console log after spawning one to see what it says (CTRL+L or ~).

Fidooop, imho whole point of this DLC detection is to use DLC assets/features or not.

 

but if you don't use them, so why you need such detection?  hat_football and hat_feather is available in original game.

ok to test this I did this in the modmain:

 

if GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then

 

AddPrefabPostInit("nightmarehelmet", function(inst)

inst:AddTag("dlc_on")

end)

 

elseif not GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then

 

AddPrefabPostInit("nightmarehelmet", function(inst)

inst:AddTag("dlc_off")

end)

end

 

and this in the nightmarehelmet:

 

if (inst:HasTag("dlc_on")) then

 

inst.AnimState:SetBank("hat_football")

inst.AnimState:SetBuild("hat_football")

 

elseif (inst:HasTag("dlc_off")) then

 

inst.AnimState:SetBank("hat_feather")

inst.AnimState:SetBank("hat_feather")

end

 

just to see if it is different in a nondlc world (it stayed a football helmet in both RoG and vanilla worlds)

so I am obviously using it incorrectly or something... any ideas?

A prefab post init is a prefab post init. It runs after the prefab's "fn". But I don't see the point in these tags, just do the IsDLCEnabled test in the prefab's fn itself.

Fidooop, imho whole point of this DLC detection is to use DLC assets/features or not.

 

but if you don't use them, so why you need such detection?  hat_football and hat_feather is available in original game.

This was just to test it! I really needed this so that I can get a hat to work in and out of DLC

(since their sanity giving/taking codes are different between vanilla and RoG)

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...