Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I did some @hit stuff, but sphere is still doing it's own
Author Message
bmanny
Apprentice
*

Posts: 25
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2017
Reputation: 0



Post: #1
I did some @hit stuff, but sphere is still doing it's own
so, if I do...

Code:
on=@hit
LOCAL.TESTDMG = <EVAL <EVAL <ARGO.var.testdmg>>-<EVAL <SRC.var.fakearmor>>>
SRC.damage <eval <localtestdmg>>

I get the result of my weapons testdmg minus the targets fake armor and apply it as damage to the target.

The issue is that it looks like sphere is still calculating it's own damage in the background, as referenced by the floating damage text popping up.


How do I disable that? And will disabling that also disable all the nice QoL stuff like guards, criminal, invul areas, ect?
[/php][/spoiler]
05-08-2017 11:51 AM
Find all posts by this user Like Post Quote this message in a reply
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #2
RE: I did some @hit stuff, but sphere is still doing it's own
#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.

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
(This post was last modified: 05-08-2017 02:39 PM by Murmur.)
05-08-2017 02:14 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #3
RE: I did some @hit stuff, but sphere is still doing it's own
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
argn2 = <argn2> | dam_fixed

https://wiki.spherecommunity.net/index.p...le=@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,
    will only cast sounds,animations, blood, memories, attacker.n.% update and @GetHit trigger.

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.
(This post was last modified: 05-08-2017 04:56 PM by darksun84.)
05-08-2017 04:53 PM
Find all posts by this user Like Post Quote this message in a reply
bmanny
Apprentice
*

Posts: 25
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2017
Reputation: 0



Post: #4
RE: I did some @hit stuff, but sphere is still doing it's own
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.
(This post was last modified: 05-10-2017 09:50 AM by bmanny.)
05-10-2017 08:56 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #5
RE: I did some @hit stuff, but sphere is still doing it's own
If you want to override you have to add the dam_fixed flag to the argn2 value.
Code:
ON=@GetHit
//Your code calculatoion
argn2 = <argn2> | dam_fixed
argn1 +=  <local.strenghTest> + <local.tacticsTest>
Remember that skills are in the "thousand values" so 100% in a skill is treated like 1000, 50% is 500 and so on.

You can add different events to EventsPet (all npcs) and EventsPlayer in the sphere.ini
05-10-2017 08:11 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)