You must be logged in to post messages.
Please login or register

AoW2/SM Scenario Design
Moderated by Swolte, Ziggurat Mason

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Repeating Timed Event
posted 08-04-14 09:28 PM EDT (US)   
I've just started scenario editing for this awesome game, I'm pretty late to the party but AoW:SM has become a LAN favorite with my friends.

Anyway, I'm trying to spawn units every three days with the following events:

InitTimer
---------
Trigger: New Turn (Independents)
Condition:AND Day with DayMin=1, DayMax=1
Event: SetTimer with ID=13, Days=3
Activate: Once

SpawnArmy
---------
Trigger: Timer with ID=13
Event: Spawn Units (units,location, behavior set)
Activate: Once

ResetTimer
----------
Trigger: Timer w/ ID=13
Event: SetTimer w/ ID=13, Days=3
Activate: Once

This setup is causing the spawn to never occur. I think the problem might be that ResetTimer is being evaluated first when the timer initially goes off, resetting it before SpawnArmy can occur.

I can spawn units every day just fine with a New Turn trigger, but I want it to occur periodically.

Does anyone know what I'm doing wrong?

Edit:
So I found this ancient thread which says that SetTimer has an occurence error. When SetTimer is set to activate ONCE, it always acts as if it is set to activate ALWAYS.

The solution presented was to have a boolean conditional AND NOTed with the SetTimer. This boolean is set to true immediately after setting the timer so that it isn't reset every turn.

That solution works for a single use timer, but it leaves me screwed when going for a repeating timer. Additionally, that method is pretty shoddy when it comes to performance. The SetTimer will still check that conditional every single turn for the rest of the game. Maybe it's not that costly, but I don't like the solution.

I'm looking into alternate ways of counting days, since the straightforward method appears to be fundamentally broken.

Edit:
I think I can use a control counter, incrementing it once per day (on independent's turn). Then when it hits 3, I'll perform the spawn and set it back to zero.

Yup it works. Here are the events I used:

Init
----
Trigger: New Turn AND Day 1 (could set to whatever day)
Event: set counter to 0

Increment
---------
Trigger: New turn
Event: Add 1 to counter

Spawn
-----
Trigger: counter=3
Event: Spawn Units

Reset
-----
Trigger: counter=3
Event: Set counter to 0

Works splendidly!

[This message has been edited by ztarg (edited 08-05-2014 @ 01:13 AM).]

Replies:
posted 08-11-14 12:50 PM EDT (US)     1 / 1  
Hi ztarg,
1] Event : Control counter X, always
add +1
Trigger: New turn (indy)
2] Event : Spawn units (+ location), always
Trigger: Counter change
counter X (min 3, max 3)
3] Event : Control counter X, always
set counter to 1
Trigger : Counter change
counter X (min 4,Max 4)
Done !

[This message has been edited by Fanaprimo (edited 08-11-2014 @ 12:53 PM).]

Age of Wonders 2 Heaven » Forums » AoW2/SM Scenario Design » Repeating Timed Event
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Wonders 2 Heaven | HeavenGames