Posted: Wed May 20, 2015 2:49 pm Post subject:
Need help with Singleplayer AI Triggers
Subject description: I promise to be very clear in explaining what isn't working!
Hi, I've taken up FA2 mapping, and I understand how Taskforces, Scripts, Teams and Triggers (map triggers) work. The only problem I have is getting AI Triggers to work.
Basically, I would like the enemy (e.g. Russia) to create a team of, say, 1 Tesla Trooper to attack my base when I have 1 GI. Like I said, I can set up the taskforces, scripts and teams just fine.
I've tried following the AI trigger tutorial provided in FA2 but it doesn't seem to work for me at all. That is, whenever I build 1 GI (or more), the enemy doesn't build the required team. The AI has cash, the necessary production structures (both pre-placed and constructed using base nodes), and the triggers for [Production Begins...] and [AI triggers begin...] are correctly set up, so I really can't understand what I'm doing wrong.
I've tried opening up Westwood's official maps to investigate their triggers, and that's how I learned most of the stuff, but I can't get the AI triggers to work properly. I've also tried looking through the pages and pages of the forums for a solution to this, but the only thing I could find was Aro's and krnyoshi's tutorials.
I know its possible to mimic the behaviour of AI triggers using the standard map Triggers, but that seems like too much work for something so simple.
I have attached a sample of my trigger using to this post... I would really, really, appreciate it if anyone here can provide a detailed explanation of how to set up a basic Singleplayer AI Trigger. If at all possible, I would also love it if someone could send me a .map example of how to properly set up AI Triggers.
Thanks for the reply, it's good to know that there's nothing wrong with it. But what frustrates me is that it just doesn't work for me... I've even tried a fresh install of RA2, but that hasn't resolved the problem. Any possible idea why it's not working for me? QUICK_EDIT
Cheers for the tip, I played around with the Taskforces and Scripts to make sure everything was working fine, and indeed the AI built it after some time.
However, I noticed that the AI always builds only 2 of that team. No more, no less. In addition, the AI will not build other teams specified by my other AI Triggers, regardless of the conditions specified. Why is this so? I notice that if I use the standard (default) AI Triggers in FA2, the AI will happily build tons of units (excluding my own single AI Trigger, which is still limited to 2). QUICK_EDIT
Usually the Max count on the TeamType controls that, but when you make them IsBaseDefense=yes, then
MaximumAIDefensiveTeams value in rules.ini takes effect which in vanilla is 2. So, any TeamTypes with
IsBaseDefense=yes put together cannot exceed 2.
If you don't want other standard AITriggers then you have to disable them in AITriggerTypesEnable for
single player maps. QUICK_EDIT
Ok, I played around with the settings on TeamType and got it to work as I wanted (meaning more than 2 teams), but I still can't get the AI to build more than one 'type' of team, i.e. I have two AI Triggers set up, but after an extended period of time, I see that only one of them continuously fires, i.e. only one 'type' of team is being created. Anyone know why?
Also, nothing to do with AI Triggers, I have two more questions:
1. The NewUrban setting seems to be lacking proper dirtroads, is that normal?
2. How do I create an AI TeamType that will enter Yuri Bio Reactors? According to http://modenc.renegadeprojects.com/ScriptTypes/ScriptActions it should involve action 62 [Enter Bio Reactor], but I don't see that option in FA2. Opening up Westwood's maps didn't help much, as the scripts involving Bio Reactors use all sorts of weird actions like [Do this... sleep] and [Move to waypoint 0] QUICK_EDIT
Joined: 22 Nov 2010 Location: Iszkaszentgyorgy, Hungary
Posted: Thu May 21, 2015 1:59 pm Post subject:
1) yes, that is normal, excluding some tiles, all of the dirtroads got overridden with the narrow concrete roads.
2) needs a manual tinkering with FA2 beforehand and I don't know that part. _________________ "If you didn't get angry and mad and frustrated, that means you don't care about the end result, and are doing something wrong." - Greg Kroah-Hartman
=======================
Past C&C projects: Attacque Supérior (2010-2019); Valiant Shades (2019-2021)
=======================
WeiDU mods: Random Graion Tweaks | Graion's Soundsets
Maintainance: Extra Expanded Enhanced Encounters! | BGEESpawn
Contributions: EE Fixpack | Enhanced Edition Trilogy | DSotSC (Trilogy) | UB_IWD | SotSC & a lot more... QUICK_EDIT
YR stuffs are left out in FA2, better to put them in maps using text editor. And those will work only in YR
not RA2. AIMD.ini also has script for Initiates using 62,0 apart from examples in YR SP maps. QUICK_EDIT
[0A0000BD]
0=5,0
1=60,0
Name=DO NOT OPEN - Enter nearest Grinder SCR
[0A0000BE]
0=5,0
1=61,0
Name=DO NOT OPEN - Occupy nearest Tank Bunker SCR
[0A0000BF]
0=5,0
1=62,0
Name=DO NOT OPEN - Enter nearest Bio Reactor SCR
[0A0000BG]
0=5,0
1=63,0
Name=DO NOT OPEN - Occupy nearest Battle Bunker SCR
[0A0000BH]
0=5,0
1=64,0
Name=DO NOT OPEN - Garrison nearest Structure SCR
[0A0000BI]
0=5,0
1=0,11
Name=DO NOT OPEN - Attack nearest Tech Building SCR
You can use those scripts as long as you don't open them, which would be silly. If you want to perform this action from another script you can use action 17, Change Script.
Each new map will have these scripttypes. _________________
Here's an example of 2 AI Triggers set up, one requires at least 1 GI to fire, the other at least 1 Allied Engineer. Both types of infantry are already on the map.
The AI Triggers are set up as such:
AI Trigger 1: If at least 1 GI -> Produce Kirovs
AI Trigger 2: If at least 1 Engineer -> Produce Crazy Ivans
The AI Trigger for the GI keeps firing, whereas that for the Engineer doesn't seem to fire at all... did I set up something incorrectly for the second trigger?
Also, why is it that the AI still produces some Conscripts and Flak Troopers even though I've disabled all the standard AI Triggers?
RP: I don't quite follow... I did find the .ini file and edit it... since they still don't appear in FA2, does that mean I have to open up the saved .map file in notepad and edit the Scripts from there, if I want to use those actions? How do I use Change Script if the action 62 doesn't appear in FA2? Also, what do you mean by 'as long as you don't open them'? I've never tried modifying the .map file itself in Notepad (apart from a few minor tweaks to units), so I apologise if I come across as a little stupid.
Every new map you create now will have those scripts in it, existing ones don't. You can add them the same way you did in that ini.
Change script is index sensitive, therefore you must count all the ScriptTypes that exist in the map.
Basically what you do is take the index of the ScriptType you want to change to.
Then you have to add the amount of ScriptTypes your aimd.ini has because of the internal arrays.
So in the example posted above, let's say you have a script and want to make it go to script "Occupy nearest Tank Bunker SCR", you get the index of it in the list, which is 2.
Then you take the amount of ScriptTypes from aimd.ini, which could be 56. In the end the index will be 58 (2 + 56) + 1 (because indexing starts at 0).
You should not open the Script in FA2, as it will replace the correct action number with 0. Hence the "DO NOT OPEN" part.
It all sounds a bit complex, but that's the way the game works. The new editor does support anything you throw at it, so this should only be a temporary solution. _________________
Tested with IsBaseDefense=yes and raising the MaximumAIDefensiveTeams under [General] section in map
file itself using text editor. Both the triggers were working, producing both Kirov and Ivan.
For disabling standard/global AI triggers in SP maps, under [Basic] can give IgnoreGlobalAITriggers=yes or
enlist all of them under [AITriggerTypesEnable] and set them to no individually using text editor. QUICK_EDIT
Tested it again, looks like it works. Guess I'm just too impatient waiting for the triggers to fire.
Also, can anyone tell me if it is possible to set up a sequence of triggers such that when two specific units, X and Y, enter an area, another trigger will fire? X and Y are both owned by the player, so I can't use the [Entered by...] event and assign the units to different houses. QUICK_EDIT
Are X and Y built by the player?
If not you could put them off the map, use a tag to attach a trigger with 'Comes near waypoint' and then set the owner to the dummy house you use.
That way you can have:
Unit X is from Player2 House
Unit Y is from Player3 House
When X and Y get near waypoint -> do trigger stuff.
This could also work when the player builds them, use a trigger with 'Build Unit' or something and then create a team with such a tag attached to it.
Changing the owner can be done using a scripttype.
I'm not sure this tag remains as the team could internally be dissolved when you give it new orders. _________________
Hmm, using the [Comes near waypoint] only solves part of my problem though. X and Y are off-screen reinforcements, but I have no problem assigning them the proper tags. The tricky bit is that I want the event to trigger only when both of them are near the waypoint; that is, if X moves close to the waypoint, but then moves somewhere else, and then Y moves close to the waypoint, the trigger should NOT fire. Ditto if Y moves first, moves away, then X moves close.
I've tried setting up a multi-part trigger using the repeating and attached trigger options, as well as the set/clear local options, but I keep running into problems. Namely, if I move X close to the position and then move away, the trigger fires repeatedly (see attachment for map). Also, moving X away doesn't seem to disable the 'main' event trigger, so to speak.
The attached map contains two units. Move either of them up the hill and then down the slope, to the end of the valley. This should trigger the 'get close' action and text trigger. Moving that unit back up, however, causes the 'disabling' trigger to go haywire. Can anyone tell me what I did wrong, and how the triggers should be set up?
On Tags, 0 is for OR one time, 1 for AND one time and 2 for OR repeating. FA2 doesn't have 1 case by
default on Trigger editing but shows 1- Unknown in Tags editing. It can be set using text editor as well.
Discussion for FinalSun: http://www.ppmforums.com/viewtopic.php?t=39454
Additionally, triggers can be disabled/enabled using another one.
As for patience on AITriggers, TeamDelays could be reduced to some extent for testing. Another cause
for not working of AITriggers could be that IsBaseDefense=no cases need choosing an enemy using
action 38 - Make enemy. QUICK_EDIT
It's not difficult, you can add an enabler trigger, which has Comes near waypoint, and a disabler trigger, that disables the enabler.
Copy and paste this code, it's what I meant:
Code:
[Tags]
01000001=2,Enabled Unit X 1,01000000
01000003=2,Disabled Unit X 1,01000002
01000005=2,Disabled Unit Y 1,01000004
01000007=2,Enabled Unit Y 1,01000006
01000009=0,Success 1,01000008
[Triggers]
01000000=Americans,<none>,Enabled Unit X,0,1,1,1,0
01000002=Americans,<none>,Disabled Unit X,1,1,1,1,0
01000004=Russians,<none>,Disabled Unit Y,1,1,1,1,0
01000006=Russians,<none>,Enabled Unit Y,0,1,1,1,0
01000008=Americans,<none>,Success,0,1,1,1,0
RP: That code doesn't work. I tried it out on a fresh map with two units, one for each tag. The result is pretty much the same: both the enabling/disabling triggers fire repeatedly, i.e. the enabler trigger fires, enabling the disabling trigger. The disabling trigger then fires (without even moving the unit back to another waypoint... well given the events [Time Elapsed...], kinda obvious), re-enabling the enabling trigger, and so on.
I was thinking, is there a way to 'refresh' a trigger, i.e. 'wipe its memory' of past events, allowing it to register events as though they were occurring for the first time? I'm guessing that the reason my original triggers fired repeatedly was that while Unit X moved away from waypoint 0 (and towards waypoint 1), by re-enabling the 'move towards waypoint 0' trigger, the 'move towards waypoint 0' trigger would continue to fire as it already registered Unit X having been near waypoint 0 previously.
If there were some way to 'refresh' the history of that trigger, then when the enabling trigger is re-enabled, it would not register Unit X having been near waypoint 0 previously... QUICK_EDIT
What if you make the disabling waypoints somewhere around the two you want triggered, so the two important waypoints both add to a variable, and the ones around reset it to zero. Then your timer only has to check if the variable is 2+ ? _________________ http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai QUICK_EDIT
So what iambangbang?
I haven't tested the code. Does "comes near waypoint" only fire once?
Otherwise you could surround the waypoint with celltags and check if the unit enters the cells instead of the timer.
You can attach multiple triggers to the celltag by attaching trigger Y to X and deleting the tag of trigger Y. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum