The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weapon using mana + magic animation
Author Message
GHelmet
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2014
Reputation: 0



Post: #1
Weapon using mana + magic animation
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.
(This post was last modified: 03-08-2014 02:50 AM by GHelmet.)
03-08-2014 02:50 AM
Find all posts by this user Like Post Quote this message in a reply
Alaric
Journeyman
*

Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7



Post: #2
RE: Weapon using mana + magic animation
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.
03-08-2014 02:52 AM
Find all posts by this user Like Post Quote this message in a reply
GHelmet
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2014
Reputation: 0



Post: #3
RE: Weapon using mana + magic animation
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>)
(This post was last modified: 03-08-2014 03:57 AM by GHelmet.)
03-08-2014 03:11 AM
Find all posts by this user Like Post Quote this message in a reply
GHelmet
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2014
Reputation: 0



Post: #4
RE: Weapon using mana + magic animation
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 ?
03-08-2014 04:36 AM
Find all posts by this user Like Post Quote this message in a reply
JohnVeritas
Apprentice
*

Posts: 49
Likes Given: 0
Likes Received: 4 in 4 posts
Joined: Feb 2014
Reputation: 2



Post: #5
RE: Weapon using mana + magic animation
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.
03-08-2014 05:06 AM
Find all posts by this user Like Post Quote this message in a reply
GHelmet
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2014
Reputation: 0



Post: #6
RE: Weapon using mana + magic animation
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
(This post was last modified: 03-08-2014 05:55 AM by GHelmet.)
03-08-2014 05:45 AM
Find all posts by this user Like Post Quote this message in a reply
JohnVeritas
Apprentice
*

Posts: 49
Likes Given: 0
Likes Received: 4 in 4 posts
Joined: Feb 2014
Reputation: 2



Post: #7
RE: Weapon using mana + magic animation
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.
(This post was last modified: 03-08-2014 07:14 AM by JohnVeritas.)
03-08-2014 07:12 AM
Find all posts by this user Like Post Quote this message in a reply
GHelmet
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2014
Reputation: 0



Post: #8
RE: Weapon using mana + magic animation
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.
03-08-2014 07:17 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #9
RE: Weapon using mana + magic animation
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
03-08-2014 02:21 PM
Find all posts by this user Like Post Quote this message in a reply
UltimaAku
Journeyman
*

Posts: 125
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 1



Post: #10
RE: Weapon using mana + magic animation
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?
(This post was last modified: 03-29-2014 02:44 AM by UltimaAku.)
03-29-2014 02:41 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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