Delaying an action in a script

A forum to discuss custom scenarios, campaigns and modding in general.

Moderators: Slitherine Core, Panzer Corps Moderators, Panzer Corps Design

Post Reply
captainjack
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1912
Joined: Thu Sep 13, 2012 7:42 am

Delaying an action in a script

Post by captainjack »

It's easy to set a trigger (Eg capture Paris) and have an action (eg a unit appears).
Is there a simple way of delaying the action (eg a unit appears two or three turns later)?

I have a way of deferring an action until a unit has spent two or three turns in a specific location which I can adapt to create a delay but this is long winded and it's hard to believe there isn't a simpler way.
huckc
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 533
Joined: Mon Apr 24, 2017 1:38 pm
Location: USA

Re: Delaying an action in a script

Post by huckc »

It's a bit hacky and I haven't tested it but using 'counter' tags might work:

If Allied flags in Paris equals 1 then add tag "Paris1"
If Allied flags in Paris equals 1 AND Tag exists "Paris1" then add tag "Paris2"
If Allied flags in Paris equals 1 AND Tag exists "Paris2" then add tag "Paris3"

If tag exists "Paris3" then [reward]

e:
Skip Count, not the above
Last edited by huckc on Thu Jan 25, 2018 10:44 pm, edited 1 time in total.
captainjack
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1912
Joined: Thu Sep 13, 2012 7:42 am

Re: Delaying an action in a script

Post by captainjack »

Thanks for that.
It looks like a good solution.
huckc
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 533
Joined: Mon Apr 24, 2017 1:38 pm
Location: USA

Re: Delaying an action in a script

Post by huckc »

I decided to test it as I was making a few too many assumptions about the way the game scans the scripts. It worked.

Image

Had a unit trigger when the "Paris2" tag exists and it indeed showed up after two turns of taking zone 32.
huckc
Master Sergeant - U-boat
Master Sergeant - U-boat
Posts: 533
Joined: Mon Apr 24, 2017 1:38 pm
Location: USA

Re: Delaying an action in a script

Post by huckc »

Actually I just noticed the "Skip Count" box that seems to accomplish the same as the above but only one script line so much better:
Image
captainjack
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1912
Joined: Thu Sep 13, 2012 7:42 am

Re: Delaying an action in a script

Post by captainjack »

Thanks.
I'd been stuck for a while and this will help motivate me to have another go.
Post Reply

Return to “Panzer Corps : Scenario Design”