Age of Wonders II Heaven Julia with Gameplay background

Scenario Design

Control Flags

Posted by: Lonely Tower (07-22-2002) on the AOW2 Scenario Forum

"Flags" are one of the techniques that programmers employ in coding and it is basically use to keep track of whether a situation is true or false.

Think of flags as a switch -- it is either on, or it is off. Hence, you can use it to keep track if the player has achieved something.


Here's a script that set a flag to true if the player has picked up an item:

Event Type: Control Flag
Name: Control Flag (you can change it to your liking)
Activate: Once
FlagID: 1 (set it to a number other than zero)
Active: True (whether to set the flag to true or false when the event is triggered)
Trigger: Pickup Item (what triggers this event)
Players: (Keep it to default)
ItemID: 44 (change this to whatever item you are using)

Leave the conditions as it is. Basically, what you have is a script that set Flag 1 to True when the player picks up ItemID 44, the Night Cloak (You can check the ItemID by clicking on the item bag on the map). The "Activate: Once" ensures that the event will not be repeated.

There's something rather strange here. The "Active: True" does not refer to the default setting of the flag. It means "Set the flag to true" (it's a bit misleading). So, if you want to set a flag to false, change the Active setting to "false". And techically speaking, if you do that, the flag is true to begin with (though I haven't tested that...)


Next, we have a script that accuse the player of picking up the item. This script is a bit complicated, so keep a sharp mind!

Type: Show Message
Name: Show Message
Activate: Always
Players: {trigger players}
Message: You have just stolen the Night Cloak
Header: Theft detected!!
Image: 1 (Marinus' face)
Spirit: estNone (you can use this to make a deity speaks)
Trigger: New Turn
Players: {default)


So far, so good! Now, we have to explain about conditions. Heard of the term 'conditional love' before? "If you pass your examination mommy will get Age of Wonders 2 for you!" In computer speak, such a conditional love statement can be rendered as:

IF it is true that I have passed my examination THEN Mommy will get AoW2 for me.

To make it look more like a computer language:

IF pass examination=true then get AoW2 from Mommy

So you use conditions to 'control' whether an event actually happens. For example, we will not want to show the above message if the player haven't pick up the Night Cloak. Hmm...how do we know whether the player has picked up the Night Cloak??

Right, now click on the "Conditions" tab (it's at the top, next to the Main tab), and click on the NEW button. The default condition, "Area Visible" will pop up. Change it to "Flagged" (kudo points if you can guess how this is going to end). Type in a name for your condition. An example could be "Night Cloak has been picked up".

Next to the FlagID row put "1". This corrosponds to the first flag you create in the first script above. Now we can resume our scripting. Click on the Main tab and alter the conditions as below

Conditions:

And Night Cloak is Picked Up
OR (none)
OR (none)

For this to work, put a Night Cloak on the map, pick it up, end your turn and see if the message pops up.

Alright, so you think it's far easier (and smoother!) to use the "Pickup Item" trigger than to do this, but it is just an example

.

SOME COOL IDEAS ON HOW TO USE FLAGS

- You can keep track of nefarious deeds that the players have done. Did he razed the innocent halfing town just to complete the Spirit of War quest? Well, don't expect Elves or the Spirit of Nature to be too kind to you! Wait, there's more! How about giving the wayward player another quest to redeem himself that sets the flag to false?

To do this, set a flag that becomes true when the player razes the halfing town and whenever the player comes in contact with the Marinus or the like, check whether the flag is true. If yes, then Marinus will be hostile towards the player.

- Conflicting Deities. Two deities offer you a quest but you can only take one. Once the first quest is furfiled, set a flag to true and immediately cause the other quest to fail (you have to know a bit about quests first). You can also alter NPCs behaviours, random events because of this flag (for example, you have taken a Spirit of Nature quest and now your units will not trigger Divine Storms anymore)

- Create an item, such a ring, that gives 100 gold per turn to the player. Create a "New Turn" event with "Activate: Always" and check if the item is owned. Wait a moment, if we can do this, why bother with the flag? You can create a storyline that this ring is owed by a powerful wizard and he is quite mad that you have attempted to steal it. Whether you still have the ring or not doesn't matter...


Back to Event Scripting Resource Database Menu


Back to Scenario Design Main Menu

HG Logo

Headlines

» AoW1 Summer 2008 Mapmaking Tournament

» Interview Kirky Picardo

» Scenario update

» The making of...

» A new PBEM Singles Champion is crowned - Swolte!!

Poll

What unit most resembles you?

Halfling peasant

Undead Vampire

Human Knight

Tigran Prowler

Orcish Warlord

Archon Saint

Dwarven Engineer

Chaos Spawn

Results :: Other Polls

Age of Wonders

Looking for info about the original AoW?
Visit AoW Heaven!

AoWH Logo

HeavenGames Sites

» Main Portal

» Age of Empires

» Age of Empires 3

» Age of Kings

» Age of Mythology

» Age of Wonders

» Age of Wonders 2

» Battle for Middle Earth 2

» Caesar 3

» Caesar 4

» Children of the Nile

» Dungeon Siege

» Empire at War

» Empire Earth

» Emperor: RotMK

» Medieval 2: Total War

» Pharaoh

» Rise & Fall: CaW

» Rise of Legends

» Rise of Nations

» Rome: Total War

» Stronghold

» Stronghold 2

» SW: Galactic Battlegrounds

» Zeus