Owl's WML (Currently: Solved)
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.
Re: Owl's WML (Currently: Solved)
Code: Select all
#define FOS_ESCAPE
[set_variable]
name=rando
rand=0..8
[/set_variable]
[set_variables]
name=civescape
[literal]
value=_"On to safety."
[/literal]
[literal]
value=_"I'm getting out of here!"
[/literal]
[literal]
value=_"Thank the Imperator!"
[/literal]
[literal]
value=_"Still alive."
[/literal]
[literal]
value=_"Come on, let's go!"
[/literal]
[literal]
value=_"Good luck, Caius Regilius."
[/literal]
[literal]
value=_"Thank you for your protection"
[/literal]
[literal]
value=_"I hate Marauders..."
[/literal]
[literal]
value=_"What about my precious things? Tribune, go get them for me."
[/literal]
[/set_variables]
#enddef
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Owl's WML (Currently: Re-using [set_variable])
Each time call [set_variable] with rand.
Re: Owl's WML (Currently: Re-using [set_variable])
That code doesn't pick anything. It just sets a random variable, and creates an array. If you want the string pointed to by the variable rando, then $civescape[$rando].value is what you need.
Re: Owl's WML (Currently: Re-using [set_variable])
Thank you guys.
Yes, zookeeper, I'm using
Yes, zookeeper, I'm using
message=$civescape[$rando].value
in an event, but I'm still stuck with how to get it to set a new value for rando
each time:)Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Owl's WML (Currently: Re-using [set_variable])
I don't see what the problem is then, as the [set_variable] you have there sets rando to a random value between 0 and 8. If you want it to happen "each time", then just do it each time.UnwiseOwl wrote:Yes, zookeeper, I'm usingmessage=$civescape[$rando].value
in an event, but I'm still stuck with how to get it to set a new value forrando
each time:)
Re: Owl's WML (Currently: Weapon Specials)
The following code worked in 1.8 and 1.10 but doesn't in 1.12 and beyond.
Can anyone please advise what's gone wrong?
Can anyone please advise what's gone wrong?
Code: Select all
#define WEAPON_SPECIAL_IE_INTERRUPT
[knockback]
id=ie_interrupt
name= _ "interrupt-day only"
description=_ "When a unit is hit with an interrupting attack, combat is immediately stopped. Works only during dawn and dusk and during the day, when the sun is in the sky."
[/knockback]
[/specials]
[/attack]
[event]
name=defender hits
first_time_only=no
[filter_second_attack]
special=interrupt
[/filter_second_attack]
[filter]
[filter_location]
time_of_day_id=dawn,morning,afternoon,dusk
[/filter_location]
[/filter]
[if]
[then]
[store_unit]
[filter]
find_in=second_unit
[/filter]
variable=target
kill=yes
[/store_unit]
[/then]
[/if]
[/event]
[event]
name=attack end
first_time_only=no
[unstore_unit]
variable=target
text="interrupt"
{COLOR_HEAL}
[/unstore_unit]
{CLEAR_VARIABLE target}
[/event]
[+attack]
[+specials]
#enddef
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Re: Owl's WML (Currently: Weapon Specials)
Of course it doesn't work, because those weapon special id's don't match. It wouldn't have worked in any version.
Also, that [if] is pointless because it doesn't have any conditions.
Also, that [if] is pointless because it doesn't have any conditions.
Re: Re: Owl's WML (Currently: Weapon Specials)
Those are both very good points, and the one about this never working raises its own interesting questions for me to ask myself, as I know that it did once upon a time and I could have sworn I've not touched this file in a VERY long time.
Thanks very much, Zookeeper.
It's now working as intended, but I'm still getting lua errors, any idea what might be causing these?
The corrected weapon special code:
Thanks very much, Zookeeper.
It's now working as intended, but I'm still getting lua errors, any idea what might be causing these?
Code: Select all
20170414 22:50:31 error scripting/lua: game_error: creating unit with an empty type field
stack traceback:
[C]: in field 'create_unit'
lua/wml-tags.lua:1211: in local 'cmd'
lua/wml-utils.lua:145: in field 'handle_event_commands'
lua/wml-flow.lua:6: in function <lua/wml-flow.lua:5>
Code: Select all
#define WEAPON_SPECIAL_IE_INTERRUPT
[knockback]
id=ie_interrupt
name= _ "interrupt-day only"
description=_ "When a unit is hit with an interrupting attack, combat is immediately stopped. Works only during dawn and dusk and during the day, when the sun is in the sky."
[/knockback]
[/specials]
[/attack]
[event]
name=defender hits
first_time_only=no
[filter_second_attack]
special=ie_interrupt
[/filter_second_attack]
[filter]
[filter_location]
time_of_day_id=dawn,morning,afternoon,dusk
[/filter_location]
[/filter]
[store_unit]
[filter]
find_in=second_unit
[/filter]
variable=target
kill=yes
[/store_unit]
[/event]
[event]
name=attack end
first_time_only=no
[unstore_unit]
variable=target
text="interrupt"
{COLOR_HEAL}
[/unstore_unit]
{CLEAR_VARIABLE target}
[/event]
[+attack]
[+specials]
#enddef
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Re: Owl's WML (Currently: Weapon Specials)
Possibly from your unguarded attack end.
Edit: Wait what, ageless uses the same event. Why havent I seen the message...
Edit: Wait what, ageless uses the same event. Why havent I seen the message...
Re: Re: Owl's WML (Currently: Weapon Specials)
You're certainly right, Ravana, but I am struggling to guard it in a way that retains the information that I need to unstore the secondary unit correctly. Can anyone suggest the right way to do this?
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Re: Owl's WML (Currently: Weapon Specials)
You can add a [filter_condition] which one way or another checks (via [have_unit] or [variable], I guess) that there is actually a valid unit in the target variable. That way the event only fires when it should.
Re: Re: Owl's WML (Currently: Weapon Specials)
Thanks Zookeeper, that was exactly what I was needing.
I was trying to do the same thing with an [if] but this way is much neater and has the advantage of actually working.
Ended up looking like this:
Edit: Final version made in response to following comments (here and in discord)
I was trying to do the same thing with an [if] but this way is much neater and has the advantage of actually working.
Ended up looking like this:
Code: Select all
#define WEAPON_SPECIAL_IE_INTERRUPT
[dummy]
id=ie_interrupt
name= _ "interrupt-day only"
description=_ "When a unit is hit with an interrupting attack, combat is immediately stopped. Works only during dawn and dusk and during the day, when the sun is in the sky."
[/dummy]
[/specials]
[/attack]
[event]
id=ie_interrupt_defender_hits
name=defender hits
first_time_only=no
[filter_second_attack]
special=ie_interrupt
[/filter_second_attack]
[filter]
[filter_location]
time_of_day_id=dawn,morning,afternoon,dusk
[/filter_location]
[/filter]
[store_unit]
[filter]
find_in=second_unit
[/filter]
variable=ie_interrupt_target
kill=yes
[/store_unit]
[event]
id=ie_interrupt_attack_end
name=attack end
[unstore_unit]
variable=ie_interrupt_target
text="interrupt"
{COLOR_HEAL}
[/unstore_unit]
{CLEAR_VARIABLE ie_interrupt_target}
[/event]
[/event]
Last edited by UnwiseOwl on April 15th, 2017, 7:09 pm, edited 3 times in total.
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
Re: Re: Owl's WML (Currently: Solved)
while this will work it's still not optimal since it might spawn an infitinite number of events bloating up your savefile. Now that you changed it to an nested event you should remove the 'first_time_only=no' line.
EDIT: you might still need the '[filter_condition]' condiition tough since it's possible that tha attacker hits more than once.
EDIT2: yes with the second event now having an id the '[filter_condition]' is no longer needed.
EDIT: you might still need the '[filter_condition]' condiition tough since it's possible that tha attacker hits more than once.
EDIT2: yes with the second event now having an id the '[filter_condition]' is no longer needed.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: Owl's WML (Currently: Off-centre unit sprites)
Here's a long-standing issue that I've never been able to get to the bottom of.
Below is a picture showing the Samnis sprite from the IE. It's centred in the png file. It maps onto the hex fine, the sprite file is exactly 72x72, but in the unit information box in the sidebar it is always off-centre.
Does anybody know what could cause this?
The contents of the relevant line of the unit.cfg file are "image="units/orcs-magni/samnis.png"
Below is a picture showing the Samnis sprite from the IE. It's centred in the png file. It maps onto the hex fine, the sprite file is exactly 72x72, but in the unit information box in the sidebar it is always off-centre.
Does anybody know what could cause this?
The contents of the relevant line of the unit.cfg file are "image="units/orcs-magni/samnis.png"
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.