Custom Unit
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Custom Unit
Is there an abillity, or trait or something I can give a unit to make them "Anti-Drain" meaning they can't be drained?
Oh and, is there error in this? It won't work for some damned reason.
Thx.
Oh and, is there error in this? It won't work for some damned reason.
Code: Select all
[event]
name=turn 8
[filter]
side=3
[/filter]
gold=500
[/event]
"In peace, sons bury their fathers. In war, fathers bury their sons." -Herodotus
"Two things are infinite, the universe and Human stupidity. Although, I'm not sure about the universe. -Albert Einstein
"Two things are infinite, the universe and Human stupidity. Although, I'm not sure about the universe. -Albert Einstein
Re: Custom Unit
If you want to give 500 gold to side 3 on turn 8, use:
Code: Select all
[event]
name=turn 8
[gold]
side=3
amount=500
[/gold]
[/event]
Re: Custom Unit
Why thank you8680 wrote:If you want to give 500 gold to side 3 on turn 8, use:Code: Select all
[event] name=turn 8 [gold] side=3 amount=500 [/gold] [/event]
1/2 problems solved thanks to the good people of the forum.
"In peace, sons bury their fathers. In war, fathers bury their sons." -Herodotus
"Two things are infinite, the universe and Human stupidity. Although, I'm not sure about the universe. -Albert Einstein
"Two things are infinite, the universe and Human stupidity. Although, I'm not sure about the universe. -Albert Einstein
Re: Custom Unit
I'm still learning with WML, but I think this should work.
When a unit with {ABILITY_UNDRAINABLE} fights a unit with a drain attack, the undrainable unit temporarily gains not_living=yes, then loses it after the fight. In effect, it becomes undead for the duration of the fight.
Note that it will also be temporarily immune to plague and poison, though these will not trigger the effect unless they are combined with drain.
Put {ABILITY_UNDRAINABLE} in the unit file like any other ability, along with the word {UNDRAINABLE} (this must be inside [unit_type], but outside all other tags.
Put the event code into a scenario, utils or abilities file.
When a unit with {ABILITY_UNDRAINABLE} fights a unit with a drain attack, the undrainable unit temporarily gains not_living=yes, then loses it after the fight. In effect, it becomes undead for the duration of the fight.
Note that it will also be temporarily immune to plague and poison, though these will not trigger the effect unless they are combined with drain.
Put {ABILITY_UNDRAINABLE} in the unit file like any other ability, along with the word {UNDRAINABLE} (this must be inside [unit_type], but outside all other tags.
Put the event code into a scenario, utils or abilities file.
Code: Select all
#define ABILITY_UNDRAINABLE
[dummy]
id=undrainable
name= _ "undrainable"
description= _ "this unit is cannot be drained.
It will still be damaged by draining attacks, but the enemy will not gain any HP."
[/dummy]
#enddef
#define UNDRAINABLE
[event]
name=attack
first_time_only=no
[filter_attack]
special=drain
[/filter_attack]
[filter_second]
ability=undrainable
[/filter_second]
[modify_unit]
[filter]
x,y=$x2,$y2
[/filter]
[status]
not_living=yes
[/status]
[/modify_unit]
[/event]
[event]
name=attack_end
first_time_only=no
[filter_attack]
special=drain
[/filter_attack]
[filter_second]
ability=undrainable
[/filter_second]
[modify_unit]
[filter]
x,y=$x2,$y2
[/filter]
[status]
not_living=no
[/status]
[/modify_unit]
[/event]
[event]
name=attack
first_time_only=no
[filter_second_attack]
special=drain
[/filter_second_attack]
[filter]
ability=undrainable
[/filter]
[modify_unit]
[filter]
x,y=$x1,$y1
[/filter]
[status]
not_living=yes
[/status]
[/modify_unit]
[/event]
[event]
name=attack_end
first_time_only=no
[filter_second_attack]
special=drain
[/filter_second_attack]
[filter]
ability=undrainable
[/filter]
[modify_unit]
[filter]
x,y=$x1,$y1
[/filter]
[status]
not_living=no
[/status]
[/modify_unit]
[/event]
#enddef
Nothing is true; everything is permissible.
Re: Custom Unit
Appercaite it.The_Other wrote:I'm still learning with WML, but I think this should work.
When a unit with {ABILITY_UNDRAINABLE} fights a unit with a drain attack, the undrainable unit temporarily gains not_living=yes, then loses it after the fight. In effect, it becomes undead for the duration of the fight.
Note that it will also be temporarily immune to plague and poison, though these will not trigger the effect unless they are combined with drain.
Put {ABILITY_UNDRAINABLE} in the unit file like any other ability, along with the word {UNDRAINABLE} (this must be inside [unit_type], but outside all other tags.
Put the event code into a scenario, utils or abilities file.
Code: Select all
#define ABILITY_UNDRAINABLE [dummy] id=undrainable name= _ "undrainable" description= _ "this unit is cannot be drained. It will still be damaged by draining attacks, but the enemy will not gain any HP." [/dummy] #enddef #define UNDRAINABLE [event] name=attack first_time_only=no [filter_attack] special=drain [/filter_attack] [filter_second] ability=undrainable [/filter_second] [modify_unit] [filter] x,y=$x2,$y2 [/filter] [status] not_living=yes [/status] [/modify_unit] [/event] [event] name=attack_end first_time_only=no [filter_attack] special=drain [/filter_attack] [filter_second] ability=undrainable [/filter_second] [modify_unit] [filter] x,y=$x2,$y2 [/filter] [status] not_living=no [/status] [/modify_unit] [/event] [event] name=attack first_time_only=no [filter_second_attack] special=drain [/filter_second_attack] [filter] ability=undrainable [/filter] [modify_unit] [filter] x,y=$x1,$y1 [/filter] [status] not_living=yes [/status] [/modify_unit] [/event] [event] name=attack_end first_time_only=no [filter_second_attack] special=drain [/filter_second_attack] [filter] ability=undrainable [/filter] [modify_unit] [filter] x,y=$x1,$y1 [/filter] [status] not_living=no [/status] [/modify_unit] [/event] #enddef
"In peace, sons bury their fathers. In war, fathers bury their sons." -Herodotus
"Two things are infinite, the universe and Human stupidity. Although, I'm not sure about the universe. -Albert Einstein
"Two things are infinite, the universe and Human stupidity. Although, I'm not sure about the universe. -Albert Einstein
Re: Custom Unit
Added it into Useful WML Fragments (as it was originally my work).