Sign in to follow this  
Renamon

Ghost will not appear after transformation

Recommended Posts

Renamon    27

Hey there!  long time no modding-

I need some help,

so I'm currently porting my regular don't starve character into dst but i've run across one big issue.

I have coded my character correctly and everything was ready to go, till I stumbled upon an issue; when you die after transforming the characters ghost will not appear.

 

upon searching around I found some similar issues but I cannot see how to fix this occurrence on my own. I would be very ecstatic if someone could help me finish this off and tell me why this is happening in the first place. I understand that the files are critically mismatching but why?

 

i've looked at wolfgang and I can't seem to grasp how his works and how I can fix mine with his coding.

 

i've attached a screenshot of the issue and the prefab.lua that I have been working on.

post-411072-0-89226700-1434040234_thumb.

rena.lua

Share this post


Link to post
Share on other sites
Renamon    27

@Renamon, you aren't setting the ghost build.

 

inst.ghostbuild = "ghost_rena_build"

 

after I set this the issue still occurs- the game knows where the ghost is now but the other two build changes are still conflicting with the ghost. - I made sure to include it in every instance in which the character transforms so the build is never lost so in total there are 4 instances of "ghost_rena_build"

local MakePlayerCharacter = require "prefabs/player_common"----sounds, speech, portraits and icons are are located inside of "modmain"-----Local assets dictate how the game handles certain animation/ build sequences for example; --- "asset "anim", rena.zip" simply states that the character model/ sprites are located inside that zip folder,--- by adding a sequence to change that "build" or animation sequence on a change of event the game will change the build.local assets = {  		Asset( "ANIM", "anim/rena.zip" ), ---- displays renamons default playermodel will be part of this character		Asset( "ANIM", "anim/venge.zip"), --- displays vengeances playermodel will be part of this character		Asset( "ANIM", "anim/ghost_rena_build.zip" ), ---- dst ghost}local prefabs = {}local start_inv = {	-- Custom starting items}-- This initializes for both clients and the hostlocal common_postinit = function(inst) 	-- Minimap icon	inst.MiniMapEntity:SetIcon( "myicon.tex" )end----------------------------code start for transformation sequence------------------------------------------ IMPORTANT NOTE--------- wolfgang seems to have a state which the game stops looking for the values in his character-- this allows him to turn into a ghost if he dies and the game will stop looking until he turns into a human once again.-----tells the game that if you turn into this character you will aquire these asepects and statisticslocal function becomecharname(inst)         inst.evil = false ---- this instance tells the game that you are NOT in that state therefore setting these stats				inst.norm = false        		inst.AnimState:SetBuild("rena")          		inst.components.health:SetMaxHealth(275)				inst.Transform:SetScale(1.4, 1.4, 1.4)				inst.components.hunger:SetMax(200)				inst.components.sanity:SetMax(225)				inst.components.combat.damagemultiplier = 2.5				inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)				inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2)				inst.components.sanity.night_drain_mult = 2.5				inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.0)		inst.talksoundoverride = "dontstarve/characters/rena/talk_LP"		inst.ghostbuild = "ghost_rena_build"		inst.components.talker:Say("Virus scan complete, No virus digimon data found!")endlocal function becomenormal_form(inst)		inst.evil = false ---- this instance tells the game that you are NOT in that state therefore setting these stats				inst.norm = true        		inst.AnimState:SetBuild("rena")        		inst.components.health:SetMaxHealth(137)	    		inst.Transform:SetScale(1, 1, 1)				inst.components.combat.damagemultiplier = 1.5				inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.5)				inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9)				inst.components.sanity.night_drain_mult = 0.5				inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.25)				inst.talksoundoverride = "dontstarve/characters/rena/talk_LP"				inst.SoundEmitter:PlaySound("dontstarve/creatures/knight_nightmare/voice")				inst.SoundEmitter:KillSound("nightmaresound")				inst.components.talker:Say("Data restore from backup complete, Digimon virus data still present.")	           inst.AnimState:PlayAnimation("wakeup")	   	   inst.ghostbuild = "ghost_rena_build"		endlocal function becomeevil_form(inst)         inst.evil = true				inst.norm = false				inst.ghostbuild = "ghost_rena_build"        inst.AnimState:SetBuild("venge")          inst.components.combat.damagemultiplier = 4.5     		inst.components.sanity.night_drain_mult = 5.5	         inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.25)             inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.75)				inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 3.25)				inst.components.hunger.max = 150				inst.components.sanity.max = 225				inst.components.health:SetMaxHealth(120)				inst.talksoundoverride = "dontstarve/characters/vrena/talk_LP"				  -------------tells the game that the voice has changed for talking sequences		              		inst.AnimState:PlayAnimation("teleport")				inst.components.talker:Say("LETHAL VIRUS TYPE DIGIMON DATA INJECTION STATUS: COMPLETE, TAKING CONTROL")end---------------------------------------------------------------------- All code stolen right from Wolfgang, so some of this might not be relevant for you. -- Just before your conditions which trigger shape shifting. In Wolfgang's case this is his "onhungerchange" function.-------------------local becomeformtreshold = (33)local becomenormalthreshold = (50)local unbecomeformtreshold = (200)local function sanity_event_listener(inst, data)if inst.components.sanity.current <= becomeformtreshold and not inst.evil then        becomeevil_form(inst)elseif inst.components.sanity.current >= unbecomeformtreshold and inst.normal then        becomecharname(inst)         elseif inst.components.sanity.current >= becomenormalthreshold and inst.evil then 		becomenormal_form(inst)        endend------------------old code section use for scraps----------			-- This initializes for the host onlylocal master_postinit = function(inst)	-----------------------work in progress code    inst.talksoundoverride = nil    inst.hurtsoundoverride = nil	-----------------------------OLD CODE-------------------------------------------	-- choose which sounds this character will play	inst.soundsname = "rena", ---------character sound name	-- Stats	inst.components.health:SetMaxHealth(275)	inst.components.hunger:SetMax(200)	inst.components.sanity:SetMax(225)	inst.components.combat.damagemultiplier = 2	inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)	inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2)	inst.components.sanity.night_drain_mult = 2.5	inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.25)	inst:ListenForEvent("sanitydelta", sanity_event_listener) 	inst.ghostbuild = "ghost_rena_build"------------tells the game to listen for a change in the characters sanity from the startend----this is here because I did not want it inside of my mod main.... >.>STRINGS.CHARACTER_TITLES.rena = "The Rookie Digimon"STRINGS.CHARACTER_NAMES.rena = "Renamon"STRINGS.CHARACTER_DESCRIPTIONS.rena = "*Digimon, Part of the Nightmare Solders Family\n*Very Hungry, Ninja Like, Powerful- Yet fragile \n* A Very Calm Cool and Collected Digimon "STRINGS.CHARACTER_QUOTES.rena = "\" They Should Have Left Me In The Digital World....\""return MakePlayerCharacter("rena", prefabs, assets, common_postinit, master_postinit, start_inv)

rena.lua

post-411072-0-00086700-1434073572_thumb.

Edited by Renamon

Share this post


Link to post
Share on other sites

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
Sign in to follow this