Mbfox Posted May 27, 2015 Share Posted May 27, 2015 Hey there!Is there any way to prevent a character from being damaged by charlie?If not, how can I make a character invincible at night time?Thanks Link to comment Share on other sites More sharing options...
absimiliard Posted May 27, 2015 Share Posted May 27, 2015 Bring up your console (' if I remember correctly), if in DST instead of DS then go remote by hitting Ctl, then type in "c_godmode()" and Charlie (and hunger and heat/cold) will no longer be any threat at all. I don't think there's any way that doesn't involve cheating at the game, and if you're going to cheat the console is probably the easiest way to accomplish that. Link to comment Share on other sites More sharing options...
Mbfox Posted May 27, 2015 Author Share Posted May 27, 2015 Bring up your console (' if I remember correctly), if in DST instead of DS then go remote by hitting Ctl, then type in "c_godmode()" and Charlie (and hunger and heat/cold) will no longer be any threat at all. I don't think there's any way that doesn't involve cheating at the game, and if you're going to cheat the console is probably the easiest way to accomplish that.Thanks for the swift reply, but I was hoping for a way to add charlie-resistance to a character mod as a feature Link to comment Share on other sites More sharing options...
absimiliard Posted May 27, 2015 Share Posted May 27, 2015 Oooooh. I'm sorry, I'm useless for that question. My bad not noticing the forum this was posted in. (I have a horrible habit of reading these forums through the "View New Content" button only, which can leave me a bit unclear on which forum I'm in at the moment.) Link to comment Share on other sites More sharing options...
Mobbstar Posted May 27, 2015 Share Posted May 27, 2015 If you download my mod "Alchemical Brewage", you can find a potion effect called "grueimmune". You can't simply remove the component, it seems. So instead I set the warn- and hurt-times to really long ones whenever the player triggers Charlie. Link to comment Share on other sites More sharing options...
Blueberrys Posted May 27, 2015 Share Posted May 27, 2015 @Mbfox-- Stop updating, in case it's already darkinst.components.grue:Stop()-- Prevent future re-enablefunction inst.components.grue:Start() end-- If you want to remove the component too for whatever reason-- inst:RemoveComponent("grue") Link to comment Share on other sites More sharing options...
Mobbstar Posted May 27, 2015 Share Posted May 27, 2015 @Mbfox-- Stop updating, in case it's already darkinst.components.grue:Stop()-- Prevent future re-enablefunction inst.components.grue:Start() end-- If you want to remove the component too for whatever reason-- inst:RemoveComponent("grue") lol I didn't think of that The second one does not make sense to me though. Did you mean to replace the Start() function? Link to comment Share on other sites More sharing options...
Mbfox Posted May 27, 2015 Author Share Posted May 27, 2015 @Blueberrys Im pretty new to modding and coding in general, could you tell me how I'd implement that code? Link to comment Share on other sites More sharing options...
Blueberrys Posted May 27, 2015 Share Posted May 27, 2015 Did you mean to replace the Start() function?Yep, it's replacing the Start function.Essentially the same as:inst.components.grue.Start = function(self) end- @Mbfox It would go anywhere that the inst variable refers to your player instance. Since this is character specific and not going to change (grue doesn't need to toggle), you can just put it inside your "fn" function in your character prefab code. Link to comment Share on other sites More sharing options...
Mbfox Posted May 27, 2015 Author Share Posted May 27, 2015 @Blueberrys Okay let me rephrase: I know absolutely nothing about modding and have just cut stuff so far... heeelp xP Link to comment Share on other sites More sharing options...
Mobbstar Posted May 27, 2015 Share Posted May 27, 2015 Yep, it's replacing the Start function.Essentially the same as:inst.components.grue.Start = function(self) end Of course, I was confused by the "end" being in the same line. @Blueberrys Okay let me rephrase: I know absolutely nothing about modding and have just cut stuff so far... heeelp xP Somewhere you probably set your characters stats and the speak sound? There, just underneath or above. Link to comment Share on other sites More sharing options...
Blueberrys Posted May 27, 2015 Share Posted May 27, 2015 @Mbfox You have a file something like "..\YourModFolder\scripts\prefabs\your_character.lua", right? In there, look for the function named "fn".local function fn(inst) -- Lots of code here -- Put that bit hereend- Edit: Of course, I was confused by the "end" being in the same line. Oh, sorry, I just left it in one line to keep it short and easy for the comments. xD Link to comment Share on other sites More sharing options...
Mbfox Posted May 27, 2015 Author Share Posted May 27, 2015 @Blueberrys I tried both local function fn(inst) inst.components.grue:Stop() inst.components.grue.Start = function(self) end endandlocal function fn(inst) inst.components.grue:Stop()endbut neither prevent the grue attacking Link to comment Share on other sites More sharing options...
Blueberrys Posted May 27, 2015 Share Posted May 27, 2015 @Mbfox Please show your full code. Edit: Read the code here, and the portion about functions and references here. Note that your code may have this:local fn = function(inst) instead of this:local function fn(inst) Link to comment Share on other sites More sharing options...
Mbfox Posted May 27, 2015 Author Share Posted May 27, 2015 Please show your full code. I've essentially edited an existing mod for my own needs:local MakePlayerCharacter = require "prefabs/player_common"local function fn(inst) inst.components.grue:Stop() inst.components.grue.Start = function(self) end end local assets = { Asset("ANIM", "anim/worm.zip"), Asset("SOUND", "sound/worm.fsb"),}local prefabs = { "monstermeat", "wormlight",}local start_inv = {}local function RestoreNightvision(inst) inst:DoTaskInTime(3, function(inst) inst.Light:Enable(true) inst.Light:SetRadius(4) inst.Light:SetFalloff(.5) inst.Light:SetIntensity(.6) inst.Light:SetColour(245/255,40/255,0/255) end, inst)endlocal function updatestats(inst) if TheWorld.state.isnight then inst.components.grue:Stop() endendlocal function setChar(inst) inst.AnimState:SetBank("worm") inst.AnimState:SetBuild("worm") inst:SetStateGraph("SGwormplayer") inst.components.hunger:Pause() inst.components.sanity.ignore = trueendlocal function drop(inst) local hand = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)local head = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)local body = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.BODY) if hand or body or head theninst:DoTaskInTime(0.1, function()local item = inst.components.inventory:Unequip(EQUIPSLOTS.HANDS)local item = inst.components.inventory:Unequip(EQUIPSLOTS.HEAD)local item = inst.components.inventory:Unequip(EQUIPSLOTS.BODY) inst.AnimState:OverrideSymbol("swap_object", "nil", "nil") end) end endlocal common_postinit = function(inst) inst.soundsname = "wilson" inst.MiniMapEntity:SetIcon( "wormplayer.tex" ) inst:DoTaskInTime(0, function() if ThePlayer then ThePlayer:EnableMovementPrediction(false) endend)endlocal master_postinit = function(inst) inst.components.health:SetMaxHealth(TUNING.WORM_HEALTH) inst:AddComponent("healthRegen") inst:AddComponent("lootdropper") inst:ListenForEvent("equip", drop) inst.components.combat:SetDefaultDamage(TUNING.WORM_DAMAGE) inst.components.combat:SetRange(TUNING.WORM_ATTACK_DIST) inst.components.combat:SetAttackPeriod(TUNING.WORM_ATTACK_PERIOD) inst.components.temperature.inherentinsulation = -TUNING.INSULATION_SMALL inst.AnimState:SetBuild("worm") inst.OnSetSkin = function(skin_name) inst.AnimState:SetBuild("worm") inst:SetStateGraph("SGwormplayer") end inst.AnimState:SetBank("worm") inst:SetStateGraph("SGwormplayer") inst.components.talker:IgnoreAll() inst.components.hunger:Pause() inst.components.sanity.ignore = true inst.components.temperature:SetTemp(20) inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE -- Stats varies day/night inst:ListenForEvent( "daytime", function() updatestats(inst) end , GetWorld()) inst:ListenForEvent( "dusktime", function() updatestats(inst) end , GetWorld()) inst:ListenForEvent( "nighttime", function() updatestats(inst) end , GetWorld()) updatestats(inst) inst.components.talker.colour = Vector3(127/255, 0/255, 0/255) inst:ListenForEvent("respawnfromghost", RestoreNightvision) inst:DoTaskInTime(0, setChar) inst:ListenForEvent("respawnfromghost", function() inst:DoTaskInTime(10, setChar) inst:DoTaskInTime(10, RestoreNightvision) end) MakeCharacterPhysics(inst, 1000, .5) inst:AddTag("monster") inst:AddTag("hostile") inst:AddTag("wet") inst.components.locomotor.walkspeed = 6 inst.components.locomotor:SetSlowMultiplier( 1 ) inst.components.locomotor:SetTriggersCreep(false) inst.components.locomotor.pathcaps = { ignorecreep = true } inst.components.lootdropper:SetLoot({"monstermeat", "monstermeat", "monstermeat", "monstermeat", "wormlight"}) inst:AddComponent("inspectable") return inst endreturn MakePlayerCharacter("wormplayer", prefabs, assets, common_postinit, master_postinit, start_inv) Link to comment Share on other sites More sharing options...
Blueberrys Posted May 27, 2015 Share Posted May 27, 2015 @Mbfox Is this for DST? o.o No wonder..The function you wrote at the top (fn) is completely useless cause it's not being called/referenced anywhere. Put the code in the master_postinit function at the bottom. Link to comment Share on other sites More sharing options...
Mbfox Posted May 28, 2015 Author Share Posted May 28, 2015 Sorry wrong section didnt notice that :S Anyway thanks for the help it's working perfectly Link to comment Share on other sites More sharing options...
Recommended Posts
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.