![]() |
I did some @hit stuff, but sphere is still doing it's own - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: I did some @hit stuff, but sphere is still doing it's own (/Thread-I-did-some-hit-stuff-but-sphere-is-still-doing-it-s-own) |
I did some @hit stuff, but sphere is still doing it's own - bmanny - 05-08-2017 11:51 AM so, if I do... Code: on=@hit RE: I did some @hit stuff, but sphere is still doing it's own - Murmur - 05-08-2017 02:14 PM #1 - Where are you getting SRC.damage from (I don't see that as a valid object on the WIKI) (maybe you assigned it another value above the code you pasted)? #2 - assuming SRC.damage has been assigned by you in the code somewhere, you would change line 3 from: Code: SRC.damage <eval <localtestdmg>> to Code: SRC.damage <eval <LOCAL.TESTDMG>> Also a tip for getting help, if you aren't cutting and pasting the entire code (perhaps you did in this instance) it's definitely helpful for us to see the entire picture. And as far as overriding @HIT, as long as you don't override any variables having to do with guards, criminal, invul areas, you'll be fine, you are only overriding the specific variables, not the entire combat script from what I've seen. Hopefully someone with more knowledge will step in a confirm this, because I'm only 99% sure from my experience so far (which is super limited). I'm actually at the point of researching this for my @Hit script and looks like SRC.damage is a valid argument, so I stand corrected, no need for #1 on my first reply I just got on my whiteboard, and broke it into pieces, looks like the first part I'm doing is determining my min and max damage according to my weapon min/max damage, my character's strength and my character's weapon skill. Then once I have those two values, Ill take into account my opponents armor value and parry skill, then perform another calculation. RE: I did some @hit stuff, but sphere is still doing it's own - darksun84 - 05-08-2017 04:53 PM Using src.damage in the @hit trigger will just add the damage from src.damage to the normal hit damage, so you have to add a return 1 in the trigger. Hovewer, i think it's a bad solution and you should use, for overriding sphere's damage, the following trigger in this way: Code: ON=@GetHit https://wiki.spherecommunity.net/index.php?title=@GetHit dam_fixed means: Code: Added DAM_FIXED to sphere_defs.scp: this flag will make sphere asume that the argn1 value in @gethit is the final damage and will not do any formula calculations over it, Remember that while @Hit is fired on the attacker, @GetHit is fired on the defender. You can calculate the damage on the @Hit trigger, and in the @gethit trigger you can calculate the armour reduction, i think that you can do everything in @Hit but i like to separate the two things. RE: I did some @hit stuff, but sphere is still doing it's own - bmanny - 05-10-2017 08:56 AM Sorry guys. What I posted was pseudo code, not real code. My question then is... How do I override the ON=@GetHit event for all NPCs? What variable would I need to override to make sure sphere isn't doing it on it's own. For example. If the only calculation I want to happen is. On=@hit apply x damage. ON=@gethit Take x damage. Then, I want to expand to this. I'm not sure if it's best do do all the calculation in On=@gethit or mix it up between the two. It seems more intuitive to have all damage math happen in on=@gethit. Basically I want this: Player will have a TAG.SmartDamage On=@hit apply x damage Creature will have a TAG.Toughness On=@GetHit local.dmgTest = 0 local.StrengthTest = 0 local.TacticsTest = 0 StrengthTest = src.TAG.SmartDamage - TAG.Toughness if (StrengthTest <= 0) StrengthTest = 0 TacticsTest = src.Tactics - Tactics dmgTest = x(the applied damage from @hit) dmgTest += (StrengthTest) + TacticsTest apply dmgTest to create. RE: I did some @hit stuff, but sphere is still doing it's own - darksun84 - 05-10-2017 08:11 PM If you want to override you have to add the dam_fixed flag to the argn2 value. Code: ON=@GetHit You can add different events to EventsPet (all npcs) and EventsPlayer in the sphere.ini |