Jump to content

Making a mod character based on Wolfgang. Possible?


Recommended Posts

I'm 100% new to the modding scenario but I have watched the basic tutorial everyone has probably watched. I am curious if one can make a character like Wolfgang? I want my character to have 3 levels like Wolfgang but the perks in opposite. When he's full, he's slow and normal. But the third level where the hunger is low, he gets fast and strong. If it's even possible, what should I do? :) I have made the art for all three forms.. I don't know what to do now.

Link to comment
Share on other sites

@Kakashi00521, well you can copy the entire wolfgang.lua prefab.

 

Then you change the lines

Asset("ANIM", "anim/wolfgang.zip"),Asset("ANIM", "anim/wolfgang_skinny.zip"),Asset("ANIM", "anim/wolfgang_mighty.zip"),Asset("ANIM", "anim/ghost_wolfgang_build.zip"),inst.AnimState:SetBuild("wolfgang")inst.AnimState:SetBuild("wolfgang_skinny")inst.AnimState:SetBuild("wolfgang_mighty")return MakePlayerCharacter("wolfgang", nil, assets, nil, master_init)

for your character name instead of wolfgang.

 

Then you put

inst.soundsname = "wolfgang"

in the master_init.

 

But the bulk is in the applymightiness(inst) function. You have to turn around the math there.

local function applymightiness(inst)	local percent = inst.components.hunger:GetPercent()	percent = math.abs(1 - percent)		local damage_mult = TUNING.WOLFGANG_ATTACKMULT_NORMAL	local hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL	local health_max = TUNING.WOLFGANG_HEALTH_NORMAL	local scale = 1	local mighty_scale = 1.25	local wimpy_scale = .9	if inst.strength == "mighty" then		local wimpy_start = (TUNING.WOLFGANG_START_WIMPY_THRESH/TUNING.WOLFGANG_HUNGER)			local wimpy_percent = math.min(1, percent/wimpy_start )		damage_mult = easing.linear(wimpy_percent, TUNING.WOLFGANG_ATTACKMULT_WIMPY_MIN, TUNING.WOLFGANG_ATTACKMULT_WIMPY_MAX - TUNING.WOLFGANG_ATTACKMULT_WIMPY_MIN, 1)		health_max = easing.linear(wimpy_percent, TUNING.WOLFGANG_HEALTH_WIMPY, TUNING.WOLFGANG_HEALTH_NORMAL - TUNING.WOLFGANG_HEALTH_WIMPY, 1)			hunger_rate = easing.linear(wimpy_percent, TUNING.WOLFGANG_HUNGER_RATE_MULT_WIMPY, TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL - TUNING.WOLFGANG_HUNGER_RATE_MULT_WIMPY, 1)			scale = easing.linear(wimpy_percent, wimpy_scale, 1 - wimpy_scale, 1)		elseif inst.strength == "wimpy" then		local mighty_start = (TUNING.WOLFGANG_START_MIGHTY_THRESH/TUNING.WOLFGANG_HUNGER)			local mighty_percent = math.max(0, (percent - mighty_start) / (1 - mighty_start))		damage_mult = easing.linear(mighty_percent, TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MIN, TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MAX - TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MIN, 1)		health_max = easing.linear(mighty_percent, TUNING.WOLFGANG_HEALTH_NORMAL, TUNING.WOLFGANG_HEALTH_MIGHTY - TUNING.WOLFGANG_HEALTH_NORMAL, 1)			hunger_rate = easing.linear(mighty_percent, TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL, TUNING.WOLFGANG_HUNGER_RATE_MULT_MIGHTY - TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL, 1)			scale = easing.linear(mighty_percent, 1, mighty_scale - 1, 1)		end    inst:ApplyScale("mightiness", scale)	inst.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE)	inst.components.combat.damagemultiplier = damage_mult	local health_percent = inst.components.health:GetPercent()	inst.components.health:SetMaxHealth(health_max)	inst.components.health:SetPercent(health_percent, true)end

You switch the mighty math with the wimpy math, and you turn around the percent.

So for 0.8 percent, your strength would be mighty, but the calculations would be done for a 1 - 0.8 = 0.2 wimpy percent.

Link to comment
Share on other sites

@Kakashi00521, well you can copy the entire wolfgang.lua prefab.

 

Then you change the lines

Asset("ANIM", "anim/wolfgang.zip"),Asset("ANIM", "anim/wolfgang_skinny.zip"),Asset("ANIM", "anim/wolfgang_mighty.zip"),Asset("ANIM", "anim/ghost_wolfgang_build.zip"),inst.AnimState:SetBuild("wolfgang")inst.AnimState:SetBuild("wolfgang_skinny")inst.AnimState:SetBuild("wolfgang_mighty")return MakePlayerCharacter("wolfgang", nil, assets, nil, master_init)

for your character name instead of wolfgang.

 

Then you put

inst.soundsname = "wolfgang"

in the master_init.

 

But the bulk is in the applymightiness(inst) function. You have to turn around the math there.

local function applymightiness(inst)	local percent = inst.components.hunger:GetPercent()	percent = math.abs(1 - percent)		local damage_mult = TUNING.WOLFGANG_ATTACKMULT_NORMAL	local hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL	local health_max = TUNING.WOLFGANG_HEALTH_NORMAL	local scale = 1	local mighty_scale = 1.25	local wimpy_scale = .9	if inst.strength == "mighty" then		local wimpy_start = (TUNING.WOLFGANG_START_WIMPY_THRESH/TUNING.WOLFGANG_HUNGER)			local wimpy_percent = math.min(1, percent/wimpy_start )		damage_mult = easing.linear(wimpy_percent, TUNING.WOLFGANG_ATTACKMULT_WIMPY_MIN, TUNING.WOLFGANG_ATTACKMULT_WIMPY_MAX - TUNING.WOLFGANG_ATTACKMULT_WIMPY_MIN, 1)		health_max = easing.linear(wimpy_percent, TUNING.WOLFGANG_HEALTH_WIMPY, TUNING.WOLFGANG_HEALTH_NORMAL - TUNING.WOLFGANG_HEALTH_WIMPY, 1)			hunger_rate = easing.linear(wimpy_percent, TUNING.WOLFGANG_HUNGER_RATE_MULT_WIMPY, TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL - TUNING.WOLFGANG_HUNGER_RATE_MULT_WIMPY, 1)			scale = easing.linear(wimpy_percent, wimpy_scale, 1 - wimpy_scale, 1)		elseif inst.strength == "wimpy" then		local mighty_start = (TUNING.WOLFGANG_START_MIGHTY_THRESH/TUNING.WOLFGANG_HUNGER)			local mighty_percent = math.max(0, (percent - mighty_start) / (1 - mighty_start))		damage_mult = easing.linear(mighty_percent, TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MIN, TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MAX - TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MIN, 1)		health_max = easing.linear(mighty_percent, TUNING.WOLFGANG_HEALTH_NORMAL, TUNING.WOLFGANG_HEALTH_MIGHTY - TUNING.WOLFGANG_HEALTH_NORMAL, 1)			hunger_rate = easing.linear(mighty_percent, TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL, TUNING.WOLFGANG_HUNGER_RATE_MULT_MIGHTY - TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL, 1)			scale = easing.linear(mighty_percent, 1, mighty_scale - 1, 1)		end    inst:ApplyScale("mightiness", scale)	inst.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE)	inst.components.combat.damagemultiplier = damage_mult	local health_percent = inst.components.health:GetPercent()	inst.components.health:SetMaxHealth(health_max)	inst.components.health:SetPercent(health_percent, true)end

You switch the mighty math with the wimpy math, and you turn around the percent.

So for 0.8 percent, your strength would be mighty, but the calculations would be done for a 1 - 0.8 = 0.2 wimpy percent.

I am doing a similar thing with one of my character mods. But, when the mightiness/wimpy modes activate, my character turns invisible, cant move, eat, lose health or anything. (I spawned in Deerclops and when he hit me i didn't take any damage). The only thing I can do in this stage is examine tings. SO can you help? Here is the scripts.lua file for my character (webster):

local easing = require "easing"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/grenade.zip" ),		Asset( "IMAGE", "images/inventoryimages/grenade.tex" ),		Asset( "ATLAS", "images/inventoryimages/grenade.xml" ),		Asset( "ANIM", "anim/grenadecluster.zip" ),		Asset( "IMAGE", "images/inventoryimages/grenadecluster.tex" ),		Asset( "ATLAS", "images/inventoryimages/grenadecluster.xml" ),		Asset( "ANIM", "anim/firebomb.zip" ),		Asset( "IMAGE", "images/inventoryimages/firebomb.tex" ),		Asset( "ATLAS", "images/inventoryimages/firebomb.xml" ),        Asset( "ANIM", "anim/webster.zip" ),		Asset( "ANIM", "anim/webster_mighty.zip" ),		Asset( "ANIM", "anim/webster_skinny.zip" ),}local function applymightiness(inst)	local percent = inst.components.hunger:GetPercent()		local damage_mult = TUNING.WOLFGANG_ATTACKMULT_NORMAL	local hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL	local health_max = TUNING.WOLFGANG_HEALTH_NORMAL	local scale = 1	local mighty_scale = 1.5	local wimpy_scale = .7	if inst.strength == "mighty" then		local mighty_start = (TUNING.WOLFGANG_START_MIGHTY_THRESH/TUNING.WOLFGANG_HUNGER)			local mighty_percent = math.max(0, (percent - mighty_start) / (1 - mighty_start))		damage_mult = easing.linear(mighty_percent, TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MIN, TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MAX - TUNING.WOLFGANG_ATTACKMULT_MIGHTY_MIN, 1)		health_max = easing.linear(mighty_percent, TUNING.WOLFGANG_HEALTH_NORMAL, TUNING.WOLFGANG_HEALTH_MIGHTY - TUNING.WOLFGANG_HEALTH_NORMAL, 1)			hunger_rate = easing.linear(mighty_percent, TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL, TUNING.WOLFGANG_HUNGER_RATE_MULT_MIGHTY - TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL, 1)			scale = easing.linear(mighty_percent, 1, mighty_scale - 1, 1)		elseif inst.strength == "wimpy" then		local wimpy_start = (TUNING.WOLFGANG_START_WIMPY_THRESH/TUNING.WOLFGANG_HUNGER)			local wimpy_percent = math.min(1, percent/wimpy_start )		damage_mult = easing.linear(wimpy_percent, TUNING.WOLFGANG_ATTACKMULT_WIMPY_MIN, TUNING.WOLFGANG_ATTACKMULT_WIMPY_MAX - TUNING.WOLFGANG_ATTACKMULT_WIMPY_MIN, 1)		health_max = easing.linear(wimpy_percent, TUNING.WOLFGANG_HEALTH_WIMPY, TUNING.WOLFGANG_HEALTH_NORMAL - TUNING.WOLFGANG_HEALTH_WIMPY, 1)			hunger_rate = easing.linear(wimpy_percent, TUNING.WOLFGANG_HUNGER_RATE_MULT_WIMPY, TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL - TUNING.WOLFGANG_HUNGER_RATE_MULT_WIMPY, 1)			scale = easing.linear(wimpy_percent, wimpy_scale, 1 - wimpy_scale, 1)		end		inst.Transform:SetScale(scale,scale,scale)	inst.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE*1.1)	inst.components.combat.damagemultiplier = damage_mult	local health_percent = inst.components.health:GetPercent()	inst.components.health.maxhealth = health_max	inst.components.health:SetPercent(health_percent)	inst.components.health:DoDelta(0, true)endlocal function onhungerchange(inst, data)	if inst.strength == "mighty" then		if inst.components.hunger.current < TUNING.WOLFGANG_END_MIGHTY_THRESH then			inst.strength = "normal"			inst.components.talker:Say"Ugh..."			inst.AnimState:SetBuild("webster")			inst.sg:PushEvent("powerdown")			inst.SoundEmitter:PlaySound("dontstarve/characters/wolfgang/shrink_lrgtomed")			inst.talksoundoverride = "dontstarve/characters/wolfgang/talk_LP"			inst.hurtsoundoverride = "dontstarve/characters/wolfgang/hurt"		end	elseif inst.strength == "wimpy" then		if inst.components.hunger.current > TUNING.WOLFGANG_END_WIMPY_THRESH then			inst.strength = "normal"			inst.components.talker:Say"I feel pretty good!"			inst.AnimState:SetBuild("webster")			inst.sg:PushEvent("powerup")			inst.SoundEmitter:PlaySound("dontstarve/characters/wolfgang/grow_smtomed")			inst.talksoundoverride = "dontstarve/characters/wolfgang/talk_LP"			inst.hurtsoundoverride = "dontstarve/characters/wolfgang/hurt"		end	else		if inst.components.hunger.current > TUNING.WOLFGANG_START_MIGHTY_THRESH then			inst.strength = "mighty"			inst.components.talker:Say"*RAAWWR!*"			inst.AnimState:SetBuild("webster_mighty")			inst.sg:PushEvent("powerup")			inst.SoundEmitter:PlaySound("dontstarve/characters/wolfgang/grow_medtolrg")			inst.talksoundoverride = "dontstarve/characters/wolfgang/talk_large_LP"			inst.hurtsoundoverride = "dontstarve/characters/wolfgang/hurt_large"		elseif inst.components.hunger.current < TUNING.WOLFGANG_START_WIMPY_THRESH then			inst.strength = "wimpy"			inst.components.talker:Say"I need something to eat! Fast!"			inst.AnimState:SetBuild("webster_skinny")			inst.sg:PushEvent("powerdown")			inst.SoundEmitter:PlaySound("dontstarve/characters/wolfgang/shrink_medtosml")			inst.talksoundoverride = "dontstarve/characters/wolfgang/talk_small_LP"			inst.hurtsoundoverride = "dontstarve/characters/wolfgang/hurt_small"		end	end	applymightiness(inst)endlocal prefabs = {}local start_inv = {	-- Custom starting items	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",	"gunpowder",}local fn = function(inst)		-- choose which sounds this character will play	inst.soundsname = "wolfgang"	-- Minimap icon	inst.MiniMapEntity:SetIcon( "webster.tex" )		inst.strength = "normal"		-- Stats		inst.components.sanity:SetMax(200)	inst.components.hunger:SetMax(TUNING.WOLFGANG_HUNGER)	inst.components.hunger.current = 150	applymightiness(inst)		inst:ListenForEvent("hungerdelta", onhungerchange) -- this is his mightiness application		-- Movement speed (optional)	inst.components.locomotor.walkspeed = 3.5	inst.components.locomotor.runspeed = 5.5endreturn MakePlayerCharacter("webster", prefabs, assets, fn, start_inv)

I have checked all of my exported and /anim folders and files, and it all seems to be in working order. So can you help? Thanks.

EDIT: Well I tested it a bit more; and his mightiness seems to work, it's just the transition that's bugged.

Edited by NeddoFreddo
Link to comment
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
 Share

×
  • Create New...