Page 1 of 1

Misfiring Event

Posted: Sun Jan 13, 2008 5:57 pm
by Jagger
Can anyone spot why the event below is not firing properly?

The intent of the event is to provide an opportunity for a single USCT regiment to appear only if I control at least any one town in the state of Louisiana. If I do control at least one town in Louisiana, the regiment should have a 33%/turn chance of appearing only in a controlled Louisiana town.

At the moment, I do not control any cities in Louisiana. Yet the event fired anyway and created the regiment in Kansas. I have other identical events for other states which also fired even though I do not control towns in the identified states creating the units in towns outside the state that I control.

I don't see what is wrong with the event. Any ideas?

SelectFaction = $USA
StartEvent = evt_nam_USA_LaUSCT3Raised|1|1|NULL|NULL|NULL|NULL

Conditions
MinDate = 1862/09/15
Probability = 33

Actions
DescEvent = evt_desc_USA_LaUSCT3Raised
SelectRegInArea = $LA; OwnedCities; NotEnemy
PickFromRegList
EvalEvent = evt_nam_USA_EmancipationProclaimation1863;=;1
GenMsg
ChangeWSUPool = -2
ChangeMoneyPool = -4
ChangeConscriptPool = -5

SelectFaction = $USA
CreateGroup
Posture = $Defensive
SetKind = $Land
Entranch = 0
InCS = 0
FixType = 0
SetName = 1st LA USCT Reg.
Apply
CreateUnit
SetType = $uni_USA_bde15
SUFlavorName = 1st LA USCT Reg.
SetName = 1st LA USCT Reg.
Apply

EndEvent

Posted: Mon Jan 14, 2008 11:33 am
by Pocus
The checks are made in the conditions block and not in the Actions block. So for the script, you check only what is the date and a Dice roll.

Posted: Mon Jan 14, 2008 11:18 pm
by Jagger
I would like to confirm I understand the conditions below starting at SelectRgn.

Conditions
MinDate = 1863/02/15
TurnIndex = 6;12
evt_nam_USA_EmancipationProclaimation1863;=;1
SelectRegInArea = $VA;Squared;OwnedCities;CondSkip
GenMsg
PickFromRegList = NotEnemy
GenMsg
EvalRegionSel = NULL


Does "SelectRegInArea = $VA;Squared;OwnedCities;CondSkip" produce a check of every town in Virginia for player owned towns? In my tests, it appears to look for at least one owned town in a state.

What purpose does "CondSkip" serve? I am assuming it means end the event if no towns are owned.

What is the impact of "EvalRegionSel = Null"? Does this also mean end event if no regions are friendly?

The conditions appear to work in producing a unit only if I own one town in the state. But I am not certain it will produce the results consistently because I don't fully understand parts of the conditions.

Here is the full event.

SelectFaction = $USA
StartEvent = evt_nam_USA_VaUSCT24Raised|999|1|NULL|NULL|NULL|NULL

Conditions
MinDate = 1863/02/15
TurnIndex = 6;12
evt_nam_USA_EmancipationProclaimation1863;=;1
SelectRegInArea = $VA;Squared;OwnedCities;CondSkip
GenMsg
PickFromRegList = NotEnemy
GenMsg
EvalRegionSel = NULL

Actions
DescEvent = evt_desc_USA_VaUSCT24Raised
SelectRegInArea = $VA; OwnedCities; NotEnemy
PickFromRegList
GenMsg
ChangeWSUPool = -2
ChangeMoneyPool = -4
ChangeConscriptPool = -5

SelectFaction = $USA
CreateGroup
Posture = $Defensive
SetKind = $Land
Entranch = 0
InCS = 0
FixType = 0
SetName = USCT Reg.
Apply
CreateUnit
SetType = $uni_USA_bde15
Apply

EndEvent


Thanks in advance!

Posted: Tue Jan 15, 2008 9:44 am
by Pocus
You know what I ask you in return. A bit of your soul ... err, no, not that. I would like to have the wiki improved over time with what we exchanges.

SelectRegInArea = $VA;Squared;OwnedCities;CondSkip

CondSkip here serves nothing. Condskip will prevent the selection to be done, if the region selector is not empty. So it has to be used starting with a 2nd selection command.

Selection command A
Selection command B with condskip
If A find a valid region, the region selector is valued. If it is valued, then command B won't trigger as it has a condskip parameter.


PickFromRegList = NotEnemy

So you do some selections, which are added in a list of selected regions, and the last selected region is valued in the region selector. Once you are 'happy', you pick one, with PickFromRegList, with additional parameter NotEnemy (aka 'Pick me a region in the region list which is not owned by the enemy)

Once done, you have two possibilities. Either at least one region fulfill the condition, and it means the region selector points to it, or there is none fulfilling the condition, and the region selector has been set to nil, null, nothing, nada.

So you want to know if a valid region is selected. You then do
EvalRegionSel = NULL

If there is a region, forward to Actions Block, if not, all conditions are not met and the event don't fire.

Posted: Wed Jan 16, 2008 2:19 am
by Jagger
After life in the military and the corporate world, I don't have many chunks of soul left to give...so I will put something into the wiki instead. :innocent:

Thanks for the information!