SphereCommunity
Weapon using mana + magic animation - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Weapon using mana + magic animation (/Thread-Weapon-using-mana-magic-animation)



Weapon using mana + magic animation - GHelmet - 03-08-2014 02:50 AM

Hello, ive been working on a magic scepter that works like a bow but use mana. After i have created a new skills and placed it on him this is where i am.

[ITEMDEF i_test_scepter]
ID=i_scepter
NAME=Fire Scepter
//TYPE=t_weapon_xbow
TYPE=t_weapon_sword
RANGE=1,10
DAMFIRE=10
//SKILL=Archery
SKILL=Magic
TWOHANDS=N
WEIGHT=8
SPEED=20
VALUE=190
TAG.OVERRIDE.SOUND_HIT=snd_SPELL_FIREBALL
TAG.OVERRIDE.SOUND_MISS=snd_SPELL_FIREBALL


CATEGORY=Desolation - Test Mages
SUBSECTION=Fire
DESCRIPTION=Fire Scepter

ON=@CREATE
HITPOINTS={36 48}

From there, sound works and animation works, fighting works. Where i am struck is that i cant use TDATA 3 and 4 to make it fire magic arrow, already tryed and i dont know how to make it check your mana, and drain it on use. With a fail. If anyone got an idea for me i am all open.


RE: Weapon using mana + magic animation - Alaric - 03-08-2014 02:52 AM

I think it has been said lately. @hittry check needed mana and abort attack/or do basic attack or whatever. @hit again check if you have mana and recrease it.


RE: Weapon using mana + magic animation - GHelmet - 03-08-2014 03:11 AM

Here is what ive tryed to made, i am no programmer so i might have missed something.

ON=@HITTRY
IF (<SRC.MANA> >= 3)
<SRC.MANA> - 3

ELIF (<SRC.MANA> < 3)
SRC.SYSMESSAGE You don't have enought mana.
Return 1

ENDIF

And its not working btw. If you could help me out with a script exemple it would help me out.

Ive changed my script with information i found on another of my question. Here where i am now.


[ITEMDEF i_fire_scepter]
ID=i_scepter
NAME=Fire Scepter
//TYPE=t_weapon_xbow
TYPE=t_weapon_sword
RANGE=1,10
DAM=10
//SKILL=Archery
SKILL=Magie
TWOHANDS=N
WEIGHT=8
SPEED=20
VALUE=190
TAG.REQMANA=3
TAG.OVERRIDE.SOUND_HIT=snd_SPELL_FIREBALL
TAG.OVERRIDE.SOUND_MISS=snd_SPELL_FIREBALL

ON=@Equip
SRC.EVENTS +e_mageweaponmana
ON=@Unequip
SRC.EVENTS -e_mageweaponmana

CATEGORY=Desolation - Test Mages
SUBSECTION=Force
DESCRIPTION=Fire Scepter

ON=@CREATE
HITPOINTS={36 48}



[Events e_mageweaponmana]

ON=@HitTry
//If (<findlayer(2).baseid> == <bowid>)
If !(<MANA> > <REQMANA>)
SysMessage Not enought mana !
Return 1
EndIf
//EndIf

ON=@Hit
If ((<src.flags>&statf_stone) || (<src.region.safe>))
return 1
Else
MANA -=<REQMANA>
EndIf

Where i am now is to make work the REQMANA

And to understand this line : //If (<findlayer(2).baseid> == <bowid>)


RE: Weapon using mana + magic animation - GHelmet - 03-08-2014 04:36 AM

New update but i need more help.

[ITEMDEF i_test_scepter]
ID=i_scepter
NAME=Sceptre de feu
//TYPE=t_weapon_xbow
TYPE=t_weapon_sword
RANGE=1,10
DAM=10
//SKILL=Archery
SKILL=Magie
TWOHANDS=N
WEIGHT=8
SPEED=20
VALUE=190
TAG.REQMANA=3
TAG.OVERRIDE.SOUND_HIT=snd_SPELL_FIREBALL
TAG.OVERRIDE.SOUND_MISS=snd_SPELL_FIREBALL

ON=@Equip
SRC.EVENTS +e_mageweaponmana
ON=@Unequip
SRC.EVENTS -e_mageweaponmana

CATEGORY=Desolation - Test Mages
SUBSECTION=Force
DESCRIPTION=Sceptre de feu

ON=@CREATE
HITPOINTS={36 48}



[Events e_mageweaponmana]

ON=@HitTry
If !(<MANA> > <local.var.REQMANA>)
sysMessage @03b2,0,1 Tu n'as pas assez de mana pour attaquer!
Return 1
EndIf

ON=@Hit
SRC.EFFECT = 3,i_fx_fireball_small,6,31,0
If ((<src.flags>&statf_stone) || (<src.region.safe>))
return 1
Else
MANA - <local.var.REQMANA>
EndIf


Ok so it drain my mana but all of it, not the 3 it is supposed to. oh and my no mana msg spam the page, is there a way to make it wait 10 sec to respam ?


RE: Weapon using mana + magic animation - JohnVeritas - 03-08-2014 05:06 AM

1 - Ok so it drain my mana but all of it, not the 3 it is supposed to.

Try this,

ON=@Hit
If ((<src.flags>&statf_stone) || (<src.region.safe>))
return 1
Else
SRC.EFFECT = 3,i_fx_fireball_small,6,31,0 // changed this cuz its fit here i think.
MANA -= <local.var.REQMANA> // added " = " here it will solve your problem.
EndIf

2 - oh and my no mana msg spam the page, is there a way to make it wait 10 sec to respam ?

since you used hittry trigger for check mana, its kinda insta check when u try to attack someone. this trigger checks before attack to someone if everythink is right than weapon speed plus agility counts for hit. and i dont know, if there any simple way to check it like this.


RE: Weapon using mana + magic animation - GHelmet - 03-08-2014 05:45 AM

Ive tryed to add the = on the line but now it just dont drain any mana. i must admit i put lane of code without knowing what it should be doing. Is the Local.Var.REQmana check at the right place so for this it should be checking on the weapon. Maybe you can light me up a lantern.

Ok ive change to something more simple, each weapon will have its own event.

So this is what we got now. And now its time to make this weapon shoot fire arrow and not only put a fire effect on the enemy. Anyone got an idea how to make the weapon fire from the character to the monster ?

[ITEMDEF i_flame_scepter]
ID=i_scepter
NAME=Flame Scepter
//TYPE=t_weapon_xbow
TYPE=t_weapon_sword
RANGE=1,10
DAM=10
//SKILL=Archery
SKILL=Magie
TWOHANDS=N
WEIGHT=8
SPEED=20
VALUE=190
TAG.OVERRIDE.SOUND_HIT=snd_SPELL_FIREBALL
TAG.OVERRIDE.SOUND_MISS=snd_SPELL_FIREBALL

ON=@Equip
SRC.EVENTS +e_flamescepter
ON=@Unequip
SRC.EVENTS -e_flamescepter

CATEGORY=Desolation - Test Mages
SUBSECTION=Fire
DESCRIPTION=Flame Scepter

ON=@CREATE
HITPOINTS={36 48}



[Events e_flamescepter]
//Event for item i_flame_scepter
ON=@HitTry
If !(<MANA> >= 3)
sysMessage @03b2,0,1 Tu n'as pas assez de mana pour attaquer!
Return 1
EndIf

ON=@Hit
If ((<src.flags>&statf_stone) || (<src.region.safe>))
return 1
Else
SRC.EFFECT = 3,i_fx_fireball_small,6,31,0
MANA -= 3
EndIf


RE: Weapon using mana + magic animation - JohnVeritas - 03-08-2014 07:12 AM

Well i tought that you defined that <local.var.REQMANA> somewhere in your scripts, thats why i dont make changes on it. Btw if you want to use same event with all weapons you can simply do something like,

under @equip trigger you can set a tag. like

on @equip
..
..
.. bla bla check check
src.tag.manareq <mana req for that weapon>

on @unequip
..
.
... bla bla check check
src.cleartags manareq

so after that,

[Events e_flamescepter]
//Event for item i_flame_scepter
ON=@HitTry
If !(<MANA> >= <eval <src.tag0.manareg>>)
sysMessage @03b2,0,1 Tu n'as pas assez de mana pour attaquer!
Return 1
EndIf

ON=@Hit
If ((<src.flags>&statf_stone) || (<src.region.safe>))
return 1
Else
SRC.EFFECT = 3,i_fx_fireball_small,6,31,0
MANA -= <eval <src.tag0.manareg>>
EndIf


With this way you define mana req with a tag when player equips that weapon. You can do that every weapon to one by one or you can simply set defnames like
[defname t_weapon_sword]
on @equip
if <baseid> == i_flame_scepter
src.tag.manareq blabla
elseif <baseid> == i_flamebla
src.tag.manareq blablax
endif

etc etc.


RE: Weapon using mana + magic animation - GHelmet - 03-08-2014 07:17 AM

Thanks for the answer its really appreciated. Ill use the Tag one i think.

And for the animated fireball from the player to the target is it possible to make one of i should only have a hit effect ? Cause its way cooler when the fireball run to the enemy.


RE: Weapon using mana + magic animation - Coruja - 03-08-2014 02:21 PM

Quote:This type is used for archery weapons (bow or crossbow). It leverages the following properties:
  • MORE1L = Max hitpoints
  • MORE1H = Current hitpoints
  • MOREY = Attack bonus (percentage), but only if ATTR & attr_magic
  • TDATA1 = The sound effect the weapon makes when it shoots
  • TDATA2 = The required strength to wield the weapon
  • TDATA3 = ID of arrow item that will be fired (and must therefore be on the player's person)
  • TDATA4 = ID of the arrow animation (for bows it is usually i_arrow_x, for crossbows, i_xbow_x)
The following overrides can be set on a per item basis:
  • TAG.OVERRIDE.DAMAGETYPE = to override the types of damage this weapon does
  • TAG.OVERRIDE.SOUND_HIT = to override the sound this weapon makes when it hits
  • TAG.OVERRIDE.SOUND_MISS = to override the sound this weapon makes when it misses
  • TAG.OVERRIDE.AMMOTYPE = to override the type of ammo (TDATA3) this item uses
  • TAG.OVERRIDE.AMMOANIM = to override the ammo animation (TDATA4) this item uses
  • TAG.OVERRIDE.AMMOANIMHUE = to override the color of the ammo animation this item uses
http://wiki.sphere.torfo.org/index.php/TYPEDEF


RE: Weapon using mana + magic animation - UltimaAku - 03-29-2014 02:41 AM

So i assume the weapon becomes useless if you have no mana?

and as an option you can use:

ON=@HIT
SRC.MANA=<SRC.MANA>-3

and:

ON=@HITTRY
IF (<SRC.MANA> > 2)
RETURN 0
ELSE
sysMessage @03b2,0,1 Tu n'as pas assez de mana pour attaquer!
RETURN 1
ENDIF

Easier to work with solid figures that way.

By the way, do you want this weapon to be both melee and ranged but cost mana?