show_objectives not keeping up
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
- Spannerbag
- Posts: 534
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
show_objectives not keeping up
In between bigger projects I foolishly decided to do a quick, small little campaign which has ended up causing me various difficulties.
There's one I really can't properly nail down though:
In scenario 1 (complete, playable AFAIK) player has side one with leader Zigmund.
In scenario 2 in prestart Zigmund is killed (I do this to preserve the side's recall list etc.) but stored in a variable.
Side 1 has controller=human but no units and is (I guess) considered defeated by the game engine.
Side 2 is also player controlled (new leader Elleth)
Side 3 is ai (default settings, at least for now)
FWIW here's the side setups
Objectives are setup in start event, also included prestart to show how Zigmund is stored
Now on turn 6 Zigmund is unstored and various stuff happens (don't worry about the filter condition, there is an alternative - presently untested - event with condition
Now at the end of this event, right after
but it displayed the old objectives as if Zigmund was not present.
So I moved the code to a separate event that fires right after the one above in case the engine was getting ahead of itself:
Still no joy (screen grab below, Zigmund is the Red Mage):
All tests that rely on other units fail; two
As far as I can see the engine hasn't yet registered the new units?
Now, I can force the objectives to work by simply assigning a string variable and displaying that, but I would prefer to get this working properly if possible. Sooo... what am I getting wrong?
If it helps I can post the entire work in progress on the add-ons server (there are only 2 scenarios so far)...
Any thoughts greatly appreciated!
Cheers,
-- Spannerbag
There's one I really can't properly nail down though:
[show objectives]
. The setup is this:In scenario 1 (complete, playable AFAIK) player has side one with leader Zigmund.
In scenario 2 in prestart Zigmund is killed (I do this to preserve the side's recall list etc.) but stored in a variable.
Side 1 has controller=human but no units and is (I guess) considered defeated by the game engine.
Side 2 is also player controlled (new leader Elleth)
Side 3 is ai (default settings, at least for now)
FWIW here's the side setups
Code: Select all
# Zigmund
# Without starting with Zigmund, side 1 is empty and has no recall list
# so appears here then is stored until appearance later
[side]
team_name=Zigmund
user_team_name=_"Zigmund"
side=1
controller=human
color=red
{ZIGMUND}
x,y=1,14 # Doesn't matter; removed in prestart
recruit=Mage
gold=0 # +Carryover
{NO_INCOME}
hidden=yes
[/side]
# Elleth
[side]
side=2
team_name=Elleth
user_team_name= _ "Outlaw Outlaws"
x,y=24,2
{ELLETH}
controller=human
recruit=Thief
color=blue
gold=0
{FLAG_VARIANT ragged}
[/side]
# Enemy
[side]
side=3
team_name=Outlaws
user_team_name= _ "Outlaws"
x,y=25,3
name=_"Klout"
id=Klout
unrenamable=yes
type=Bandit
canrecruit=yes
[modifications]
{TRAIT_STRONG}
{TRAIT_RESILIENT}
[/modifications]
controller=ai
recruit=Thug
color=orange
{FLAG_VARIANT ragged}
{GOLD 40 50 60} # Want continuous recruitment rather than an initial rush then nothing
{INCOME 6 9 11}
{UNIT 3 Thug 24 3 (generate_name=yes
random_traits=yes
[modifications] # Not quick
{TRAIT_RESILIENT}
{TRAIT_INTELLIGENT}
[/modifications]
upkeep=full)}
{UNIT 3 Thug 25 2 (generate_name=yes
random_traits=yes
[modifications] # To ensure player gets a move on
{TRAIT_QUICK}
[/modifications]
upkeep=full)}
[/side]
Code: Select all
# Start of game
[event]
name=start
[objectives]
side=1,2
[objective]
description= _ "Defeat Klout"
condition=win
[show_if]
[have_unit]
id=Zigmund
[/have_unit]
[/show_if]
[/objective]
[objective]
description= _ "Keep Elleth alive"
condition=win
[show_if]
[have_unit]
id=Zigmund
count=0
[/have_unit]
[/show_if]
[/objective]
{OBJ_HERO_DEATHS}
[objective]
description= _ "Turns run out"
condition=lose
show_turn_counter=yes
[show_if]
[have_unit]
id=Zigmund
[/have_unit]
[/show_if]
[/objective]
{OBJ_CARRYOVER}
[note]
description= _ "Elleth and Zigmund recruit different units."
[show_if]
[have_unit]
id=Elleth
side=1
[/have_unit]
[/show_if]
[/note]
[/objectives]
[/event]
Code: Select all
# Setup initial conditions
[event]
name=prestart
[label]
{EKEEPXY}
text= _ "Elleth's Keep"
[/label]
#ifdef EASY
[terrain] # Elleth gets an extra castle hex EASY
x,y=5,8
terrain=Ce
[/terrain]
#endif
[capture_village]
side=3
terrain=*^V*
[/capture_village]
[store_unit]
variable=zigmund_02
[filter]
id=Zigmund
[/filter]
kill=no # Do not fire die event (=defeat)
[/store_unit]
[kill]
id=Zigmund
animate=no
fire_event=no
[/kill]
[/event]
{VARIABLE_CONDITIONAL Ovine_survived not_equals yes}
Code: Select all
# --- Mages arrive ---
#
# Two versions:
# If Ovine survived Mages spot the first Thugs nest
# Otherwise they blunder into an ambush
#
# Ovine survived
[event]
name=side 1 turn 6
[filter_condition]
{VARIABLE_CONDITIONAL Ovine_survived equals yes}
[/filter_condition]
[unstore_unit]
variable=zigmund_02
x,y=10,13
animate=yes
[/unstore_unit]
{CLEAR_VARIABLE zigmund_02}
[modify_side]
side=1
hidden=no
income=0 # Was -2
[/modify_side]
{RECALL_XY Alis 10 12}
[store_unit]
variable=unrecalled
[filter]
x,y=recall,recall
side=1
[/filter]
[/store_unit]
[foreach]
array=unrecalled
[do]
[switch]
variable=i
[case]
value=0
{RECALL_XY $this_item.id 9 13}
[/case]
[case]
value=1
{RECALL_XY $this_item.id 9 14}
[/case]
[else] # Max. 3 units (on EASY)
{RECALL_XY $this_item.id 8 13}
[/else]
[/switch]
[/do]
[/foreach]
[modify_turns]
value=30
# value={ON_DIFFICULTY 33 30 27}
[/modify_turns]
[message]
speaker=Zigmund
message={WHISPER (_"Can you hear fighting in the distance?")}
[/message]
[message]
speaker=Alis
message={WHISPER (_"Yes, <i>and</i> voices nearby. I'll have a closer look...")}
[/message]
{MOVE_UNIT id=Alis 12 11}
{DELAY}
{GENERIC_UNIT 3 Thug 11 11}
{FACING ne}
{GENERIC_UNIT 3 Thug 12 10}
{FACING ne}
{GENERIC_UNIT 3 Thug 11 10}
{FACING ne}
{MODIFY_UNIT x,y=11,11 facing ne}
[message]
x,y=11,11
message=_"Wish I was helpin' snot that sneak! Bet she's got gold. We're missin' out!"
[/message]
{MODIFY_UNIT x,y=12,10 facing sw}
[message]
x,y=12,10
image_pos=right
mirror=yes
message=_"P'raps, but she's tricksy. It's safer ter be here, lyin' in wait fer unwary travellers. They're easy and we get a cut of the loot."
[/message]
{MODIFY_UNIT (x=12,10
y=11,10) facing ne}
{DELAY}
{MOVE_UNIT id=Alis 10 12}
[message]
speaker=Alis
message={WHISPER (_"There's a band of robbers in those trees waiting to waylay travellers like us!
Thank goodness we were being quiet and they were distracted: seems they're watching other outlaws fight amongst themselves?")}
[/message]
[message]
speaker=Zigmund
message={WHISPER (_"Good! If they're killing each other then there are fewer for us to worry about. Let's fight our way through!")}
[/message]
{CLEAR_VARIABLE unrecalled}
[/event]
{CLEAR_VARIABLE unrecalled}
I inserted [show_objectives]
[/show_objectives]
but it displayed the old objectives as if Zigmund was not present.
So I moved the code to a separate event that fires right after the one above in case the engine was getting ahead of itself:
Code: Select all
#
# Try to persuade objectives to display the right options
[event]
name=side 1 turn 6 refresh
[show_objectives]
[/show_objectives]
[/event]
Death of...
defeat conditions are also missing.As far as I can see the engine hasn't yet registered the new units?
Now, I can force the objectives to work by simply assigning a string variable and displaying that, but I would prefer to get this working properly if possible. Sooo... what am I getting wrong?
If it helps I can post the entire work in progress on the add-ons server (there are only 2 scenarios so far)...
Any thoughts greatly appreciated!
Cheers,
-- Spannerbag
- Spannerbag
- Posts: 534
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: show_objectives not keeping up ** update **
Weird,
just tried to assign a variable with the correct text string and although the text string updated the objectives still didn't display the new value when
So it seems the objectives themselves are somehow stuck?
Anyway I've reverted back to the
Next thing to try I suppose is to creat an entirely new
just tried to assign a variable with the correct text string and although the text string updated the objectives still didn't display the new value when
[show_objectives]
executed.So it seems the objectives themselves are somehow stuck?
Anyway I've reverted back to the
[show_if]
version for now and will worry about it later.Next thing to try I suppose is to creat an entirely new
[objectives]
statement... but I'll wait to see what folks cleverer than me come up with first - Spannerbag
- Posts: 534
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: show_objectives *** now working ??? ***
Well, resumed work on the scenario mainly balancing (added
I almost missed it but the objectives now worked? My PC was rebooted so if objectives stop working again I'll try purging the cache and if that doesn't work, reboot and see what that does. If anyone has any thoughts I'd be really interested to hear them as I don't know what I've done to fix things...
Cheers,
--Spannerbag
{LIMIT_CONTEMPORANEOUS_RECRUITS...}
, tweaked dialogue, starting gold, income etc. and also reverted objectives back by removing the text variable method, moving [show_objectives]
back to the end of the turn event (rather than the refresh event) and reverted objectives by uncommenting the original code that I'd commented out rather than deleting.I almost missed it but the objectives now worked? My PC was rebooted so if objectives stop working again I'll try purging the cache and if that doesn't work, reboot and see what that does. If anyone has any thoughts I'd be really interested to hear them as I don't know what I've done to fix things...
Cheers,
--Spannerbag