[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-wiki-changes] UsefulWMLFragments
From: |
wiki |
Subject: |
[Wesnoth-wiki-changes] UsefulWMLFragments |
Date: |
Tue, 16 Nov 2004 19:26 +0100 |
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
IP: 216.20.1.213
URI: http://wesnoth.slack.it/?UsefulWMLFragments
- - - - -
Index: UsefulWMLFragments
===================================================================
RCS file: /home/wesnoth/cvsroot/wikiroot/UsefulWMLFragments,v
retrieving revision 1.9
diff -u -r1.9 UsefulWMLFragments
--- UsefulWMLFragments 14 Nov 2004 17:20:23 -0000 1.9
+++ UsefulWMLFragments 16 Nov 2004 18:26:26 -0000
@@ -1,237 +1,7 @@
-A macro to create items that units can carry, that are left on the ground when
those units die.
+DroppableItem: A macro to create items that units can carry, that are left on
the ground when those units die.
-X=the starting X-location for the object
+RandomTraitUnit: A series of macros to create a unit with two random traits
(and a random name)
-Y=the starting Y-location for the object
-
-XVAR=the variable to store the item's current X-location in
-
-YVAR=the variable to store the item's current Y-location in
-
-NAME=the name of the object
-
-IMAGE=the image of the object
-
- #define DROPPABLE_ITEM X Y XVAR YVAR NAME IMAGE
- [event]
- name=prestart
-
- {VARIABLE {XVAR} {X}}
- {VARIABLE {YVAR} {Y}}
-
- [item]
- x=${XVAR}
- y=${YVAR}
- image={IMAGE}
- [/item]
-
- [event]
- name=moveto
- first_time_only=no
- [filter]
- x=${XVAR}
- y=${YVAR}
- [/filter]
-
- [event]
- name=die
- first_time_only=no
- [store_unit]
- [filter]
- x=$x1
- y=$y1
- [/filter]
- variable=itemstore
- [/store_unit]
- [if]
- [variable]
- name=itemstore.variables.{XVAR}
- equals=on
- [/variable]
- [then]
- {VARIABLE_OP {XVAR} to_variable x1}
- {VARIABLE_OP {YVAR} to_variable y1}
- [item]
- x=$x1
- y=$y1
- image={IMAGE}
- [/item]
- [/then]
- [/if]
- [/event]
-
- [removeitem]
- x=${XVAR}
- y=${YVAR}
- [/removeitem]
- [store_unit]
- variable=itemstore
- [filter]
- x=${XVAR}
- y=${YVAR}
- [/filter]
- [/store_unit]
- {VARIABLE itemstore.variables.{XVAR} on}
- [unstore_unit]
- variable=itemstore
- [/unstore_unit]
-
- {VARIABLE {XVAR} 0}
- {VARIABLE {YVAR} 0}
-
- [object]
- name={NAME}
- image={IMAGE}
- duration=forever
- [filter]
- x=${XVAR}
- y=${YVAR}
- [/filter]
- #enddef
-
- #All this should be between the DROPPABLE_ITEM macro and /DROPPABLE_ITEM
- # description="-the description-"
- # cannot_use_message="-cannot use message-"
- # [effect]
- # blahblahblah=somethingorother
- # [/effect]
-
- #define /DROPPABLE_ITEM
- [/object]
- [/event]
- [/event]
- #enddef
-
-A series of macros to create a unit with two random traits, that is,
- {RANDOM_TRAIT_UNIT (
- type=Elvish Champion
- x=20
- y=14
- )}
-will create an Elvish
-Champion with two random traits at 20,14.
-
-NOTE: To create a fully realistic unit, also add 'upkeep=full', and give it a
name. (Actually I know of no way to
-randomly generate fully realistic(to Wesnoth)
-names. However you can copy names out of names.cfg into a list for {RANDOM},
and use the result as a name. -EP)
-
- #define LOYAL
- [trait]
- id=loyal
- name= _ "loyal"
- [effect]
- apply_to=loyal
- [/effect]
- [/trait]
- #enddef
-
- #define STRONG
- [trait]
- id=strong
- name= _ "strong"
- [effect]
- apply_to=attack
- range=short
- increase_damage=1
- [/effect]
- [effect]
- apply_to=hitpoints
- increase_total=2
- heal_full=yes
- [/effect]
- [/trait]
- #enddef
-
- #define QUICK
- [trait]
- id=quick
- name= _ "quick"
- [effect]
- apply_to=movement
- increase=1
- [/effect]
- [effect]
- apply_to=hitpoints
- increase_total=-10%
- heal_full=yes
- [/effect]
- [/trait]
- #enddef
-
- #define INTELLIGENT
- [trait]
- id=intelligent
- name= _ "intelligent"
- [effect]
- apply_to=max_experience
- increase=-20%
- [/effect]
- [/trait]
- #enddef
-
- #define RESILIENT
- [trait]
- id=resilient
- name= _ "resilient"
- [effect]
- apply_to=hitpoints
- increase_total=7
- #make sure the unit starts at full health
- heal_full=yes
- [/effect]
- [/trait]
- #enddef
-
- #define TRAIT_IF NUMBER DESC TRAIT1 TRAIT2 STATS
- [if]
- [variable]
- name=random
- equals={NUMBER}
- [/variable]
- [then]
- [unit]
- {STATS}
- traits_description= _ "{DESC}"
- [modifications]
- {TRAIT1}
- {TRAIT2}
- [/modifications]
- [/unit]
- [/then]
- [/if]
- #enddef
-
- #define RANDOM_TRAIT_UNIT STATS
- {RANDOM 1..10}
- {TRAIT_IF 1 quick,resilient ({QUICK}) ({RESILIENT}) ({STATS})}
- {TRAIT_IF 2 strong,resilient ({STRONG}) ({RESILIENT}) ({STATS})}
- {TRAIT_IF 3 loyal,resilient ({LOYAL}) ({RESILIENT}) ({STATS})}
- {TRAIT_IF 4 intelligent,resilient ({INTELLIGENT}) ({RESILIENT}) ({STATS})}
- {TRAIT_IF 5 strong,quick ({STRONG}) ({QUICK}) ({STATS})}
- {TRAIT_IF 6 strong,intelligent ({STRONG}) ({INTELLIGENT}) ({STATS})}
- {TRAIT_IF 7 loyal,strong ({LOYAL}) ({STRONG}) ({STATS})}
- {TRAIT_IF 8 loyal,quick ({LOYAL}) ({QUICK}) ({STATS})}
- {TRAIT_IF 9 loyal,intelligent ({LOYAL}) ({INTELLIGENT}) ({STATS})}
- {TRAIT_IF 10 quick,intelligent ({QUICK}) ({INTELLIGENT}) ({STATS})}
- #enddef
-
-How to do have random unit names:
-
-
- # to be used like this:
- # {RANDOM_NAME}
- # [unit]
- # user_description=$randomname
- # ...
- # [/unit]
- # {CLEAR_VARIABLE randomname}
-
- #define RANDOM_NAME
- [set_variable]
- name=randomname
- random= _ "Names,Go,Here,In,A,List,Like,This"
- [/set_variable]
- #enddef
||See Also||