Originally posted by absturz:

--------------------------------------------------------------------------------------------------------------

Hi guys,
I am not sure whether to put this tutorial into the advanced modding corner or just leave it here. Wrestling with the artificial intelligence of C&C is not that easy. But, since it's a copy&paste tutorial, here we go:

The idea
An ion storm is usually bound to a map. This is: at design time of a map you must decide whether ion storms occur or not.
Why not spice up the game with an unexpected ion storm over an arctic ice map? Why not summon the god of storms whenever a player harvested too much Tiberium?
So, I played around with the AI and this is the result:

Where to use the ion storm
The ion storm will be fired by the C&C artificial intelligence. Hence it is useful only in single player missions or in skirkmish mode for multiplayer.

How to implement the ion storm
Since the AI starts the ion storm, we need a trigger, an action, a taskforce and a script in order to fire up the storm. For those who don't know anything about these expressions, I recommend my documentation about the AI engine. Just see my signature below for the correct entry point to the docs.

The trigger
You need the file AI.INI. Search the section [AITriggerTypes] and add the following trigger to it. In this example, the triggers starts an action whenever a player (or computer) has harvested more than 20000 credits. Change the condition as you like. Attention: The 2 lines below may be wrapped in your browser - they still are only 2 lines!
CODE
09000057-G=GDI money Ion Storm,09010057-G,<all>,1,4,<none>,204e000004000000000000000000000000000000000000000000000000000000,40.000000,
0.000000,40.000000,1,0,1,0,<none>,1,1,1
09000058-G=Nod money Ion Storm,09010058-G,<all>,1,4,<none>,204e000004000000000000000000000000000000000000000000000000000000,40.000000,
0.000000,40.000000,1,0,2,0,<none>,1,1,1


The action
For both parties (GDI and Nod) the trigger fires an action. Find the section [TeamTypes] and add the two actions to the end of the list. Be sure that the numbering is consecutive. Here, the numbers "445" and "446" are chosen by chance.
CODE
445=09010057-G
446=09010058-G


Below this you should then add the definition of the actions, one for GDI and one for Nod:
CODE
[09010057-G]
Name=GDI Ion Storm
House=GDI
Autocreate=no
VeteranLevel=1
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
Recruiter=no
Prebuild=no
Reinforce=no
Droppod=no
Whiner=no
LooseRecruit=yes
Aggressive=yes
Suicide=no
Priority=8
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=yes
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=yes
TaskForce=09020016-G
Script=0903002F-G

[09010058-G]
Name=Nod Ion Storm
House=Nod
Autocreate=no
VeteranLevel=1
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
Recruiter=no
Prebuild=no
Reinforce=no
Droppod=no
Whiner=no
LooseRecruit=yes
Aggressive=yes
Suicide=no
Priority=8
Max=1
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=yes
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=yes
TaskForce=09020016-G
Script=0903002F-G


The Task force
Since an action needs a taskforce we take the cheapest unit which both sides can produce: the rifle soldier [E1]. Find the section [TaskForces] and add the following entry to the end of the list. Be sure that the numbering is consecutive. Here, the number "76" is chosen by chance
CODE
76=09020016-G

Now add the definition of the taskforce below this list:
CODE
[09020016-G]
Name=Dummy: Ion Storm
0=1,E1
Group=-1


The script
I think this is what you were waiting for... Search the section [ScriptTypes] and add the following entry to the end of the list. Be sure that the numbering is consecutive. Here, the number "56" is chosen by chance
CODE
56=0903002F-G

Now, add the definition of the script below this list:
CODE
[0903002F-G]
Name=Ion Storm
0=36,0
1=24,140
2=5,400
3=32,3000
4=5,300
5=24,141
6=0,1

So, what's the secret behind the script? Let me explain every line to you:
    0=36,0 reveals the complete map
    1=24,140 "warning ion storm approaches in 5 minutes"
    2=5,400 we are waiting the 5 minutes
    3=32,3000 fire the ion storm for 1 minute
    4=5,300 wait this 1 minute
    5=24,141 "ion storm ends"
    6=0,1 let the rifle soldier run around and die
Happy modding,
absturz