Skip to content

Commit

Permalink
Converted the standard storm trident macro...
Browse files Browse the repository at this point in the history
...to use the new PICKUPPABLE_ITEM macro.
  • Loading branch information
ln-zookeeper committed Jul 15, 2008
1 parent e2d1b37 commit 613dd43
Showing 1 changed file with 108 additions and 126 deletions.
234 changes: 108 additions & 126 deletions data/core/macros/items.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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]
{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]
id={ID}
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
Expand Down Expand Up @@ -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

0 comments on commit 613dd43

Please sign in to comment.