rons0n Posted June 30, 2015 Share Posted June 30, 2015 So in the process of making this character I gave her a transformation based of Kzisor's Keyhandler.But the transformation is too instant and I need assistance to adjusting it. If the title gave it away, I want her to perform the 'angry' emote and be struck by lightning as she transforms, but without the bad sides(No damage, No burning, no nothing, this includes structures). And as she transforms, 20% of her Max Sanity, Health, and Hunger is consumed. This applies vice-versa. Any type of help is appreciated! In modmain:GLOBAL.TUNING.PLUTIA = {}GLOBAL.TUNING.PLUTIA.KEYTHREE = GetModConfigData("key3") or 122local function IrisFn(inst)if inst:HasTag("playerghost") then return endif inst.transformed theninst.AnimState:SetBuild("plutia")inst.components.locomotor.walkspeed = 6inst.components.locomotor.runspeed = 8.5inst.components.health.absorb = 0.10inst.components.combat.damagemultiplier = 1inst.Transform:SetScale(0.8, 0.8, 0.8) elseinst.AnimState:SetBuild("irisheart")inst.components.locomotor.walkspeed = 7inst.components.locomotor.runspeed = 9.5inst.components.health.absorb = 0.50inst.components.combat.damagemultiplier = 1.8inst.Transform:SetScale(1, 1, 1) end inst.transformed = not inst.transformed return true end AddModRPCHandler("Plutia", "IRIS", IrisFn) And character prefab: 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" ), Asset( "ANIM", "anim/plutia.zip" ), Asset( "ANIM", "anim/ghost_plutia_build.zip" ), Asset( "ANIM", "anim/irisheart.zip" ), Asset( "ANIM", "anim/ghost_irisheart_build.zip" ),}local prefabs = {}-- Custom starting itemslocal start_inv = {}-- When the character is revived from humanlocal function onbecamehuman(inst) -- Set speed when loading or reviving from ghost (optional) inst.components.locomotor.walkspeed = 6 inst.components.locomotor.runspeed = 8.5end-- When loading or spawning the characterlocal function onload(inst) inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman) if not inst:HasTag("playerghost") then onbecamehuman(inst) endend-- This initializes for both the server and client. Tags can be added here.local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon( "plutia.tex" ) inst:AddTag("specialdogooowner") inst.transformed = false inst:AddComponent("keyhandler") inst.components.keyhandler:AddActionListener("Plutia", TUNING.PLUTIA.KEYTHREE, "IRIS")end-- This initializes for the server only. Components are added here.local master_postinit = function(inst) -- choose which sounds this character will play inst.soundsname = "willow" -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used --inst.talker_path_override = "dontstarve_DLC001/characters/" -- Stats inst.components.health:SetMaxHealth(150) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(200) inst.OnLoad = onload inst.OnNewSpawn = onloadendreturn MakePlayerCharacter("plutia", prefabs, assets, common_postinit, master_postinit, start_inv) Link to comment Share on other sites More sharing options...
Kzisor Posted June 30, 2015 Share Posted June 30, 2015 @rons0n, put the transformation code in a delayed thread?inst:DoTaskInTime(8*GLOBAL.FRAMES, function(inst)-- code hereend) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now