THE "FritzScript" SYSTEM:
The script system is a very flexible, simple to use extension to the action system. With it, you are allowed to turn "on" or "off" actions at will, create new paths for the bots, etc, etc.
HOW IT WORKS:
Its based inside a ".aiscript" file based on the map name. EX: mp_beach would be mp_beach.aiscript.
Its based on events, and the actions associated with them, in the game.
For example, if action "0" is a dynamite action. When the wall blows, the bot event handling system will look for any scripts that are associated with action "0".
The events that can trigger a script:
1. Dynamite exploding on an obj
2. Spawn/CapturePoint flag being taken.
3. Docs/Obj being stolen.
Any actions linked to these event types will trigger its associated script.
The first keyword in an script file MUST be "MAPTYPE" followed by the maptype integer.
There are 3 possible values
0 = Objective Gametype
1 = Dual Objective Gametype (Depot is an example of this)
2 = Capture Point Gametype
The end of the script file MUST end if the #EOF keyword to let the system know there are no more scripts to define.
The script is VERY particular about spelling and correct syntax, but is case insensitive. I only use case in the .aiscript as a personal preference to make it more "readable". There is some fairly good error recovery, but it won't catch logic errors or do the thinking for you.
A simple example script that could be used for MP_BEACH is attached at the end of the thread. NOTE: I only added on the .txt extension so that it could be handled by the forum.
ex: here is the action script for the door on beach, which is action "0":
Code:
action 0 // The sea wall door "dynamite" action
{
node_connect 17 129 true //create a path for the bots
openNodeGrpToTeam 1 ALLIES // allies can use the bunker nodes now!
bot_switchToWeap random allies //allied soldiers will mix up weapons!
bot_switchToWeap random_f axis // so will axis
deactivateAction 33 // deactivate the roam by the wall breach no matter what
}
What the different keywords mean will be explained later, but as you can see - you define a script for an action simply by using the "action" keyword, followed by the number of the action, then wrap everything in {}.
FritzScript keywords and their parameters:
node_connect <node1> <node2> <true/false>
The node connect keyword works nearly exactly like the "node_connect" console cmd, with one major difference - if you want the two nodes to automatically connect to each other, follow the last node with a true. If you want a one way connection, follow with a false.
ex:
You want to create a one way path between nodes 4 and 5, then use this:
node_connect 4 5 false
OR
You want to create a two way path between nodes 90 and 100:
node_connect 90 100 true
======
"openNodeGrpToTeam"
This is for the "group ID" that was mentioned earlier for nodes (NOT actions!!!).
EX: on beach at map start, all of the nodes that are on the other side of the wall are not available to the allies. But, when one of the walls blow, they become available. By making all of the nodes in the bunker be a part of group 1, you can quickly open them to the allied team in the script all at once, without any other work needed.
======
"bot_switchToWeap"
bot_switchToWeap <weapType> <team>
weapType is one of these values:
"panzer" = panzerfaust
"flame" = flamethrower
"sniper" = sniper rifle
"smg" = country specific smg (thompson or mp40).
"venom" = venom
"random" = either the smg or the venom, randomly chosen
"random_f" = either the smg, venom, or flame.
"random_p" = either the smg, venom, or panzer
"random_pf" -OR- "random_fp" = either the smg, venom, panzer or flame
team is either:
"axis"
OR
"allies"
NOTE: this cmd will affect ALL soldiers on that team, so be aware of that!
======
"resetNodeFlag"
resetNodeFlag <nodeNum> <flagValue>
sets nodeNum's flag to flagValue
ex:
If node 14 is a jump node, but after a wall blows, a bridge is made that make 14 no longer be a jump node, you can reset it to a normal path node.
resetNodeFlag 14 0
======
"activateAction" -OR- "deactivateAction"
These two are the mirror opposites of each other.
When called, they either turn "on" or turn "off" whatever action you want.
Only use this for special actions you want to create.
--------------------------------------------------------------------------
CONDITIONALS
You are able to make an action script conditional based on other actions being completed (or not completed).
Keywords:
"if_action_true"
"if_action_false"
"if_fda_owner_axis"
"if_fda_owner_allies"
"if_OBJ_home_true"
"if_OBJ_home_false"
You may NOT stack (or nest) these conditonal tests. If you have multiple conditonal tests, you MUST use the condtional keyword for each one.
EX:
On beach, if the wall breach blows, but not the door, you may want the bots to camp near the wall breach, to jump you as you run thru it. Once the door blows tho, that camp action would be unneeded. So, lets say the the dynamite action for the wall breach is action 1. You would create a script like so:
Code:
action 1 // The sea wall breach "dynamite" action
{
node_connect 35 259 true
openNodeGrpToTeam 1 ALLIES
bot_switchToWeap random allies
bot_switchToWeap random_f axis
if_action_false 0 // if the door hasn't blown yet, activate roam by wall breach!
activateAction 33 //have axis gun down allies coming thru the breach!
}
The other two keywords are based on who is controlling the forward spawn flag. The "if_fda_ower_allies/axis" keywords MUST have the action that is in question following it.
EX: in beach, the action for the flag is 42. If the axis control it, I want the axis bots to roam out near the beach to harass the allies when they spawn, if the allies control it, I don't want them doing this. So I define a script for 42 like so:
Code:
action 42 // The Forward Spawn Flag action
{
if_fda_owner_axis 42 //if axis grab flag, activate the "roam" actionr
activateAction 32 //action 32 is an axis owned action
if_fda_owner_allies 42 //if allies grab flag, deactivate the "roam" action!
deactivateAction 32 //action 32 is an axis owned action
}
The possibilities with this system are limitless!!