From The Mana World
(notes for implementing special actions like magic or special attacks)
 
(using attack message as it is already used for monster attacks)
Line 31: Line 31:


==Protocol:==
==Protocol:==
*Client sends '''PGMSG_USE_SPECIAL W number''' (number is the ID number of the special attack)
*Client sends '''PGMSG_ATTACK B direction W type''' ("type" is the ID number of the special attack. No number is interpreted as a normal attack)
*Server checks if the character may perform this special action
*Server checks if the character may perform this special action right now.
*If yes the server does whatever the special action requires it to do (damage beings in attack zone or whatever)
*If yes the server does whatever the special action requires it to do (damage beings in attack zone or whatever)
*Server sends '''GPMSG_USE_SPECIAL W beingID W number''' to all clients nearby
*Server sends '''GPMSG_BEING_ATTACK  W being id, B direction, W type''' to all clients nearby
*Clients respond with displaying the corresponding effects
*Clients respond with displaying the corresponding effects

Revision as of 00:04, 7 April 2008

Notes for implementing special actions like special attacks, magic or other special actions a player character can perform (emoticons?).

specials.xml

An XML file which maps special action ids to corresponding client-sided effects (particle, sound, sprite animation etc.) and server-sided effects (execute script, inflict damage in an area).

<specials>
 <action id="1">
 	<particlefx>graphics/particles/heal.particle.xml</particlefx>
 	<soundfx>sounds/heal.ogg</soundfx>
 	<saytext>HEAL!!</saytext>
 	<gameeffect
 	  area="point"
 	  position-forward="32"
 	  position-sideways="0"
 	  effect-type="heal"
 	  effect-factor="10"
 	/>
 </action>
 <action id="2">
 	<particlefx>graphics/particles/firebolt.particle.xml</particlefx>
 	<soundfx>sounds/fire.ogg</soundfx>
 	<saytext>FIREBOLT!!</saytext>
 	<gameeffect
 	  area="projectile"
 	  range="256"
 	  effect-type="damage"
 	  effect-element="fire"
 	  effect-factor="5"
 	/>
 </action>
</specials>

Protocol:

  • Client sends PGMSG_ATTACK B direction W type ("type" is the ID number of the special attack. No number is interpreted as a normal attack)
  • Server checks if the character may perform this special action right now.
  • If yes the server does whatever the special action requires it to do (damage beings in attack zone or whatever)
  • Server sends GPMSG_BEING_ATTACK W being id, B direction, W type to all clients nearby
  • Clients respond with displaying the corresponding effects