2badatmodding Posted June 27, 2022 Share Posted June 27, 2022 Hi ive made a weapon and i was wondering how can i make it so after it hits the enemy it sets it on fire or freezes it Link to comment Share on other sites More sharing options...
SenL Posted June 28, 2022 Share Posted June 28, 2022 You can add SetOnAttack on the weapon component and attach a function like blue staff, or red staff (not both). Open staff.lua and go to line 513 for blue staff's. Quote inst.components.weapon:SetOnAttack(onattack_blue) Then above, onattack_blue (line 60) adds coldness(1) and this accumulates and eventually the enemy will be frozen. I think you can increase this number, but I'm not sure. Quote local function onattack_blue(inst, attacker, target) if attacker and attacker.components.sanity then attacker.components.sanity:DoDelta(-TUNING.SANITY_SUPERTINY) end if target.components.freezable then target.components.freezable:AddColdness(1) target.components.freezable:SpawnShatterFX() end if target.components.sleeper and target.components.sleeper:IsAsleep() then target.components.sleeper:WakeUp() end if target.components.burnable and target.components.burnable:IsBurning() then target.components.burnable:Extinguish() end if target.components.combat then target.components.combat:SuggestTarget(attacker) if target.sg and not target.sg:HasStateTag("frozen") and target.sg.sg.states.hit then target.sg:GoToState("hit") end end end Similarly for burning, look at red staff. Line 493 Quote inst.components.weapon:SetOnAttack(onattack_red) onattack_red line 17 Quote local function onattack_red(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) --Does this break ice staff? 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(-TUNING.SANITY_SUPERTINY) end attacker.SoundEmitter:PlaySound("dontstarve/wilson/fireball_explo") end 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.