slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
Would someone be willing to explain to me how to set up random timers for random attacks throughout the game?
I noticed in TerrainCreators map Operation Toxin that he/she has set up random timers and counters but I am unable to discern how they work. They are all, or near all, subroutines but I am unable to find the activating scripts, or teams who activate them.
I would greatly appreciate any and all assistance in this matter.
Sponsor
acidbrain
10 years ago
What about this method, AI picks 1 from 3 teams and when the team is killed the cycle starts again.

RA->Random Attack




[ns A D][E N H]RA_Run
*** IF ***
True.
*** THEN ***
Set 'RA' to 0
Set timer 'RA_Rand' to expire between 0 and 60 frames.
Set timer 'RA_1' to expire in 20 frames.
Set timer 'RA_2' to expire in 40 frames.
Enable Script 'RA_1_Exp'.



[ns na D][E N H]RA_1_Exp
*** IF ***
Timer 'RA_1' has expired.
*** THEN ***
Enable Script 'RA_1?'.



[ns na D][E N H]RA_1?
*** IF ***
Timer 'RA_Rand' has expired.
*** THEN ***
Set 'RA' to 1
*** ELSE ***
Enable Script 'RA_2_Exp'.



[ns na D][E N H]RA_2_Exp
*** IF ***
Timer 'RA_2' has expired.
*** THEN ***
Enable Script 'RA_2 OR 3?'.



[ns na D][E N H]RA_2 OR 3?
*** IF ***
Timer 'RA_Rand' has expired.
*** THEN ***
Set 'RA' to 2
*** ELSE ***
Set 'RA' to 3



[S A nd][E N H]RA_1_Build
*** IF ***
Counter 'RA' IS Equal To 1
*** THEN ***
Null operation. (Does nothing.)



[S A nd][E N H]RA_2_Build
*** IF ***
Counter 'RA' IS Equal To 2
*** THEN ***
Null operation. (Does nothing.)



[S A nd][E N H]RA_3_Build
*** IF ***
Counter 'RA' IS Equal To 3
*** THEN ***
Null operation. (Does nothing.)



[S A nd][E N H]RA_Team KIA
*** IF ***
True.
*** THEN ***
Enable Script 'RA_Run



Panem et kirkinses
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
Thats excellent, I like the idea.
Having a bit of trouble wrapping my brain around it tho...
Ill see if I can figure it out.
Thankyou
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
About the RA_1_Build subroutine(s), how are they implemented?
acidbrain
10 years ago
I made a test map for you so you can check out where all the scripts are placed.
You play as China and the AI is America, the AI picks 1 from 3 teams and the team starts hunting when created, a militairy briefing shows which team is picked by America.

Notice that the production condition script executes every time a unit is build except for the last one, the On Create script is executed than, so be carefull with what you execute in the build conditions.

I also changed the scripts a bit



// INITIALIZE AND RUN \\

[ns A D][E N H]RA_Init

*** IF ***
True.
*** THEN ***
Set 'RA_Team' to 0
Enable Script 'RA_Run'.


// RANDOMIZER \\

[ns na D][E N H]RA_Run

*** IF ***
True.
*** THEN ***
Set timer 'RA_Random' to expire between 0.00 and 3.00 seconds.
Set timer 'RA_1' to expire in 1.00 seconds.
Set timer 'RA_2' to expire in 2.00 seconds.
Enable Script 'RA_1_Expired'.


[ns na D][E N H]RA_1_Expired

*** IF ***
Timer 'RA_1' has expired.
*** THEN ***
Enable Script 'RA_1?'.


[ns na D][E N H]RA_1?

*** IF ***
Timer 'RA_Random' has expired.
*** THEN ***
Set 'RA_Team' to 1
*** ELSE ***
Enable Script 'RA_2_Expired'.


[ns na D][E N H]RA_2_Expired

*** IF ***
Timer 'RA_2' has expired.
*** THEN ***
Enable Script 'RA_2 OR 3?'.


[ns na D][E N H]RA_2 OR 3?

*** IF ***
Timer 'RA_Random' has expired.
*** THEN ***
Set 'RA_Team' to 2
*** ELSE ***
Set 'RA_Team' to 3


// TEAM PRODUCTION CONDITIONS \\

[S A nd][E N H]RA_1_Build

*** IF ***
Counter 'RA_Team' IS Equal To 1
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:01' for 4000 milliseconds.
Team '' begins guarding.


[S A nd][E N H]RA_2_Build

*** IF ***
Counter 'RA_Team' IS Equal To 2
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:02' for 4000 milliseconds.
Team '' begins guarding.


[S A nd][E N H]RA_3_Build

*** IF ***
Counter 'RA_Team' IS Equal To 3
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:03' for 4000 milliseconds.
Team '' begins guarding.


// TEAM BEHAVIOR \\

[S A nd][E N H]RA_On Create

*** IF ***
True.
*** THEN ***
Team '' begins hunting.


[S A nd][E N H]RA_KIA

*** IF ***
True.
*** THEN ***
Enable Script 'RA_Run




Strings for the militairy briefing:

RA:01
"Team 1 is building"
End

RA:02
"Team 2 is building"
End

RA:03
"Team 3 is building"
End
  Random Attack Test Map.rar (5kb) downloaded 8 time(s).
Panem et kirkinses
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
Awesome, thankyou.
The only problem is that I cannot open .rar files. Ive tried in the past and it just wont work for me, sorry.
acidbrain
10 years ago

Awesome, thankyou.
The only problem is that I cannot open .rar files. Ive tried in the past and it just wont work for me, sorry.

Originally Posted by: Slird 


convertfiles.com 

Made some additions to the test map, the ai picks 1 of 5 teams now and when the team is created the ai picks a random attack path, a militairy briefing will show which team the ai has picked and which path the ai uses to attack.

Here are the scripts



// INITIALIZE AND RUN \\


[ns A D][E N H]RA_Init

*** IF ***
True.
*** THEN ***
Set 'RA_Team' to 0
Set 'RA_Path' to 0
Set timer 'RA_Delay' to expire in 0.01 seconds.
Enable Script 'RA_Run'.


// TEAM RANDOMIZER \\


[ns na D][E N H]RA_Run

*** IF ***
Timer 'RA_Delay' has expired.
*** THEN ***
Set timer 'RA_Random' to expire between 0 and 100 frames.
Set timer 'RA_1' to expire in 20 frames.
Set timer 'RA_2' to expire in 40 frames.
Set timer 'RA_3' to expire in 60 frames.
Set timer 'RA_4' to expire in 80 frames.
Enable Script 'RA_1_Expired'.


[ns na D][E N H]RA_1_Expired

*** IF ***
Timer 'RA_1' has expired.
*** THEN ***
Enable Script 'RA_1?'.


[ns na D][E N H]RA_1?

*** IF ***
Timer 'RA_Random' has expired.
*** THEN ***
Set 'RA_Team' to 1
*** ELSE ***
Enable Script 'RA_2_Expired'.


[ns na D][E N H]RA_2_Expired

*** IF ***
Timer 'RA_2' has expired.
*** THEN ***
Enable Script 'RA_2?'.


[ns na D][E N H]RA_2?

*** IF ***
Timer 'RA_Random' has expired.
*** THEN ***
Set 'RA_Team' to 2
*** ELSE ***
Enable Script 'RA_3_Expired'.


[ns na D][E N H]RA_3_Expired

*** IF ***
Timer 'RA_3' has expired.
*** THEN ***
Enable Script 'RA_3?'.


[ns na D][E N H]RA_3?

*** IF ***
Timer 'RA_Random' has expired.
*** THEN ***
Set 'RA_Team' to 3
*** ELSE ***
Enable Script 'RA_4_Expired'.


[ns na D][E N H]RA_4_Expired

*** IF ***
Timer 'RA_4' has expired.
*** THEN ***
Enable Script 'RA_4 OR 5?'.


[ns na D][E N H]RA_4 OR 5?

*** IF ***
Timer 'RA_Random' has expired.
*** THEN ***
Set 'RA_Team' to 4
*** ELSE ***
Set 'RA_Team' to 5


// PATH RANDOMIZER \\

[ns na D][E N H]RA_Path_Run

*** IF ***
True.
*** THEN ***
Set timer 'RA_Path_Random' to expire between 0 and 30 frames.
Set timer 'RA_Path_Backdoor' to expire in 10 frames.
Set timer 'RA_Path_Center' to expire in 20 frames.
Enable Script 'RA_Path_Backdoor_Expired'.


[ns na D][E N H]RA_Path_Backdoor_Expired

*** IF ***
Timer 'RA_Path_Backdoor' has expired.
*** THEN ***
Enable Script 'RA_Path_Backdoor?'.


[ns na D][E N H]RA_Path_Backdoor?

*** IF ***
Timer 'RA_Path_Random' has expired.
*** THEN ***
Set 'RA_Path' to 1
*** ELSE ***
Enable Script 'RA_Path_Center_Expired'.


[ns na D][E N H]RA_Path_Center_Expired

*** IF ***
Timer 'RA_Path_Center' has expired.
*** THEN ***
Enable Script 'RA_Path_Center OR Flank?'.


[ns na D][E N H]RA_Path_Center OR Flank?

*** IF ***
Timer 'RA_Path_Random' has expired.
*** THEN ***
Set 'RA_Path' to 2
*** ELSE ***
Set 'RA_Path' to 3


// TEAM PRODUCTION CONDITIONS \\

[S A nd][E N H]RA_1_Build

*** IF ***
Counter 'RA_Team' IS Equal To 1
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:01' for 4000 milliseconds.
Team '' begins guarding.


[S A nd][E N H]RA_2_Build

*** IF ***
Counter 'RA_Team' IS Equal To 2
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:02' for 4000 milliseconds.
Team '' begins guarding.


[S A nd][E N H]RA_3_Build

*** IF ***
Counter 'RA_Team' IS Equal To 3
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:03' for 4000 milliseconds.
Team '' begins guarding.


[S A nd][E N H]RA_4_Build

*** IF ***
Counter 'RA_Team' IS Equal To 4
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:04' for 4000 milliseconds.
Team '' begins guarding.


[S A nd][E N H]RA_5_Build

*** IF ***
Counter 'RA_Team' IS Equal To 5
*** THEN ***
Set 'RA_Team' to 0
Show military briefing String: 'RA:05' for 4000 milliseconds.
Team '' begins guarding.


// TEAM BEHAVIOR \\

[S A nd][E N H]RA_On Create

*** IF ***
True.
*** THEN ***
Enable Script 'RA_Path_Run'.


[S A nd][E N H]RA_KIA

*** IF ***
True.
*** THEN ***
Set 'RA_Team' to 0
Set 'RA_Path' to 0
Set timer 'RA_Delay' to expire in 5.00 seconds.
Enable Script 'RA_Run'.


// TEAM GENERIC \\

[S A nd][E N H]RA_Attack_Backdoor

*** IF ***
Counter 'RA_Path' IS Equal To 1
*** THEN ***
Show military briefing String: 'BACKDOOR' for 5000 milliseconds.
Have Team '' follow Waypoint Path 'Backdoor' , as a team is FALSE
Set 'RA_Path' to 0


[S A nd][E N H]RA_Attack_Center

*** IF ***
Counter 'RA_Path' IS Equal To 2
*** THEN ***
Show military briefing String: 'CENTER' for 5000 milliseconds.
Have Team '' follow Waypoint Path 'Center' , as a team is FALSE
Set 'RA_Path' to 0


[S A nd][E N H]RA_Attack_Flank

*** IF ***
Counter 'RA_Path' IS Equal To 3
*** THEN ***
Show military briefing String: 'FLANK' for 5000 milliseconds.
Have Team '' follow Waypoint Path 'Flank' , as a team is FALSE
Set 'RA_Path' to 0


[S A D][E N H]RA_Hunt

*** IF ***
Team '' has reached the end of Waypoint Path 'Backdoor'
*** OR ***
Team '' has reached the end of Waypoint Path 'Center'
*** OR ***
Team '' has reached the end of Waypoint Path 'Flank'
*** OR ***
Team '' has been attacked by Player 'Red'
*** OR ***
Team '' has been attacked by Player 'Friend'
*** THEN ***
Team '' begins hunting.


// MILITAIRY BRIEFINGS \\

;Strings in map.str

RA:01
"Team 1 is building"
End

RA:02
"Team 2 is building"
End

RA:03
"Team 3 is building"
End

RA:04
"Team 4 is building"
End

RA:05
"Team 5 is building"
End

BACKDOOR
"Team attacks Backdoor"
End

CENTER
"Team attacks Center"
End

FLANK
"Team attacks Flank"
End


Greetz and Have Fun   Random Attack Test Map 2.rar (8kb) downloaded 4 time(s).
Panem et kirkinses
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
This is incredibly awesome!
How you did that on such short notice is beyond me. I reckon you dont call yourself AcidBrain for no reason!
Now I must get to work and implement this into my mission map.
Utter and complete awesomeness!
Thankyou.
acidbrain
10 years ago

This is incredibly awesome!
How you did that on such short notice is beyond me. I reckon you dont call yourself AcidBrain for no reason!
Now I must get to work and implement this into my mission map.
Utter and complete awesomeness!
Thankyou.

Originally Posted by: Slird 



You're welcome, it seems harder than it is, i use random scripting for a couple of years now and i like the idea that you don't know with what units and from which side the ai attacks.
There are much more possibilities with random teams, the scripts posted above take care of 1 active team, i made a map with 10 random teams from which multiple teams can be active at the same time, my goal is to make them work together and merge with other teams nearby in case of emergency.

I call myself acidbrain because i really liked acid in my younger years, experienced the early days of housemusic, acieed, has nothing to do with my intelligence, basicly i am a big noob.

Greetz
Panem et kirkinses
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
Well, noob or not you have a skillset there to be proud of.
I had no idea even where to begin randomizing attack teams, and it was frustrating because I knew it was possible.
Youve just cleared away some of the mud for me.
And I wish you well on your endeavors, I am anxious to see them.
acidbrain
10 years ago
Study scripts from other people, i learned how to script that way, just make some testmaps and start playing around.
I have another testmap for you if you are interested, it's a testmap for chinook drops, the ai checks if the player has a sw if the player does have a sw col. burton is droppped near the player base with a chinook, if col. burton has attacked the sw with a timed bomb auroras start attacking the sw also, the ai checks multiple areas to land with the chinook and lands in the savest area, if the player doesnt have a sw than a humvee with some troops are dropped in the savest area, the troops load into the humvee and start hunting, if the humvee is attacked by the player it unloads and the infantry starts hunting.
I also made some scripts that make troops stop for a coming train, if the train has passed the troops go on with what they were doing.

If you are interested just let me know, it's fun to hang around in testmaps, i spent hundreds and hundreds of hours that way

Greetz and Have Fun
Panem et kirkinses
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
Absolutely! If youre willing to share Im willing to gander!
I do study scripting...somewhat. I confuse easily tho so that makes it hard.
slird
  • slird
  • 50.25% (Neutral)
  • Major Topic Starter
10 years ago
Are the scripts setup for a skirmish player, or a regular computer player?
I set them up exactly like they are in the test map but they are not working for some reason.