Page 1 of 2

CountUnits

Posted: Mon Jan 19, 2009 10:00 am
by Hobbes
I don't think there is an easy way to use CountUnits to count only land units in a region? I don't want to count ships in harbour.

Thanks, Chris

Posted: Mon Jan 19, 2009 12:46 pm
by lodilefty
All I know is here:
http://www.ageod-forum.com/showthread.php?t=8031&highlight=countunits

perhaps you can get there by

SelectSubUnits in the region
http://www.ageod-forum.com/showthread.php?t=6213&highlight=SelectSubUnits

Then doing EvalSubUnitCount
http://www.ageod-forum.com/showthread.php?t=9096&highlight=SelectSubUnits

tedious, because you list models or families, but it should work

Posted: Mon Jan 19, 2009 1:40 pm
by Pocus
SelectSubUnits and then EvalSubUnitCount is the way to go. You can select by Domains (which is something intermediary in precision between UnitType (land or naval) and families. SelectSubUnits = Region $myRegion|Domains 0 will be enough to select land units.

Posted: Mon Jan 19, 2009 2:03 pm
by lodilefty
Ah, OK

It wasn't clear to me that Domains are active for WIA.

Excellent!!!

Posted: Mon Jan 19, 2009 4:09 pm
by Hobbes
Thanks chaps!

Posted: Sat Jan 24, 2009 12:17 pm
by Hobbes
Pocus wrote:SelectSubUnits and then EvalSubUnitCount is the way to go. You can select by Domains (which is something intermediary in precision between UnitType (land or naval) and families. SelectSubUnits = Region $myRegion|Domains 0 will be enough to select land units.


Hi Philippe, I tried this without success.

GBR SelectSubUnits Region $Mackinaw|Domains 0
GBR EvalSubUnitCount <|1
CountUnits $Mackinaw|0|$IND|-1|>=|1

With this, the event does not fire when there are no land units. There may be a ship in the harbour but this seems to destroyed or pushed out to sea during the turn so I can't see that this would have an effect.

If I substitute the above with the rather nasty :-

CountUnits $Mackinaw|0|$GBR|0|=|0
CountUnits $Mackinaw|0|$GBR|1|=|0
CountUnits $Mackinaw|0|$GBR|2|=|0
CountUnits $Mackinaw|0|$IND|-1|>=|1

The event fires when the Indians defeat the fort garrison.
Just thought I should mention this - but the event is working fine for me now.

Cheers, Chris

Posted: Sat Jan 24, 2009 1:15 pm
by lodilefty
Hobbes wrote:Hi Philippe, I tried this without success.

GBR SelectSubUnits Region $Mackinaw|Domains 0
GBR EvalSubUnitCount <|1
CountUnits $Mackinaw|0|$IND|-1|>=|1

With this, the event does not fire when there are no land units. There may be a ship in the harbour but this seems to destroyed or pushed out to sea during the turn so I can't see that this would have an effect.

If I substitute the above with the rather nasty :-

CountUnits $Mackinaw|0|$GBR|0|=|0
CountUnits $Mackinaw|0|$GBR|1|=|0
CountUnits $Mackinaw|0|$GBR|2|=|0
CountUnits $Mackinaw|0|$IND|-1|>=|1

The event fires when the Indians defeat the fort garrison.
Just thought I should mention this - but the event is working fine for me now.

Cheers, Chris


What did the ScriptReport.txt say about the event?

Did you try Domains $Land ???

Posted: Sat Jan 24, 2009 1:30 pm
by Hobbes
I'll give it another shot later on

Posted: Sat Jan 24, 2009 4:11 pm
by Pocus
Hobbes wrote:Hi Philippe, I tried this without success.

GBR SelectSubUnits Region $Mackinaw|Domains 0
GBR EvalSubUnitCount <|1
CountUnits $Mackinaw|0|$IND|-1|>=|1


Why are you adding CountUnits here?

The Conditions section of the event should consists of a selection (SelectSubUnits ) and then the evaluation of it (EvalSubUnitCount). Should work, if not there is a bug...

Posted: Sat Jan 24, 2009 6:18 pm
by Hobbes
Pocus wrote:Why are you adding CountUnits here?

The Conditions section of the event should consists of a selection (SelectSubUnits ) and then the evaluation of it (EvalSubUnitCount). Should work, if not there is a bug...


I shouldn't have added the CountUnits to the example - I'm just making sure there are also Indians in the region in order to fire the event.
I just want to fire an event when Indians take a fort.

I just tried the Domains 0 again - this time without any GBR ships in the harbour (I forgot to add them to the test). This time the Indians burnt the fort (burning the fort before the event is considered would prevent the event from firing due to a EvalRgnStruc $Mackinaw|GBR|STRUCDEF $Fort condition).

I need to test more tomorrow when I have time - but I wonder; it seems if I have an event that fires when a British fort is lost (i.e. no British land units left in a region, but Indian units exist in the region) the Indians burn the fort before events are considered.

I can test this out tomorrow in any case.
Cheers, Chris

Posted: Sat Jan 24, 2009 6:24 pm
by lodilefty
the Indians burn the fort before events are considered.


yes.
AFAIK, game engine does it's thing before events are processed...

Posted: Sat Jan 24, 2009 6:37 pm
by Hobbes
lodilefty wrote:yes.
AFAIK, game engine does it's thing before events are processed...


Thanks Lodi, I'll test it out some more tomorrow - a good point to bear in mind.

Chris

Posted: Mon Jan 26, 2009 6:08 pm
by Pocus
yep, you have the game code (in hosting) and then in the end, the scripted events.

Posted: Wed Jan 28, 2009 10:43 pm
by Hobbes
It seems there is a bug here. Indians will not burn a fort if there is an enemy naval unit in a harbour in the same region.
For most scenarios probably not a big deal but for the Pontiac one it's a game breaker.

Help!
Chris
P.S. the Domain 0 seems to work fine. After a lot of testing I realise the problem is not with events but with the code for fort burning.

I have an event that may fire on turn one that turns the fort into a settlement. If the Indians take the settlement they are able to take control of it rather than burn it - this then expels the ship from the harbour, but if they fail to take the fort while it is a settlement the above problem occurs.

(I will take this opportunity to once again ask for a command that can create a structure in an empty region. ChangeStrucType is a great command but we need a way to create a structure where none exists).

$Settlement|$Fort|null| REG $Mackinaw

It would be very nice to have :-
$Nothing|$Settlement|null| REG $Mackinaw

and the opposite
$Settlement|$Nothing|null| REG $Mackinaw

Cheers, Chris

Posted: Thu Jan 29, 2009 12:11 am
by lodilefty
Did you try NULL where you have $Nothing ?

$Nothing will probably evaluate as structure type = 0 [Port], since it is undefined.

Posted: Thu Jan 29, 2009 9:01 am
by Hobbes
lodilefty wrote:Did you try NULL where you have $Nothing ?

$Nothing will probably evaluate as structure type = 0 [Port], since it is undefined.


I'm only using $Nothing as an example as there was a recent thread that said it wasn't possible http://www.ageod-forum.com/showthread.php?t=11214&highlight=ChangeStrucType

That was just an aside - main problem is that Indians cannot burn a fort if there is a ship in the harbour - I've tried to summon the beast ;)

EDIT: I just remembered I recently posted something about this and Pocus couldn't see any problem. I'll try and create an example in an existing scenario.

Cheers, Chris

Posted: Fri Jan 30, 2009 8:39 am
by Hobbes
Hi folks, is it legit to have more than one CountUnit commands in a single event with different regions :-

CountUnits $Mackinaw|0|$GBR|0|=|0
CountUnits $Le Detroit|0|$GBR|0|=|0

I get some funny results but there may be something else wrong with the event.

Thanks, Chris

Posted: Fri Jan 30, 2009 12:15 pm
by lodilefty
Hobbes wrote:Hi folks, is it legit to have more than one CountUnit commands in a single event with different regions :-

CountUnits $Mackinaw|0|$GBR|0|=|0
CountUnits $Le Detroit|0|$GBR|0|=|0

I get some funny results but there may be something else wrong with the event.

Thanks, Chris


Funny? HaHa or wierd ;)

AFAIK this should be OK if it's in Conditions. {Acts as "AND" condition.}

What else is in event and what result are you seeing?

Posted: Fri Jan 30, 2009 1:13 pm
by Hobbes
lodilefty wrote:Funny? HaHa or wierd ;)

AFAIK this should be OK if it's in Conditions. {Acts as "AND" condition.}

What else is in event and what result are you seeing?


Thanks Lodi, I just thought I'd ask in case it was daft. I'll play around with the event tonight. I'll post it if I can't get it to work.

Cheers, Chris

Posted: Fri Jan 30, 2009 1:16 pm
by Hobbes
I was looking for an example of an event with multiple CountUnits commands but couldn't find one.
I wondered how the AACW close to Richmond event worked but that has :-

CountUnits $Close_to_Richmond|1|$USA|-1|>=|10

How does $Close_to_Richmond work here?

Cheers, Chris

Posted: Fri Jan 30, 2009 2:57 pm
by Pocus
This is a custom area, set in the areas.ini file.

Posted: Fri Jan 30, 2009 3:10 pm
by Pocus
Ahem...Something occurred to me. There is a command chain that create structures. It is used massively when you do the setup of a scenario:

CreateStruc
SetType = $City
SetName = Philadelphia
SetLevel = 10
Apply

:thumbsup:

I'll see if I can add one that remove a structure.

Scorched Earth?

Posted: Fri Jan 30, 2009 6:18 pm
by lodilefty
Pocus wrote:Ahem...Something occurred to me. There is a command chain that create structures. It is used massively when you do the setup of a scenario:

CreateStruc
SetType = $City
SetName = Philadelphia
SetLevel = 10
Apply

:thumbsup:

I'll see if I can add one that remove a structure.


:cool:

Will it also let us add a structure [city, port, village] by event?
We can already change structure by event, and can add a fort, depot, stockade or settlement, so this would 'round it out'. :D

Would it also make sense to add the Settlement, Stockade and Indian Villages to the "Scorched Earth" string? :blink:

IMHO, they should be 'treated' same as Fort or Depot... :w00t:

Posted: Fri Jan 30, 2009 7:17 pm
by Hobbes
lodilefty wrote: :cool:

Will it also let us add a structure [city, port, village] by event?
We can already change structure by event, and can add a fort, depot, stockade or settlement, so this would 'round it out'. :D

Would it also make sense to add the Settlement, Stockade and Indian Villages to the "Scorched Earth" string? :blink:

IMHO, they should be 'treated' same as Fort or Depot... :w00t:


I like that fact that settlements and villages are not burnt. It allows the designer to leave something in an objective area rather than it just becoming an empty region - and unlike forts Indians can occupy and gain the VP from settlements and villages, I'm sure they didn't raise most of them to the ground. Hopefully we will get a command to remove structures and then a designer can always remove a settlement if he wants to.

Cheers, Chris

Posted: Sun Feb 01, 2009 8:38 am
by Pocus
If I remember the code, the scorch rule burn level 1 city (that you call them village or settlement is a pure flavor thing for the code). Not the rest.

And yes, you can add structures with the syntax I gave you. Setup = 1 big event.

Posted: Sun Feb 01, 2009 11:37 am
by Hobbes
Pocus wrote:If I remember the code, the scorch rule burn level 1 city (that you call them village or settlement is a pure flavor thing for the code). Not the rest.

And yes, you can add structures with the syntax I gave you. Setup = 1 big event.


In my testing the settlements are not burnt but owned by the Indians - I'm happy with it working this way. Only forts and stockades seem to get burnt (unless there is a ship in the harbour :) ).

Cheers, Chris

Posted: Fri Feb 06, 2009 3:20 pm
by Hobbes
Pocus wrote:Ahem...Something occurred to me. There is a command chain that create structures. It is used massively when you do the setup of a scenario:

CreateStruc
SetType = $City
SetName = Philadelphia
SetLevel = 10
Apply

:thumbsup:

I'll see if I can add one that remove a structure.


I just tried this under Actions :-

CreateStruct NULL
SetType $Settlement
SetName Michilimackinac
SetLevel 1

The event fires OK but no settlement appears.
I've tried this with
CreateStruct Region $Mackinaw
and
CreateStruct NULL NULL NULL NULL $Mackinaw

But no luck.
Any ideas?

Cheers, Chris

Posted: Fri Feb 06, 2009 3:33 pm
by Pocus
I know about the harbor, I still have your mail, pending :)

Posted: Fri Feb 06, 2009 6:23 pm
by Hobbes
Thanks Philippe, it would nice to see the Indians able to take a region if only a few ships are in a harbour.

On another point - I just tried this in an event under Actions :-

CreateStruc NULL
SetType $Settlement
SetName Michilimackinac
SetLevel 1

The event fires OK but no settlement appears.
I've tried this with :-

CreateStruc Region $Mackinaw
and
CreateStruc NULL NULL NULL NULL $Mackinaw

But no luck.
Any ideas? Not sure If I understood how to put this into an event.

Cheers, Chris
P.S. attached the full event. I'm trying to create a settlement in Mackinaw on the first turn Indians exist in the region but no British units.

Posted: Fri Feb 06, 2009 11:51 pm
by lodilefty
Hobbes wrote:Thanks Philippe, it would nice to see the Indians able to take a region if only a few ships are in a harbour.

On another point - I just tried this in an event under Actions :-

CreateStruc NULL
SetType $Settlement
SetName Michilimackinac
SetLevel 1

The event fires OK but no settlement appears.
I've tried this with :-

CreateStruc Region $Mackinaw
and
CreateStruc NULL NULL NULL NULL $Mackinaw

But no luck.
Any ideas? Not sure If I understood how to put this into an event.

Cheers, Chris
P.S. attached the full event. I'm trying to create a settlement in Mackinaw on the first turn Indians exist in the region but no British units.


You're seeing the result of the splitter.

Single line under actions, needs to look just like a line in setup tab:

USA Athens Structure_Settlement 1 NULL NULL NULL $Shawnee 0 1


as seen in Fallen Timbers DB