SphereCommunity
Extra damage vs Monster - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Extra damage vs Monster (/Thread-Extra-damage-vs-Monster)



Extra damage vs Monster - Lincoln - 12-03-2016 12:10 AM

Hello All,

Quick question!

If I wanted to make a weapon that caused extra damage towards 1 or multiple types of monsters, what is the best way of accomplishing that goal?

I put a tag on the weapon, so that if the weapon has a certain tag it is meant to cause extra damage towards a certain monster(s)

Sort of like the below

ITEMDEF i_blah_sword
name=blah sword
weight=1
type=t_weapon_sword

ON=@create
f_randomblah
tag.swordblah=(<tag.swordblah>)

on=@equip
events +e_swordboost

on=@unequip
events -e_swordboost

[function f_randomblah]
dorand 3
tag.swordblah=boo
tag.swordblah=rawr
rag.swordblah=meow
enddo

[events e_swordboost]
on=@hit
if (<tag0.swordblah>==boo)
strmatch("<src.body>","c_skeleton") || strmatch ("<src.body>","c_elem_water")
src.hits -{500 1000}
endif
if (<tag0.swordblah>==rawr)
strmatch("<src.body>","c_daemon")
src.hits -{500 1000)
endif


Sooo clearly it doesn't work!

Basically what happens now is that the sword will cause between 500 1000 damage to every monster!
What am I doing wrong (script above was just a rough thing, but same concept)

Any help would be appreciated as always!


RE: Extra damage vs Monster - Coruja - 12-03-2016 01:27 AM

probably the problem is on this line
Code:
ON=@create
f_randomblah
tag.swordblah=(<tag.swordblah>)
you set "TAG.SWORDBLAH=something" and later change to "TAG.SWORDBLAH=(something)", this will make the e_swordboost event fail because it search the tag "something" which is not the same of "(something)"

so you must remove this line "tag.swordblah=(<tag.swordblah>)" or change your e_swordboost event to include () brackets on the tag search

EDIT: you must also add [] brackets on this line ITEMDEF i_blah_sword -> [ITEMDEF i_blah_sword]


RE: Extra damage vs Monster - pointhz - 12-03-2016 01:54 AM

This also doesnt work "if (<tag0.swordblah>==boo)".

It has to be IF STRMATCH("<TAG.swordblah>","boo")


RE: Extra damage vs Monster - Ultima One - 12-03-2016 03:22 AM

(12-03-2016 01:54 AM)pointhz Wrote:  This also doesnt work "if (<tag0.swordblah>==boo)".

It has to be IF STRMATCH("<TAG.swordblah>","boo")

No need for the quotes, all that does is compare the string including the quote marks

Doing this
STRMATCH("<TAG.swordblah>","boo")

Is like doing this
STRMATCH(WOOO<TAG.swordblah>WOOO,WOOObooWOOO)