Jump to content

[HELP] Enabling/Disabling Assets Depending on DLC


Recommended Posts

I'm quite new to the modding stuff so I decided to ask for some help from you guys. I'm making a custom character, it's practically done but right at the very end I've encountered a problem I'm not capable of dealing with. It sounds really simple - two assets I gave to the item are crashing "main" version of the game. DLC is working just fine, but when I try to load the session with "Reign of Giants" disabled the game simply shuts down. I know that deleting assets works, but is it any way to tell the game to "ignore" them while playing vanilla version of DS? I want the character to be enjoyable in both DLC and Vanilla DS, so I really hope for your help! 

 

Here's the code fragment (I bolded the assets crashing vanilla):

local function fn(Sim)
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
    
local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "farmerhat.tex" )
 
MakeInventoryPhysics(inst)
    
inst:AddTag("farmerhat")
 
anim:SetBank("strawhat")
    anim:SetBuild("farmerhat")
    anim:PlayAnimation("anim")
 
inst:AddComponent("inspectable")
   
    inst:AddComponent("inventoryitem")
inst.components.inventoryitem.atlasname = "images/inventoryimages/farmerhat.xml"
 
    inst:AddComponent("tradable")
 
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED
   
    inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_MED)
 
    inst:AddComponent("insulator")
    inst.components.insulator:SetSummer()
    inst.components.insulator:SetInsulation(TUNING.INSULATION_MED)
 
inst:AddComponent("dapperness")
    inst.components.dapperness.dapperness = (TUNING.DAPPERNESS_TINY)
 
    inst.components.equippable:SetOnEquip( onequip )
 
    inst.components.equippable:SetOnUnequip( onunequip )
  
    return inst
end
Link to comment
Share on other sites

I think you can just do an "if x then y end" with x being the dlcenabled variable function "IsDLCEnabled(REIGN_OF_GIANTS)" and y the bold bits. Since I don't have the dlc, I don't use such things a lot. I don't know if it will work, but it is in the game code.

Link to comment
Share on other sites

I think you can just do an "if x then y end" with x being the dlcenabled variable function "IsDLCEnabled(REIGN_OF_GIANTS)" and y the bold bits. Since I don't have the dlc, I don't use such things a lot. I don't know if it will work, but it is in the game code.

 

Holy cow it worked. I actualy tried it before but it just crashed the whole game, so I must have messed something up. Thanks for the really quick answer and have a nice day, sir!

 

Um, also should I close the topic and if so - how do I do that? :D

Link to comment
Share on other sites

Holy cow it worked. I actualy tried it before but it just crashed the whole game, so I must have messed something up. Thanks for the really quick answer and have a nice day, sir!

 

Um, also should I close the topic and if so - how do I do that? :grin:

 

Glad I could help! :) Just leave the topic as it is, and don't forget to publish your mod when it's done (asuming it doesn't have strong language, copyright issues or such of course)

Link to comment
Share on other sites

Glad I could help! :-) Just leave the topic as it is, and don't forget to publish your mod when it's done (asuming it doesn't have strong language, copyright issues or such of course)

 

Sure, and don't worry about copyrights, swears or... other stuff. I've been around long enough to know what's what. Once again thanks for helping me!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...