Help with a trigger issue regarding having the game randomly do one of two things.
-
In my map, there is a player that controls Trolls and since there are so many different and varied trolls in the universe the map is in, I have split them up into tribes and the player will purchase a tribe to have them under there control at the game start.
Therefore I have 2 sets of triggers regarding this, 1 set that handles it for the player and another set which do it for the ai when a player isnt playing the faction. The ai triggers will randomly activate a major/medium/minor tribes for the ai player.
The triggers regarding the player work and theyre not an issue, however the set that I have for the ai produces an error.
Im having trouble fixing this error for 2 reasons:
The first is that the usual method of seeing the error, and then previewing it to see where it fails doesnt work for me in this situation since when I go to do it, it comes up with the below screenshot and the error mentioned is for a different map. I looked through the error and also the part of the xml where it happens in that map to see if its similar to mine but I dont see whats wrong in that either.
The second reason is that since its saying the userAttachment is the problem I've looked at it and I cant see whats wrong. Ive copied and pasted another userAttachment and just manually changed the names and values to see if perhaps ive missed a " or a ' or something minor, but even after doing that it still comes up with the error.Heres the code below for the ai set and a description of what I intended it to do (after ironing out the kinks with timings etc) which anyone reading can probably ignore:
There is a condition set at the start of the game that affects all the following triggers by spawning a unit, but a human Troll player presses a user action to disable it by removing the unit via a trigger. The presence of the unit activates a trigger that spawns a second unit on a 50% chance, if its spawned it leads to one major Tribe being activated and if it doesnt spawn it leads to the other major Tribe being activated.
<!-- TrollTribes setup --> <!-- AI selection triggers --> <!-- Trolls Are AI --> <attachment name="conditionattachmentTrollTribesIsAI" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="Space" count="1"/> <option name="unitPresence" value="trollai" count="1"/> </attachment> <attachment name="triggerAttachmentTrollTribesIsHuman" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="players" value="Neutral"/> <option name="removeUnits" value="Space:trollai" count="5"/> </attachment> <attachment name="userActionAttachmentTrollTribesIsAHuman" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.UserActionAttachment" type="player"> <option name="conditions" value="conditionAttachmentTrollTribesFirstRound"/> <option name="activateTrigger" value="triggerAttachmentTrollTribesIsHuman:1:false:false:false:false"/> <option name="text" value="HumanPlayer"/> <option name="chance" value="1:1"/> </attachment> <!-- Conditions checking if switches are present --> <attachment name="conditionattachmentTrollMajorTrue" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="Space" count="1"/> <option name="unitPresence" value="trollmajorswitch" count="1"/> <option name="players" value="Neutral"/> </attachment> <attachment name="conditionattachmentTrollMajorFalse" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="Space" count="1"/> <option name="unitPresence" value="trollmajorswitch" count="1"/> <option name="players" value="Neutral"/> <option name="invert" value="true"/> </attachment> <!-- Triggers placing the switches --> <attachment name="triggerAttachmentTrollMajorPlacer" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionattachmentTrollTribesIsAI:conditionAttachmentTrollTribesFirstRound"/> <option name="conditionType" value="AND"/> <option name="players" value="Neutral"/> <option name="placement" value="Space:trollmajorswitch"/> <option name="when" value="before:trolltribesTribeUserActions"/> <option name="chance" value="3:6"/> </attachment> <!-- Triggers picking major, medium and minor tribes --> <attachment name="triggerAttachmentTrollTribesMajorAmani" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionattachmentTrollTribesIsAI:conditionattachmentTrollMajorTrue:conditionAttachmentTrollTribesFirstRound"/> <option name="conditionType" value="AND"/> <option name="when" value="after:trolltribesTribeUserActions"/> <option name="activateTrigger" value="triggerAttachmentTrollTribesAmaniA:1:false:false:false:false"/> <option name="activateTrigger" value="triggerAttachmentTrollTribesAmaniB:1:false:false:false:false"/> </attachment>
If I try removing the userattachment, then the other thing that produces an error is the trigger at the very bottom "triggerAttachmentTrollTribesMajorAmani" and similarly, I dont see whats wrong with it and I cant investigate it due to the same problem with the popup saying there is already a bug report for this problem.
-
@Zaroph my guess is you won't be able to make it work until that issue gets fixed. Unless you can find a workaround. You could ask what the staus is on it at git.
It looks like there's no AI player for that action.
"Caused by: games.strategy.engine.data.GameParseException: Could not find player. name: for: RulesAttachment attached to: PlayerId named:AI with name: conditionAttachment-Atomic-Akkad"
You could try running it on 13066 and see if it works.
-
First question is 'TrollTribes' a player? If so are you trying to check to see if 'TrollTribes' is being controlled by the AI, as selected on the chose player screen?
If so lets try:
<!-- TrollTribes Human Check Conditions --> <attachment name="conditionAttachmentTrollTribesAIPlayer" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="switch" value="true"/> </attachment> <!-- An invert of the previous condition --> <attachment name="conditionAttachmentTrollTribesHumanPlayer" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="conditions" value="conditionAttachmentTrollTribesAIPlayer"/> <option name="invert" value="true"/> </attachment> <!-- TrollTribes Human Player Trigger --> <attachment name="triggerAttachmentTrollTribesIsHuman" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <!-- This will never happen because 1 will always be true and the other false --> <option name="conditions" value="conditionAttachmentTrollTribesHumanPlayer:conditionAttachmentTrollTribesAIPlayer"/> <option name="playerAttachmentName" value="RulesAttachment" count="conditionAttachmentTrollTribesAIPlayer"/> <option name="playerProperty" value="switch" count="false"/> <option name="when" value="after:americanUserActions"/> <option name="uses" value="1"/> </attachment> <!-- TrollTribes User Action Is Human Check --> <attachment name="userActionAttachmentTrollTribesIsHuman" attachTo="TrollTribes" javaClass="games.strategy.triplea.attachments.UserActionAttachment" type="player"> <option name="conditions" value="conditionAttachmentTrollTribesAIPlayer"/> <option name="activateTrigger" value="triggerAttachmentTrollTribesIsHuman:1:false:false:false:false"/> <option name="text" value="HumanPlayer"/> </attachment>
What this does is it set up to conditions: AI Player = True: Human Player = Invert AI Player. The trigger will change the switch of the AI Player depending on the Users action or inaction. The trigger can never fire on its own because the two conditions will never be true.
You can place your troll selections after the conditions.
If you are having trouble finding errors in you xml, try turning on the console. It is located by selecting "Engine Preferences" from the main screen. It is the third option under the 'Game' tab.
Hope this is helpful.
Cheers...
-
@beelee
It seems that with the new update to 2.2, I could preview the issue again.
There is an issue with using 13066 to investigate for me because it doesnt seem to like the variablelist in maps and my map uses variables to make things easier.
@wc_sumpton
This worked exactly as I wanted so thank you so much.
I also didnt know about the console option since I havent touched the engine preferences in ages so thank you for informing me of that as well, it will be useful in the future if something like this happens again where I cant check the console via preview.