VictorG2Ah Posted December 26, 2018 Share Posted December 26, 2018 I am creating an elemental character of fire, he already gives spawn with the firestaff, however as it is a new character I would like to know how I can modify the firestaff so that it does not lose durability, increase the damage and when used, the character loses 10 of sanity Link to comment https://forums.kleientertainment.com/forums/topic/101104-how-can-i-modify-firestaff/ Share on other sites More sharing options...
BraveChicken Posted December 27, 2018 Share Posted December 27, 2018 (edited) To modify the firestaff, head to your modmain.lua and add it there this: GetPlayer = GLOBAL.GetPlayer AddPrefabPostInit("firestaff", function(inst) if GetPlayer().prefab == "YourCharacterHere" then inst:RemoveComponent("finiteuses") inst.components.weapon:SetDamage(15) local function onattack(inst, attacker, target) if target.components.burnable and not target.components.burnable:IsBurning() then if target.components.freezable and target.components.freezable:IsFrozen() then target.components.freezable:Unfreeze() else target.components.burnable:Ignite(true) end end if target.components.freezable then target.components.freezable:AddColdness(-1) if target.components.freezable:IsFrozen() then target.components.freezable:Unfreeze() end end if target.components.sleeper and target.components.sleeper:IsAsleep() then target.components.sleeper:WakeUp() end if target.components.combat then target.components.combat:SuggestTarget(attacker) if target.sg and target.sg.sg.states.hit then target.sg:GoToState("hit") end end if attacker and attacker.components.sanity then attacker.components.sanity:DoDelta(-10) end attacker.SoundEmitter:PlaySound("dontstarve/wilson/fireball_explo") end inst.components.weapon:SetOnAttack(onattack) end end) The 1st marked line removes from the firestaff the ability to lose durability.The 2nd marked line Gives more damage to the target. The "15" in the parenthesis shows how much additional HP your target will lose upon being hit. You can of course change it to the amount you wish the firestaff to deal by increasing/decreasing that number.The last marked line shows the amount of sanity that your character will lose with each firestaff use. Again, you can increase or decrease it if you wish, by changing the "-10" in the parenthesis. I hope this helps. Good luck! Edited December 27, 2018 by BraveChicken Link to comment https://forums.kleientertainment.com/forums/topic/101104-how-can-i-modify-firestaff/#findComment-1137024 Share on other sites More sharing options...
VictorG2Ah Posted December 28, 2018 Author Share Posted December 28, 2018 22 horas atrás, BraveChicken disse: Para modificar o firestaff, vá para o seu modmain.lua e GetPlayer = GLOBAL.GetPlayer AddPrefabPostInit (" firestaff ", função (inst) se GetPlayer (). Prefab == " YourCharacterHere " então inst: RemoveComponent ("finiteuses") inst.components.weapon: SetDamage (15) função local onattack (inst , atacante, alvo) se target.components.burnable e não target.components.burnable: IsBurning () se target.components.freezable e target.components.freezable: IsFrozen () então target.components.freezable: Unfreeze () else target.components.burnable: Ignite (true) end end if target.components.freezable then target.components.freezable: AddColdness (-1) se target.components.freezable: IsFrozen () então target.components.freezable: Unfreeze () end final se target.components.sleeper e destino .components.sleeper: IsAsleep (), em seguida, target.components.sleeper: WakeUp () end, se target.components.combat, em seguida, target.components.combat: SuggestTarget (atacante) se target.sg e target.sg.sg.states.hit, em seguida, target.sg:GoToState ("hit"), end end, se o atacante e o atacante.components. sanidade, em seguida, atacer.components.sanity: DoDelta (-10) atacante final . SoundEmitter: PlaySound ( "dontstarve / Wilson / fireball_explo") final de inst.components.weapon: SetOnAttack (onattack) extremidade final) A primeira linha marcada remove do firestaff a capacidade de perder a durabilidade. A segunda linha marcada Dá mais dano ao alvo. O " 15 " não parêntese Mostra Quanto HP Adicional Seu Alvo perderá Ao atingido sor. Você pode, naturalmente, alterar a quantidade de dados que deseja obter / diminuir esse número. A última linha marcada mostra a quantidade de saúde que seu personagem se perde com o uso de fogo. Você pode aumentar, diminuir, alterar, escolher entre -10 "entre parênteses. Eu espero que isso ajude. Boa sorte! 22 hours ago, BraveChicken said: Para modificar o firestaff, vá para o seu modmain.lua e adicione lá: GetPlayer = GLOBAL.GetPlayer AddPrefabPostInit (" firestaff ", função (inst) se GetPlayer (). Prefab == " YourCharacterHere " então inst: RemoveComponent ("finiteuses") inst.components.weapon: SetDamage (15) função local onattack (inst , atacante, alvo) se target.components.burnable e não target.components.burnable: IsBurning () se target.components.freezable e target.components.freezable: IsFrozen () então target.components.freezable: Unfreeze () else target.components.burnable: Ignite (true) end end if target.components.freezable then target.components.freezable: AddColdness (-1) se target.components.freezable: IsFrozen () então target.components.freezable: Unfreeze () end final se target.components.sleeper e destino .components.sleeper: IsAsleep (), em seguida, target.components.sleeper: WakeUp () end, se target.components.combat, em seguida, target.components.combat: SuggestTarget (atacante) se target.sg e target.sg.sg.states.hit, em seguida, target.sg:GoToState ("hit "), end end, se o atacante e o atacante.components.sanity, em seguida, atacer.components.sanity: DoDelta (-10) atacante final . SoundEmitter: PlaySound ( "dontstarve / Wilson / fireball_explo") final inst.components.weapon: SetOnAttack (onattack) extremidade final) A primeira linha marcada remove do firestaff a capacidade de perder a durabilidade. A segunda linha marcada Dá mais dano ao alvo. O " 15 " no parêntese mostra quanto HP adicional seu alvo perderá ao ser atingido. Você pode, naturalmente, alterá-lo para a quantia que deseja que a firestaff trate aumentando / diminuindo esse número. A última linha marcada mostra a quantidade de sanidade que seu personagem perderá com cada uso de fogo. Novamente, você pode aumentá-lo ou diminuí-lo, se desejar, alterando o " -10 " entre parênteses. Eu espero que isso ajude. Boa sorte! wow, thanks a lot, you really helped me a lot, just a doubt, when I want to modify some prefab in my mod just add AddPrefabPostInit or is there another mode? I'm still learning about modding, for now I'm getting some parts of other mods and modifying, I'm also using your tutorial a lot, thank you very much Link to comment https://forums.kleientertainment.com/forums/topic/101104-how-can-i-modify-firestaff/#findComment-1137300 Share on other sites More sharing options...
BraveChicken Posted December 29, 2018 Share Posted December 29, 2018 12 hours ago, VictorG2Ah said: wow, thanks a lot, you really helped me a lot, just a doubt, when I want to modify some prefab in my mod just add AddPrefabPostInit or is there another mode? Yes, the AddPrefabPostInit is basically a common way to change how some prefabs work in the game. You just use the base: AddPrefabPostInit("PrefabHere", function(inst) if GetPlayer().prefab == "YourCharacterHere" then [Your changes here] end end) The "if GetPlayer().prefab == "YourCharacterHere"" is used there to make sure that the modifications you make will work only with your character. So If you're trying to make a mod that modifies something for everyone no matter what character they pick, then you can just use this base instead: AddPrefabPostInit("PrefabHere", function(inst) [Your changes here] end) Link to comment https://forums.kleientertainment.com/forums/topic/101104-how-can-i-modify-firestaff/#findComment-1137444 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