Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spells on @gethit
Author Message
Lano
Apprentice
*

Posts: 28
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Oct 2012
Reputation: 0



Post: #1
Spells on @gethit
I there, i need a little help with this:

ON=@GETHIT
IF (this is a fire spell, lets say s_explosion)
local.magicfire = <muldiv <argn1>,100,100>
local.magicfire -= <muldiv <resfire>,100,100>
src.say Fire dmg
argn1 = <eval <local.magicfire> + <local.magiccold> + <local.magicpoison> + <local.magicenergy>>
endif

I just cant seem to get the dmg output of the spell argn1..
I know that under @spelleffect argn1 is the spell type and argn2 the effect, but i am interestet in the dmg output, so my custom resistance system can work against the spell dmg output.

I just cant seem to check for the spell, nor find the dmg output.

Hope you understand it, its quite confusing to explain Smile
10-16-2012 06:41 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #2
RE: Spells on @gethit
Combat can be tricky. GETHIT happens when the player actually gets hit with a damage.
It is not the trigger used to calculate the damage...

MAGE DAMAGE - do all your calculations inside the SpellEffect Trigger.
PHP Code:
ON=@SpellEffect
    REF1
=<SERV.UID.<SRC.UID>> // Caster 
    
REF2=<SERV.UID.<UID>>      // Target
// also here in this trigger <ARGN1> is the spell no.
// Here we know the caster the target and the spellno
// do your calculations here get a total, local.DamageTotal
// then carry the damage value across to the GetHit Trigger, for example as a CTAG
REF2.CTAG.A_Mage_Damaged_Me_For=<EVAL <LOCAL.damageTotal>> 
MELEE DAMAGE - do all your calculations inside the HIT Trigger.
PHP Code:
ON=@HIT
    REF1
=<SERV.UID.<UID>>        // Attacker
    
REF2=<SERV.UID.<SRC.UID>>    // Victim
    
REF3=<SERV.UID.<ARGO.UID>>    // Weapon 0 if Fists
// here in this trigger <ARGO> is the weapon
// Here we know the attacker target and weapon
// do your calculations here get a total, local.DamageTotal
// then carry the damage value across to the GetHit Trigger, for example :
REF2.CTAG.A_Melee_Damaged_Me_For=<EVAL <LOCAL.damageTotal>> 

Then now you have the damage tagged to the person whom is getting Hit !!

PHP Code:
ON=@GETHIT
REF1
=<SERV.UID.<UID>>        // Person getting HIT
IF <REF1.CTAG0.A_Melee_Damaged_Me_For>
    
ARGN1=<EVAL <REF1.CTAG.A_Melee_Damaged_Me_For>>
    
ARGN2=dam_god // This is the damage type you can have dam_fire etc also look into it
    
ARGN3=I cant remeber what this is )
ELIF <REF1.CTAG0.A_Mage_Damaged_Me_For>
    
ARGN1=<EVAL <REF1.CTAG.A_Mage_Damaged_Me_For>>
    
ARGN2=dam_god // This is the damage type you can have dam_fire etc also look into it
    
ARGN3=I cant remeber what this is )
ELSE
    
// This should never happen.
ENDIF 

Ok so briefly now :

1. Do all your damage calculations in HIT and SPELLEFECT
2. Transfer these damages one way or another to the GETHIT Trigger
3. In the GETHIT Trigger set ARGN1 asthe damage
4. ARGN2 as the damage type
5. Set ARGN3 as 0 (I dont remeber why i did this but i have a feeling it was parry or resist)
6. NOTE:dam_fire, or dam_cold, will get resisted by resfire rescold etc but dam_god wont get resisted.


Ooops I forgot to say and its important... Remeber to remove the tags after you pass the damage !!
PHP Code:
ARGN1=<EVAL <REF1.CTAG.A_Mage_Damaged_Me_For>>
    
REF1.CTAG.A_Mage_Damaged_Me_For
(This post was last modified: 10-16-2012 08:28 PM by Barnabus.)
10-16-2012 07:08 AM
Find all posts by this user Like Post Quote this message in a reply
Lano
Apprentice
*

Posts: 28
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Oct 2012
Reputation: 0



Post: #3
RE: Spells on @gethit
Okay, i had a long bumby ride ahead of me before i had figured that one out myself Big Grin so thanks so much
10-16-2012 05:29 PM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #4
RE: Spells on @gethit
The sphere community pack has an exellent example of this..

http://code.google.com/p/sphere-communit...events.scp
10-17-2012 12:13 AM
Find all posts by this user Like Post Quote this message in a reply
Lano
Apprentice
*

Posts: 28
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Oct 2012
Reputation: 0



Post: #5
RE: Spells on @gethit
Okay call me stupid, but i still dont get it, you say:

ON=@SpellEffect
REF1=<SERV.UID.<SRC.UID>> // Caster
REF2=<SERV.UID.<UID>> // Target
// also here in this trigger <ARGN1> is the spell no.
// Here we know the caster the target and the spellno
// do your calculations here get a total, local.DamageTotal
// then carry the damage value across to the GetHit Trigger, for example as a CTAG
REF2.CTAG.A_Mage_Damaged_Me_For=<EVAL <LOCAL.damageTotal>>

Okay, but: ""// do your calculations here get a total, local.DamageTotal"" that still gives me the same problem, where is the dmg from the spell stored? ARGN1 is the spell number, ARGN2 is the spelltype/effect where is the damage stored? how do i calculate that? i have no trouble appliying the dmg to my resist system and making it..well resist it, but i have trouble locating where the dmg a spell gives is stored....

I mean...

ON=@SpellEffect
REF1=<SERV.UID.<SRC.UID>> // Caster
REF2=<SERV.UID.<UID>> // Target
IF (<argn1> == some stupid spell number i wish to add % to resist)
local.damagetotal = <eval <what? not argn1 or argn2? so what?> + <whatever i would like to add or take from that number>
REF2.CTAG.A_Mage_Damaged_Me_For=<EVAL <LOCAL.damageTotal>>
(This post was last modified: 10-17-2012 03:41 AM by Lano.)
10-17-2012 03:40 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #6
RE: Spells on @gethit
If we just look at a Spell for example spell number 51 shown below

PHP Code:
[Spell 51]
DEFNAME=s_flamestrike
NAME
=Flame Strike
SOUND
=snd_SPELL_FLAMESTRIKE
RUNES
=KVF
CAST_TIME
=3.5
RESOURCES
=i_reag_spider_silk,i_reag_sulfur_ash
RUNE_ITEM
=i_rune_FLAMESTRIKE
SCROLL_ITEM
=i_scroll_FLAMESTRIKE
FLAGS
=SPELLFLAG_TARG_OBJ|SPELLFLAG_HARMSPELLFLAG_FX_TARGSPELLFLAG_RESIST
EFFECT_ID
=03709
EFFECT=59
DURATION
=0.0
MANAUSE
=40
SKILLREQ
=MAGERY 80.0
INTERRUPT
=100.0,100.0 

We can see this spell has the flag SPELLFLAG_HARM
This means it will do damage.
The Damage on the spell is the EFFECT.

How do we access this damage from code ? <SERV.SPELL.51.EFFECT>

PHP Code:
ON=@SpellEffect
REF1
=<SERV.UID.<SRC.UID>> // Caster 
REF2=<SERV.UID.<UID>> // Target

// Check if the spell is a harmfull spell
If (<SERV.SPELL.<ARGN1>.FLAGS>&SPELLFLAG_HARM)
    
LOCAL.DAMAGE=<EVAL <SERV.SPELL.<ARGN1>.EFFECT>>
    
SERV.LOG @GETHIT <REF1.NAMEcasts <SERV.SPELL.<ARGN1>.NAMEon <REF2.NAMEdoing <EVAL <LOCAL.DAMAGE>> damage
ELSE
    
SERV.LOG @GETHIT <REF1.NAMEcasts non harmfull spell <SERV.SPELL.<ARGN1>.NAMEon <REF2.NAME>
ENDIF 

Hopefully that should make sense now, if your still confused let me know
(This post was last modified: 10-17-2012 06:01 AM by Barnabus.)
10-17-2012 05:57 AM
Find all posts by this user Like Post Quote this message in a reply
Lano
Apprentice
*

Posts: 28
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Oct 2012
Reputation: 0



Post: #7
RE: Spells on @gethit
<SERV.SPELL.<ARGN1>.EFFECT>> <----That was my mystery component.

Thanks for your patience, now i will be able to get it done.
Thanks again, always nice to have the forums to fall back to when you cant find the answer on sphere wiki Smile
(This post was last modified: 10-18-2012 03:08 AM by Lano.)
10-17-2012 05:11 PM
Find all posts by this user Like Post Quote this message in a reply
Lano
Apprentice
*

Posts: 28
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Oct 2012
Reputation: 0



Post: #8
RE: Spells on @gethit
But!

Will this not only take the excact value from the EFFECT= line?

i mean wont it always use EFFECT=59 the effect may be 59, but a low lvl mage would do less dmg with that spell, and a über monster with 300.0+ magery would do way more dmg, but we would always only be getting 59 as the output value/dmg? or am i wrong?
10-18-2012 03:09 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #9
RE: Spells on @gethit
Yes but thats were you put your calulations in

It starts as 59,

then after you calculate EvalInt Magery Int and - Resist

Depending on your calculations it will not be 59

If you just do

@GETHIT

ARGN1=59
ARGN2=Dam_God
ARGN3=0

It will just be 59....
10-18-2012 05:56 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #10
RE: Spells on @gethit
You'll need to set a tag in @spelleffect and read it through @gethit, that's the only way to really store what 'spell' was sent through, here's a quick example:
Code:
on=@spelleffect
if ( <serv.spell.<argn1>.flags> & spellflag_damage )
  tag.spell_argn=<argn1> //store the spell number
endif

on=@gethit
if ( <argn2> & 04 ) //magic damage?
  if (<serv.spell.<tag0.spell_argn>.defname>==s_fireball) //fireball?
    argn1 += <eval <eval <src.magery> *25> /100> //add damage?
  endif
endif

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
10-18-2012 07:03 AM
Visit this user's website 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)