Jagger
AGEod Grognard
Posts: 949
Joined: Sat Mar 18, 2006 2:31 pm

Misfiring Event

Sun Jan 13, 2008 5:57 pm

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

User avatar
Pocus
Posts: 25673
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Mon Jan 14, 2008 11:33 am

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.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

Jagger
AGEod Grognard
Posts: 949
Joined: Sat Mar 18, 2006 2:31 pm

Mon Jan 14, 2008 11:18 pm

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!

User avatar
Pocus
Posts: 25673
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Tue Jan 15, 2008 9:44 am

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.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

Jagger
AGEod Grognard
Posts: 949
Joined: Sat Mar 18, 2006 2:31 pm

Wed Jan 16, 2008 2:19 am

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!

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 9 guests