|
Scenario Design
Scripting Database
SHADOW MAGIC SCRIPTING
Scripting Database
A Custom AI Block Using the "Teleport" Event
Posted by: Lonely Tower on the
AOW2 Scenario Forum
Expanded by Talon-Thorn
Outline:
Specified player (AI and human controlled) and independent units can not pass blocked hexagons. Units are teleported back
when they try to enter the specified hexagons. Event can be modified to allow blockage to be disabled for specific players or
the indepdendents.
Scripts:
Basically, the block works by detecting when an army enters the restricted hexagon, and then teleports the army to a destination away from
the blocked area. It may be necessary to set up one teleport event on each side of a path to be sure the armies are teleported "back" in the
right direction.
Setup:
Be aware that the teleport event will not teleport units to a location if it already contains units owned by the same player and
the combined number of units will exceed eight. The teleport even also will give a human player the option to cancel the move if there
are enemy units located at the target hexagon. Any of these events will cause the teleport event to fail, allowing units to move into
the "blocked" hexagon. See below for a suggestion of how to prevent blocking of the teleport event.
Details:
All events are set to occur "Always"
Event Type: Teleport
Player: Trigger player
Location: {coordinate of the blocked area}
Destination: {anywhere you deem fit}
Trigger Type:Enter Area
Player: {select all players and independents as desired}
Location: {coordinate of the blocked area}
Conditions: Add any conditions here to allow the block to be disabled.
Limited Blocks:
To make a block limited based on time or some other event, simply create a "Control Flag" event that sets a
flag to true when some trigger is set off, and add a "AND NOT Flagged" condition to the "blocker" teleport event. For example,
to limit the block to 100 days, set up a script with a "Timer" trigger that will count 100 days, with a "Control Flag" event which
sets the flag value to "True." Similarly, to cancel the block when a quest is completed, create a quest script that has a reward
that sets the flag to "True."
How To Prevent The Teleport From Being Blocked:
One way to prevent the teleport event from being blocked is to have two teleport events, one to a holding site, and one from the
holding site to the destination site. The holding site should be some place that can not be accessed (like a hole in the underground
area). Make two additional events that will occur on "New Turn"; one will change the terrain at the holding site to shadowvoid, and the
other will then change the terrain back to the default terrain type.
Any unit entering the blocked site will be teleported to the holding site, then teleported to the destination site. If the units do
not get teleported to the destination site for some reason, they will remain at the holding site and be destroyed first thing, the next day.
Back to Event Scripting Resource Database Menu
BACK TO SCENARIO DESIGN MAIN MENU
|