FashionablyRin Posted July 21, 2017 Share Posted July 21, 2017 Yeah so I'm very new to modding, also very new to programming. I'm making a character mod for Midoriya Izuku from My Hero Academia, and I want to add a few lines of code that make him take damage when he attacks with his fists. I raised his fist attack value to 50 and want to make him take 20 damage. I have this: inst:ListenForEvent("onattackother", function(inst, data) local handslot = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) if not handslot then inst.components health:DoDelta(-20) inst.sg:GoToState("hit") However, I do not know where to put it in my esctemplate.lua(this is made the the extended sample character template). I was told to put it in the master_postinit area of the lua file, but I don't know where that's at. This is what I have so far VVV Where would I put the above code? Quote 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/deku.zip" ), } local prefabs = { "examplefloatableitem", } -- Custom starting items local start_inv = { "examplefloatableitem", } local fn = function(inst) -- choose which sounds this character will play inst.soundsname = "wilson" -- Minimap icon inst.MiniMapEntity:SetIcon( "deku.tex" ) -- Base Stat Stuff inst.components.health:SetMaxHealth(175) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(125) -- Damage Related Stuff inst.components.combat.damagemultiplier = 1 inst.components.combat.defaultdamage = 50 inst.components.health:SetAbsorptionAmount(0) inst.components.health.fire_damage_scale = 1 -- Hunger and Sanity Stuff inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE inst.components.eater.ignoresspoilage = false inst.components.hunger:SetKillRate(1) inst.components.hunger:SetRate(1) -- Movement Stuff inst.components.locomotor.walkspeed = 4 inst.components.locomotor.runspeed = 6 end return MakePlayerCharacter("deku", prefabs, assets, fn, start_inv) (BTW Whenever I add it in anywhere that I've tried, it crashes upon launch) Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted July 22, 2017 Share Posted July 22, 2017 Not sure what you're trying to do as common_postint and master_postint are dont starve together code and were in dont starve forums. If ur trying to put that code in a dont starve mod just put it in the local fn. Other than that if ur trying dont starve together modding ull have to modify the file. So thats where the difference between the functions come in: common is used for tags and minimap code, as for master is where the rest of the characters code goes. Master had the stats perks custom functions like ur code and more is stored in. 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.