Author: zookeeper
Date: Tue Jul 15 21:35:24 2008
New Revision: 28046
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28046&view=rev
Log:
Converted the standard storm trident macro to use the new PICKUPPABLE_ITEM
macro.
Modified:
trunk/data/core/macros/items.cfg
Modified: trunk/data/core/macros/items.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/items.cfg?rev=28046&r1=28045&r2=28046&view=diff
==============================================================================
--- trunk/data/core/macros/items.cfg (original)
+++ trunk/data/core/macros/items.cfg Tue Jul 15 21:35:24 2008
@@ -93,6 +93,112 @@
[/item]
#enddef
+#define PICKUPPABLE_ITEM ID X Y CAN_TAKE_FILTER IMAGE MESSAGE
CANNOT_TAKE_MESSAGE OBJECT
+ # This places an item on the map which can be picked up once, but allows
the
+ # player to choose whether the unit stepping on it should take it or not.
+ # The "object" doesn't necessarily need to be an [object], any action
works.
+ #
+ # An example which shows the:
+ # ! {PICKUPPABLE_ITEM ring_of_hp 8 12 race=human items/ring-red.png
+ # ! _"$unit.name finds a pretty ring. Should he pick it up?"
+ # ! _"$unit.name finds a pretty ring. But only a human can take it!" (
+ # ! [object]
+ # ! name= _ "Ring of HP"
+ # ! image=items/ring-red.png
+ # ! description= _ "This ring grants the wearer +10 max hp!"
+ # !
+ # ! [effect]
+ # ! apply_to=hitpoints
+ # ! increase_total=10
+ # ! [/effect]
+ # ! [/object]
+ # ! )}
+
+ [item]
+ x,y={X},{Y}
+ image={IMAGE}
+ [/item]
+
+ [event]
+ name=moveto
+ first_time_only=no
+
+ [filter]
+ x,y={X},{Y}
+ [/filter]
+
+ [if]
+ [have_unit]
+ x,y={X},{Y}
+ {CAN_TAKE_FILTER}
+ [/have_unit]
+
+ [variable]
+ name=item_{ID}_picked_up
+ not_equals=yes
+ [/variable]
+
+ [then]
+ [message]
+ speaker=narrator
+ message={MESSAGE}
+ image={IMAGE}
+
+ [option]
+ message= _ "Take it"
+
+ [command]
+ {OBJECT}
+
+ [removeitem]
+ x,y={X},{Y}
+ image={IMAGE}
+ [/removeitem]
+
+ [set_variable]
+ name=item_{ID}_picked_up
+ value=yes
+ [/set_variable]
+ [/command]
+ [/option]
+
+ [option]
+ message= _ "Leave it"
+
+ [command]
+ [allow_undo]
+ [/allow_undo]
+ [/command]
+ [/option]
+ [/message]
+ [/then]
+
+ [else]
+ [if]
+ [variable]
+ name=item_{ID}_picked_up
+ not_equals=yes
+ [/variable]
+
+ [then]
+ [message]
+ speaker=narrator
+ message={CANNOT_TAKE_MESSAGE}
+ image={IMAGE}
+ for_side=$side_number
+ # the above is used to prevent an AI side from
+ # accidentally triggering this dialog
+ [/message]
+ [/then]
+ [/if]
+
+ [allow_undo]
+ [/allow_undo]
+ [/else]
+ [/if]
+ [/event]
+#enddef
+
#define OBJ_POTION_HEALING X Y ID
[item]
x={X}
@@ -407,40 +513,16 @@
#enddef
#define OBJ_TRIDENT_STORM X Y ID
- [item]
- x={X}
- y={Y}
- image=items/storm-trident.png
- [/item]
-
- [event]
- name=moveto
- first_time_only=no
- [filter]
- x={X}
- y={Y}
- [/filter]
- [object]
- id={ID}
+ {PICKUPPABLE_ITEM {ID} {X} {Y} race=merman items/storm-trident.png
_"Should $unit.name pick up the trident?" _"Only the mermen can use this item!"
(
+ [object]
name= _ "Storm Trident"
image=items/storm-trident.png
duration=forever
description= _ "This trident allows a merman to shoot electric
bolts at his enemies!"
- cannot_use_message= _ "Only the mermen can use this item!"
- [filter]
- type=Mermaid Diviner,Mermaid Enchantress,Mermaid
Initiate,Mermaid Priestess,Mermaid Siren,Merman Entangler,Merman Fighter,Merman
Hoplite,Merman Hunter,Merman Javelineer,Merman Netcaster,Merman Spearman,Merman
Triton,Merman Warrior
- x,y={X},{Y}
- [/filter]
- [then]
- [removeitem]
- x,y={X},{Y}
- [/removeitem]
- [/then]
[effect]
apply_to=new_attack
name="storm trident"
description= _ "storm trident"
- # need a better attack image, but this will do for now,
replaced fireball with lightingbolt
icon=attacks/lightning.png
type=fire
range=ranged
@@ -482,105 +564,5 @@
[/attack_anim]
[/effect]
[/object]
- [/event]
-#enddef
-
-#define PICKUPPABLE_ITEM ID X Y EXTRA_FILTER IMAGE MESSAGE CANNOT_USE_MESSAGE
OBJECT
- # This places an item on the map which can be picked up once, but allows
the
- # player to choose whether the unit stepping on it should take it or not.
- # The "object" doesn't necessarily need to be an [object], any action
works.
- #
- # Example:
- # ! {PICKUPPABLE_ITEM ring_of_hp 8 12 race=human items/ring-red.png
- # ! _"$unit.name finds a pretty ring. Should he pick it up?"
- # ! _"$unit.name finds a pretty ring. But only a human can take it!" (
- # ! [object]
- # ! name= _ "Ring of HP"
- # ! image=items/ring-red.png
- # ! description= _ "This ring grants the wearer +10 max hp!"
- # !
- # ! [effect]
- # ! apply_to=hitpoints
- # ! increase_total=10
- # ! [/effect]
- # ! [/object]
- # ! )}
-
- [item]
- x,y={X},{Y}
- image={IMAGE}
- [/item]
-
- [event]
- name=moveto
- first_time_only=no
-
- [filter]
- x,y={X},{Y}
- [/filter]
-
- [if]
- [have_unit]
- x,y={X},{Y}
- {EXTRA_FILTER}
- [/have_unit]
-
- [variable]
- name=item_{ID}_picked_up
- not_equals=yes
- [/variable]
-
- [then]
- [message]
- speaker=narrator
- message={MESSAGE}
- image={IMAGE}
-
- [option]
- message= _ "Pick it up"
-
- [command]
- {OBJECT}
-
- [removeitem]
- x,y={X},{Y}
- [/removeitem]
-
- [set_variable]
- name=item_{ID}_picked_up
- value=yes
- [/set_variable]
- [/command]
- [/option]
-
- [option]
- message= _ "Leave it"
-
- [command]
- [allow_undo][/allow_undo]
- [/command]
- [/option]
- [/message]
- [/then]
-
- [else]
- [if]
- [variable]
- name=item_{ID}_picked_up
- not_equals=yes
- [/variable]
-
- [then]
- [message]
- speaker=narrator
- message={CANNOT_USE_MESSAGE}
- image={IMAGE}
- [/message]
- [/then]
- [/if]
-
- [allow_undo][/allow_undo]
- [/else]
- [/if]
- [/event]
-#enddef
+ )}
+#enddef
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits