Jump to content

how can i modify firestaff?


VictorG2Ah

Recommended Posts

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
Share on other sites

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! :) 

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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.

×
  • Create New...