Jump to content

Recommended Posts

I am trying to create a character that can change into a Varg and back at will, getting to the Varg isn't to hard, but I can't seem to change back... The human form is invisible. I am assuming it's because I am changing inst.AnimState:SetBank to "varg" to transform, but I also have no animation for moving up or down on screen in Varg Form... I am trying to modify an existing mod, here is what I've got:

local function BallFn(inst)
if inst:HasTag("playerghost") then return end
if inst.transformed then
inst.AnimState:SetBank("player_common")
inst.AnimState:SetBuild("tamamo")
inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED)
inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED)
inst.components.health.absorb = 0.05
inst.components.combat.damagemultiplier = 0.8
inst.components.temperature.inherentinsulation = 35
inst.components.hunger:SetRate(0.18310)
inst:AddTag("character")
inst:RemoveTag("monster")

else 
	inst.AnimState:SetBank("warg")
    inst.AnimState:SetBuild("warg_build")
    inst:SetStateGraph("SGvargplayer")
	inst.components.health:SetMaxHealth(300)
	inst.components.hunger:SetMax(300)
	inst.components.combat:SetDefaultDamage(80)
	inst.components.combat.damagemultiplier = 1
	inst.components.temperature.inherentinsulation = 80
	inst.components.locomotor.walkspeed = (7)
	inst.components.locomotor.runspeed = (10)
	inst.components.temperature.maxtemp = 60
	inst.components.temperature.mintemp = 20
	inst.components.eater:SetDiet({ FOODTYPE.MEAT, FOODTYPE.MEAT }, { FOODTYPE.MEAT, FOODTYPE.MEAT })
	inst.components.eater:SetAbsorptionModifiers(4,2,2)
	inst.components.eater:SetCanEatHorrible()
	AddMinimapAtlas("images/map_icons/tamamo.xml")
	inst.components.eater.strongstomach = true -- can eat monster meat!
	inst:AddTag("monster")
	inst:RemoveTag("character")
	

	local sounds = 
	{
		walk = "dontstarve/beefalo/walk",
		grunt = "dontstarve/beefalo/grunt",
		yell = "dontstarve/beefalo/yell",
		swish = "dontstarve/beefalo/tail_swish",
		curious = "dontstarve/beefalo/curious",
		angry = "dontstarve/beefalo/angry",
	}


	local NIGHTVISION_COLOURCUBES =
	{
		day = "images/colour_cubes/insane_day_cc.tex",
		dusk = "images/colour_cubes/insane_dusk_cc.tex",
		night = "images/colour_cubes/purple_moon_cc.tex",
		full_moon = "images/colour_cubes/purple_moon_cc.tex",
	}

	local function SetNightVision(inst, enable)
		if TheWorld.state.isnight or TheWorld:HasTag("cave") then
			inst.components.playervision:ForceNightVision(true)
			inst.components.playervision:SetCustomCCTable(NIGHTVISION_COLOURCUBES)
		else
			inst.components.playervision:ForceNightVision(false)
			inst.components.playervision:SetCustomCCTable(nil)
		end
	end

	local function RestoreNightvision(inst)

		inst:DoTaskInTime(3, function(inst) 
		inst.Light:Enable(true)
		inst.Light:SetRadius(0)
		inst.Light:SetFalloff(.1)
		inst.Light:SetIntensity(.1)
		inst.Light:SetColour(245/255,40/255,0/255)
		end, inst)
	end

		inst.MiniMapEntity:SetIcon( "vargplayer.tex" )

		inst:DoTaskInTime(0, function()
	if ThePlayer then
		inst:EnableMovementPrediction(false)
	end
	end)

		inst:WatchWorldState( "isday", function() SetNightVision(inst) end)
		inst:WatchWorldState( "isdusk", function() SetNightVision(inst) end)
		inst:WatchWorldState( "isnight", function() SetNightVision(inst)  end)
		inst:WatchWorldState( "iscaveday", function() SetNightVision(inst) end)
		inst:WatchWorldState( "iscavedusk", function() SetNightVision(inst) end)
		inst:WatchWorldState( "iscavenight", function() SetNightVision(inst)  end)
	
		SetNightVision(inst)
	end



	local master_postinit = function(inst)
		inst.components.combat:SetAttackPeriod(TUNING.WARG_ATTACKPERIOD)
		inst.components.combat:SetRange(TUNING.WARG_ATTACKRANGE)
		inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/vargr/hit")
		inst.AnimState:SetBank("warg")
		inst.AnimState:SetBuild("warg_build")	
		inst.OnSetSkin = function(skin_name)
		inst.AnimState:SetBuild("warg_build")
		inst:SetStateGraph("SGvargplayer")
	
		inst:ListenForEvent("ms_respawnedfromghost", DontTriggerCreep)
		DontTriggerCreep(inst)
	

		inst:SetStateGraph("SGvargplayer")
		inst.components.locomotor:SetShouldRun(false)
		inst.components.talker:IgnoreAll()

	
		local light = inst.entity:AddLight()
		inst.Light:Enable(true)
		inst.Light:SetRadius(0)
		inst.Light:SetFalloff(0.9)
		inst.Light:SetIntensity(0.6)
		inst.Light:SetColour(180/255,195/255,150/255)
	
		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(3, function()  inst.components.health:SetInvincible(false)
				if inst.components.playercontroller ~= nil then
					inst.components.playercontroller:EnableMapControls(true)
					inst.components.playercontroller:Enable(true)
				end
				inst.components.inventory:Show()
				inst:ShowActions(true)
				inst:ShowHUD(true)
				inst:SetCameraDistance()
				inst.sg:RemoveStateTag("busy")
				SerializeUserSession(inst) 
			end)
			inst:DoTaskInTime(5, setChar)
			inst:DoTaskInTime(6, RemovePenalty)
			inst:DoTaskInTime(6, DontTriggerCreep)
			inst:DoTaskInTime(10, RestoreNightvision)
		end)
	
		return inst
	
	end


 
	end
	
	
 
	inst.transformed = not inst.transformed

 
	-- inst.components.health:SetCurrentHealth(1)
	-- inst.components.health:DoDelta(0)
	return true
 
end

AddModRPCHandler("tamamo", "BALL", BallFn)

Any help would be greatly appreiciated as I'm fairly new to modding in Don't Starve!

On 12/23/2016 at 7:12 PM, ThatForgottonGuy said:

<code snip>

most of these variables are for DST, not DS i believe

if you need help with transformations, look at both woodie and wolfgang, since they both handle with transformations (woodie into a werebeaver based on number of trees chopped, and wolfgang having a wimpy, normal, and mighty form based on hunger)

7 hours ago, The Noon Fish said:

most of these variables are for DST, not DS i believe

if you need help with transformations, look at both woodie and wolfgang, since they both handle with transformations (woodie into a werebeaver based on number of trees chopped, and wolfgang having a wimpy, normal, and mighty form based on hunger)

Sorry, yes it is DST not base Don't Starve. I did use woodie as part of my base as well as a character from another mod, transformations themselves don't cause me any trouble (done those a few times before), but I generally leave Stategraphs and Animation Banks alone.

I looked around a fair bit for someone having done something similar, but I wasn't able to find anything that wasn't just changing from a human to another human as far as animations go. My issue is that the Varg uses very different animations than the player normally does.

If it would help, I can upload all the files I'm using at the moment so you can take a look.

Thanks for the reply by the way!

10 hours ago, ThatForgottonGuy said:

My issue is that the Varg uses very different animations than the player normally does.

I don't really know how to help you further, other than to post this here. Maybe looking at playercommon.lua could help you here, but I'm not very good help.

2 hours ago, The Noon Fish said:

I don't really know how to help you further, other than to post this here. Maybe looking at playercommon.lua could help you here, but I'm not very good help.

No worries, you're the first person to try to help, and you've given me somewhere new to look, so I'll poke around in playercommon.lua for a while and see what I can learn. Thanks for the help!

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
×
  • Create New...