User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

CountUnits

Mon Jan 19, 2009 10:00 am

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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Mon Jan 19, 2009 12:46 pm

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
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]
[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]

[CENTER]Rules for new members[/CENTER]
[CENTER]Forum Rules[/CENTER]

[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

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

Mon Jan 19, 2009 1:40 pm

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


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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Mon Jan 19, 2009 2:03 pm

Ah, OK

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

Excellent!!!
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Mon Jan 19, 2009 4:09 pm

Thanks chaps!

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sat Jan 24, 2009 12:17 pm

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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Sat Jan 24, 2009 1:15 pm

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 ???
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sat Jan 24, 2009 1:30 pm

I'll give it another shot later on

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

Sat Jan 24, 2009 4:11 pm

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


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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sat Jan 24, 2009 6:18 pm

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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Sat Jan 24, 2009 6:24 pm

the Indians burn the fort before events are considered.


yes.
AFAIK, game engine does it's thing before events are processed...
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sat Jan 24, 2009 6:37 pm

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

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

Mon Jan 26, 2009 6:08 pm

yep, you have the game code (in hosting) and then in the end, the scripted events.
Image


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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Wed Jan 28, 2009 10:43 pm

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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Thu Jan 29, 2009 12:11 am

Did you try NULL where you have $Nothing ?

$Nothing will probably evaluate as structure type = 0 [Port], since it is undefined.
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Thu Jan 29, 2009 9:01 am

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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Jan 30, 2009 8:39 am

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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Fri Jan 30, 2009 12:15 pm

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?
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Jan 30, 2009 1:13 pm

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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Jan 30, 2009 1:16 pm

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

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

Fri Jan 30, 2009 2:57 pm

This is a custom area, set in the areas.ini file.
Image


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

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

Fri Jan 30, 2009 3:10 pm

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


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

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Scorched Earth?

Fri Jan 30, 2009 6:18 pm

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:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Jan 30, 2009 7:17 pm

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

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

Sun Feb 01, 2009 8:38 am

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


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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sun Feb 01, 2009 11:37 am

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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Feb 06, 2009 3:20 pm

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

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

Fri Feb 06, 2009 3:33 pm

I know about the harbor, I still have your mail, pending :)
Image


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

User avatar
Hobbes
Posts: 4438
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Feb 06, 2009 6:23 pm

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

[The extension xls has been deactivated and can no longer be displayed.]


User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Fri Feb 06, 2009 11:51 pm

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
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 4 guests