Units That Popping Up Randomly
-
I would like to having 5 submarines that popping up each round randomly in certain sea zones before German combat phase is it possible?
-
@schulz You can definitely have units pop at random. Check out my Zombies-World War 2 scenario at https://forums.triplea-game.org/topic/2767/new-old-mods-for-triplea
-
@rogercooper I couldn't open the game unfortunately but after having to take a look the XML I guess there are still differences.
I would want to see having fixed amount of units being popped up in certain territories unlike here which seems like uncertain amount of units can pop up in every land territories
-
@schulz I have a fixed amount of units as well. (I don't know of any way to have variable amount of units). You can use a variable to list the areas you want.
-
How should I change foreach="$LandArea$ and @LandArea@ texts?
-
@schulz You can rename LandArea to whatever you want (SeaArea maybe). At the beginning of the file, you can see how the LandArea file was defined.
If you want a full explanation of variables, look in Pact of Steel 2
-
It says "Attachment has invalid variables in forach : $SeaArea$
<attachment name="conditionAttachmentEveryTurn" attachTo="Germany" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="rounds" value="1-100"/>
</attachment><attachment foreach="$SeaArea$" name="triggerAttachmentGermanygermanSubmarine@SeaArea@" attachTo="Germany" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachmentEveryTurn"/>
<option name="placement" value="@SeaArea@:submarine" count="1"/>
<option name="players" value="Germany"/>
<option name="chance" value="2:70"/>
<option name="when" value="before:germanyCombatMove"/>
</attachment><attachment foreach="$SeaArea$" name="triggerAttachmentGermanyBig@SeaArea@" attachTo="Germany" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachmentEveryTurn"/>
<option name="placement" value="@SeaArea@:submarine:submarine:submarine:submarine:submarine"/>
<option name="players" value="Germany"/>
<option name="chance" value="1:100"/>
<option name="when" value="after:usaPlace"/>
</attachment> -
@schulz My first guess is that you did not define the variable correctly. If you post the XML, I will take a look.
If you have a small number of areas, you don't need to use variables.
-
@rogercooper My intention is spamming 2 sub in North Atlantic 1 in Indian Ocean and 1 Pacific Ocean for Germany before germanyCombatMove each round.
And spamming 1 Austrian sub in Mediterranean before austriaCombatMove each round.
-
@schulz said in Units That Popping Up Randomly:
It says "Attachment has invalid variables in forach : $SeaArea$
If this line is part of the error then try "foreach" instead of "forach"
-
@beelee My mistake to misspell it. The error came up with "foreach"
-
@schulz ahh...so much for an easy fix
-
@schulz
I have the random code working in your xml, here is the extract<!-- this goes before map -->
<variableList>
<variable name="SZGermanySubs">
<element name="SZ 4"/>
<element name="SZ 5"/>
<element name="SZ 6"/>
<element name="SZ 7"/>
</variable>
</variableList><!-- this goes before attachmentList -->
<attachment name="conditionAttachmentEveryTurn" attachTo="Germany" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
<option name="rounds" value="1-100"/>
</attachment><attachment foreach="$SZGermanySubs$" name="triggerAttachmentSZGermanySubs@SZGermanySubs@" attachTo="Germany" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachmentEveryTurn"/>
<option name="placement" value="@SZGermanySubs@:destroyer" count="1"/>
<option name="players" value="Germany"/>
<option name="chance" value="1:2"/>
<option name="when" value="before:germanyPurchase"/>
</attachment>You will have to change the bold text, but hopefully its just a copy and paste.
-
@thedog Thank you it worked though if subs pop up before movement phase they can't move. How to make them move and attack?
-
@schulz
In short I dont know.
Maybe use a false delegate, like Politics delegate your not using that, put it before the germanyCombatMove and have the submarines appear before Politics delegate, then they might appear, move and attack?However, appearing, then moving and attacking , to me is not a fair mechanic. You will get the 'fear' factor in the player as they know the subs can appear in several areas, that should be good enough?
The AI of course is fearless.
-
@thedog
I just created fake tech phases before Combat phase it didn't work unfortunately.It is true I would want Central Powers having this unfair advantage but Entente will be compensated by other factors like higher incomes, not being able to use captured factories or took enemy incomes after capturing their capitals.
-
To have the subs move after being placed use 'stepProperty':
<step name="germansCombatMove" delegate="move" player="Germans"> <stepProperty name="resetUnitStateAtStart" value="true"/> </step>
Cheers...
-
Thank you it worked. Does it work for only country?
-
It will only affect Germany. Combat stats are reset normally at the end of the players Non-Combatmove. That is why the placed units don't move.
Cheers...
-
How could I make this feature dependent to controlling some territories?