CarlZalph Posted June 13, 2016 Share Posted June 13, 2016 47 minutes ago, overmouse said: local ents = TheSim:FindEntities(pos.x, pos.y, pos.z, 3, nil, {"FX", "NOCLICK", "DECOR", "INLIMBO"}) for k,v in pairs(ents) do if v.components.burnable and not v.components.fueled and not v.components.burnable.lightningimmune then v.components.burnable:Ignite() end end Small niggle, but since you're excluding entities with the tag "INLIMBO" you don't need to check if they're not in limbo. Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-783398 Share on other sites More sharing options...
Arkathorn Posted June 14, 2016 Share Posted June 14, 2016 Sorry, I didn't realize that the damage was an issue. You would be better off overwriting the function in 'PlayerLightningTarget', using the same method as declaring the immutable function. Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-783659 Share on other sites More sharing options...
overmouse Posted June 14, 2016 Author Share Posted June 14, 2016 Heya guys. So i got hits from strike with this code: function SeasonManager:DoImmutableLightningStrike(pos,target,inst) local inst=GetPlayer() local lightning = SpawnPrefab("lightning") pos = Vector3(target.Transform:GetWorldPosition()) lightning.Transform:SetPosition(pos:Get()) if target then if target.components.playerlightningtarget then local mult = TUNING.ELECTRIC_WET_DAMAGE_MULT * inst.components.moisture:GetMoisturePercent() local damage = -(TUNING.LIGHTNING_DAMAGE + (mult * TUNING.LIGHTNING_DAMAGE)) inst.components.health:DoDelta(damage, false, "lightning") inst.sg:GoToState("electrocute") target.components.playerlightningtarget:DoStrike() else target:PushEvent("lightningstrike", {rod=target}) end else local ents = TheSim:FindEntities(pos.x, pos.y, pos.z, 3, nil, {"FX", "NOCLICK", "DECOR", "INLIMBO"}) for k,v in pairs(ents) do if not v:IsInLimbo() then if v.components.burnable and not v.components.fueled and not v.components.burnable.lightningimmune then v.components.burnable:Ignite() end end end end end But now i get strange bug: When character wear SnakeSkin clothes (which should defend him from lightning strike in original DS) - he got hits for 10hp. When not - hits make 20hp damage. Where's logic mistake in my code? It should allways do the normal amount of damage... Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-783897 Share on other sites More sharing options...
Arkathorn Posted June 15, 2016 Share Posted June 15, 2016 The damage is normally done in the function 'DoStrike'. This is still happening, but you are doing additional damage in the 'DoImmutableLightingStrike' code. That damage is not affected by snakeskin, but the damage from 'DoStrike' still is. Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-784077 Share on other sites More sharing options...
overmouse Posted June 16, 2016 Author Share Posted June 16, 2016 @Arkathorn mmm.. Not shure that i still understand this. You give me code, it contains target.components.playerlightningtarget:DoStrike() Then i push the button affected to SeasonManager:DoImmutableLightningStrike(pos,target,inst) and it makes DoStrike, hitting to player, ignoring rods, but not SnakeSkin. But why when i combine it with these Quote local inst=GetPlayer() local mult = TUNING.ELECTRIC_WET_DAMAGE_MULT * inst.components.moisture:GetMoisturePercent() local damage = -(TUNING.LIGHTNING_DAMAGE + (mult * TUNING.LIGHTNING_DAMAGE)) inst.components.health:DoDelta(damage, false, "lightning") inst.sg:GoToState("electrocute") - it makes additional hit trough SnakeSkin? I don't see here any calls Strike function? :/ Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-784810 Share on other sites More sharing options...
Arkathorn Posted June 16, 2016 Share Posted June 16, 2016 The call is on the following line, in the function you posted. Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-784935 Share on other sites More sharing options...
overmouse Posted June 17, 2016 Author Share Posted June 17, 2016 @@Arkathorn inst.components.health:DoDelta(damage, false, "lightning") makes damage and spawning lightning prefab. So now it looks like: function SeasonManager:DoImmutableLightningStrike(pos,target,inst) local damage = -10 local inst=GetPlayer() local lightning = SpawnPrefab("lightning") local pos = Vector3(target.Transform:GetWorldPosition()) lightning.Transform:SetPosition(pos:Get()) if target then if target.components.playerlightningtarget then inst.components.health:DoDelta(damage, false, "lightning") else target:PushEvent("lightningstrike", {rod=target}) end else local ents = TheSim:FindEntities(pos.x, pos.y, pos.z, 3, nil, {"FX", "NOCLICK", "DECOR", "INLIMBO"}) for k,v in pairs(ents) do if not v:IsInLimbo() then if v.components.burnable and not v.components.fueled and not v.components.burnable.lightningimmune then v.components.burnable:Ignite() end end end end end and all goin okay. Ignoring rods and make 10 damage from lighting, ignoring any snakeskin items on character Link to comment https://forums.kleientertainment.com/forums/topic/67948-dummy-question-about-mod/page/2/#findComment-785053 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