Toonic Posted December 14, 2014 Share Posted December 14, 2014 Hey guys! I'm trying to disable the Action button (Space), to stop allowing the user to do anything during a phase. Ontop of this, if the user dies during this phase/transformation, the game crashes. (To fix this I just temporarily upped the health to 2k and gave it a light source so it can't die during night.) Does anyone know how to fix this? Below is the character/wod.lua I'm using. And I'm transforming him into the Goose Moose Model, using everything default in those. Any help would be great. local MakePlayerCharacter = require "prefabs/player_common"local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), -- Don't forget to include your character's custom assets! Asset( "ANIM", "anim/wod.zip" ), Asset( "ANIM", "anim/goosemoose_build.zip" ), Asset( "ANIM", "anim/goosemoose_basic.zip" ),}local prefabs = { "goose_feather",}local function LeftClickPicker(inst, target_ent, pos) return {}endlocal function RightClickPicker(inst, target_ent, pos) return {}endlocal function ActionButtonPicker(inst) return{}endlocal start_inv = { --"goose_feather",}local health_percentlocal isGoose = falselocal function BecomeHuman(inst) local trans = inst.entity:AddTransform() isGoose = false trans:SetScale(1,1,1) inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild("wod") inst:SetStateGraph("SGwilson") inst.HUD.controls.crafttabs:Hide() inst.HUD.controls.inv:Hide() inst.HUD.controls.status:Hide() inst.components.playeractionpicker.leftclickoverride = nil inst.components.playeractionpicker.rightclickoverride = nil inst.components.playercontroller.actionbuttonoverride = nil inst.HUD.controls.crafttabs:Show() inst.HUD.controls.inv:Show() inst.HUD.controls.status:Show() inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED inst.components.talker:StopIgnoringAll() inst.components.health.maxhealth = 150 inst.components.health:SetPercent(health_percent)endlocal function SetHUDState(inst) if inst.HUD then if isGoose == true then inst.HUD.controls.crafttabs:Hide() inst.HUD.controls.inv:Hide() inst.HUD.controls.containerroot_side:Hide() inst.HUD.controls.status:Hide() inst.HUD.controls.mapcontrols.minimapBtn:Hide() elseif isGoose == false then inst.HUD.controls.crafttabs:Show() inst.HUD.controls.inv:Show() inst.HUD.controls.containerroot_side:Show() inst.HUD.controls.status:Show() inst.HUD.controls.mapcontrols.minimapBtn:Show() end endendlocal function BecomeGoose(inst) --local inst = CreateEntity() isGoose = true local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() --local sound = inst.entity:AddSoundEmitter() --local shadow = inst.entity:AddDynamicShadow() --MakeCharacterPhysics(inst, 5000, 1) trans:SetScale(0.5,0.5,0.5) inst.AnimState:SetBuild("goosemoose_build") inst.AnimState:SetBank("goosemoose") inst:SetStateGraph("SGmoose") inst.components.talker:IgnoreAll() --inst.components.locomotor.runspeed = 200 inst.components.inventory:DropEverything() inst.components.playeractionpicker.leftclickoverride = LeftClickPicker inst.components.playeractionpicker.rightclickoverride = RightClickPicker inst.components.playercontroller.actionbuttonoverride = ActionButtonPicker health_percent = inst.components.health:GetPercent() inst.components.health:SetMaxHealth(2000) inst.components.health:SetPercent(health_percent) inst:DoTaskInTime(0, function() SetHUDState(inst) end) --local brain = require("brains/wilsonbrain") --inst:SetBrain(brain) endlocal function common_postinit(inst) inst:AddTag("ghostwithhat")endlocal function OnStartNight(inst) BecomeGoose(inst)endlocal function OnStartDay(inst) if isGoose == true then BecomeHuman(inst) endendlocal function master_postinit(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- a minimap icon must be specified inst.MiniMapEntity:SetIcon( "wilson.png" ) --inst.components.health:SetMaxHealth(150) --inst.components.hunger.max = 150 --inst.components.sanity.max = 200 --inst.components.inventory:GuaranteeItems(start_inv) inst:WatchWorldState("startnight", OnStartNight) inst:WatchWorldState("startday", OnStartDay) --inst.components.playercontroller.actionbuttonoverride = ActionButtonPickerendreturn MakePlayerCharacter("wod", prefabs, assets, common_postinit, master_postinit, start_inv) Link to comment Share on other sites More sharing options...
chromiumboy Posted December 15, 2014 Share Posted December 15, 2014 Just use 'GetPlayer().components.playercontroller.enabled = false' to turn it off and 'GetPlayer().components.playercontroller.enabled = true' to turn it back on later. Link to comment Share on other sites More sharing options...
Toonic Posted December 15, 2014 Author Share Posted December 15, 2014 Still crashes the game after pressing Space. Link to comment Share on other sites More sharing options...
chromiumboy Posted December 16, 2014 Share Posted December 16, 2014 Post your log.txt file then. Just saying 'it crashes' isn't helpful. It's in your My Documents under Klei. Link to comment Share on other sites More sharing options...
Toonic Posted December 16, 2014 Author Share Posted December 16, 2014 http://pastebin.com/Uh2u0CDT - With "inst.components.playercontroller.actionbuttonoverride = ActionButtonPicker" commented out. http://pastebin.com/cL6ysiWY - With it enabled 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.