Page 1 of 1

Sickness and Desertions

Posted: Sun Sep 30, 2007 1:55 am
by McNaughton
I am trying to incorporate events represent average sickness and troop desertions. Here's what I have so far...

Code: Select all

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

Conditions
  MinDate = 1861/06/01
  Probability = 50
  PickUnit = $West;1;$Regular
  GenMsg
  EvalUnitSel = NULL

Actions
  GenMsg
  DescEvent = evt_desc_USA_Epidemics_West
  ChgGroupHealth = -10

EndEvent


Basically, I took the 'epidemics' event and modified it so it could happen every turn, and increased the probability to 50 and reduced the cohesion loss (I don't want units to fight with less efficiency, just have a constant drain on manpower and resources).

The 999 represents that this event keeps on triggering turn after turn, with the region being the area that the event effects.

Regular, I assume, targets 'combat stacks' as I have seen all combat forces face reduction, but not supply units (they don't fit under regular, I suppose).

Change Group Health affects the entire stack.

--FIRST ATTEMPT--

I was hoping to have an event similar to unit upgrades, so that a single element in a brigade may experience losses at different rates than other units in the element (similarly to how regiments upgrade from early to late infantry), however it doesn't seem to work. I would perfer this event to the one above, as the frequency is lower (appears to only affect one unit per region, unless I make multiple events) plus it affects every element and unit in the stack.

Here it is... (the event that does nothing)

Code: Select all

SelectFaction = $USA
SelectRegion = $Prince George's, MD
StartEvent = evt_nam_USA_GeneralSicknessInfantry|999|0|NULL|NULL|$Prince George's, MD|NULL

Conditions
  MinDate = 1861/06/01

Actions
  GenMsg
  DescEvent = evt_desc_USA_Epidemics_Deep_South
  SelectSubUnits = Models $mdl_USA_InfBM1 $mdl_USA_InfBM2 $mdl_USA_InfBM3 $mdl_USA_InfBM4 $mdl_USA_InfBM5 $mdl_USA_InfBM6 $mdl_USA_InfBM7 $mdl_USA_InfBM8 $mdl_USA_InfBM9 $mdl_USA_InfBM10 $mdl_USA_InfBM11 $mdl_USA_InfBM12 $mdl_USA_InfBM13 $mdl_USA_InfBM14 $mdl_USA_InfBM15 $mdl_USA_InfBM16 $mdl_USA_InfBM17 $mdl_USA_InfBM18 $mdl_USA_InfBM19
  AlterCuSubUnit = ApplyToList;probability 20;ChgHealth -10

EndEvent


Any clue as to why my last event doesn't affect element health?

--EXTENSIONS--

I want to do an event representing desertions, especially when cohesion gets very low, or when NM is below a certain rate.

Posted: Sun Sep 30, 2007 7:46 am
by Pocus
(editing my previous post)

syntax appears correct, what happen exactly, you should check scriptreport.txt imho.

Posted: Sun Sep 30, 2007 2:21 pm
by McNaughton
Will do, however it may be that my -10% effect was too small to actually notice in a quick scan (the NATO icon will only show red if a higher % of loss is experienced). So, I will test it again with greater loss to see if it is more noticable and actually works. Thanks for the check!

Posted: Sun Sep 30, 2007 2:42 pm
by McNaughton
Here's what I get...

Code: Select all

Line 19433:  SelectFactions, 1 Faction selected: Confederate States of America
Line 19435:  Started processing event: evt_nam_CSA_GeneralSicknessInfantry
Line 19435:  Event already referenced, current occurences 1 Max allowed: 999   <<Active>>
Line 19438:  Min date evaluated: 1861/06/01 converted to turn  2675 current turn 2678  True
Line 19440:  Entering triggered actions for event evt_nam_CSA_GeneralSicknessInfantry
Line 19444:  [WARNING] AlterCuSubUnit: Selection is empty (Apply To List)
Line 19446:  Finished processing event: evt_nam_CSA_GeneralSicknessInfantry


Someting appears to be wrong about selecting and applying the event to particular units. The elements do exist (it was a copy of my modded tech upgrade events), the only change is a negative health change, as well as removing applying a new model to an old one.

Posted: Sun Sep 30, 2007 3:42 pm
by McNaughton
I figured out the problem.

If a model is not on the map, then it 'cancels' the event. I separated events, and those with Elite Models, and Colored Models, gave errors (These were the ones not on the map). So, I suppose that the event was cancelled when it couldn't find all of the models in the list. So, I will just have to have separate events for each model (to be safe).

Posted: Sun Sep 30, 2007 5:33 pm
by McNaughton
I have solved it 100%. Here's the result of the new event system...

I have limited the events to 'troop' units (excluding artillery, supply, medics, HQs and signals) as the cost to 'repair' would be prohibative (since only men will be lost due to sickness, not equipment).

Sickness includes... Ill health (ranging from mortal illness to illness that precludes military service forcing the soldier to return home or to hospital but does not kill them), accidents (incapacitating), murders, suicides, etc. All non-combat losses.

Rates are pretty much...

a 50% chance of an element experiencing a 'sickness' reduction of 1 health value (in my mod, 20-25 men, in original AACW numbers about 50 men) per turn (every 15 days).

However, every element has this 50% chance of reduction (a brigade may experience some units reduced, some not, in one given turn).

It occurs every turn, regardless on outcome of previous turn (maybe a unit will be lucky, and face no attrition, possibly it faces attrition every round).

--QUESTIONS--

#1. Limitations. Is there a command I could put in place where the event will not trigger if the element is damaged at a specific rate? I would like to have these sickness events 'pause' when a unit reaches 40% of its original strength, so a unit will not be totally destroyed by sickness alone.

#2. I am working on a similar reduction representing desertions. However, instead of it being constant, it would be tied to National Morale. If NM dips below 100%, desertions start. As it gets lower, the rate of desertion would increase slightly. Yet, like Sickness, I would like a limitation of this event so it would not affect units that are at a certain strength percentage (say, 40% again).

Is there...

A) A trigger that looks for element strength (not as important, as the decline rate is so low that replacements should cover losses)

B) A trigger that can determine national morale levels (if below or above a certain number)

Thanks again!

Posted: Sun Sep 30, 2007 5:51 pm
by Primasprit
Hi McNaughton!

McNaughton wrote:[...]
A) A trigger that looks for element strength (not as important, as the decline rate is so low that replacements should cover losses)

I know of no command which can do this.

B) A trigger that can determine national morale levels (if below or above a certain number)


[font="Courier New"]EvalMorale
(Condition)

Syntax:
EvalMorale = Operator; Value
EvalMorale = Operator; Faction

Value: Integer, morale value
Operator: [<,>,<=,>=]
Faction: Faction alias

Description:
EvalMorale compares the value of the National Morale of a selected faction with another value or the NM of another faction.[/font]

Cheers
Norbert

Posted: Sun Sep 30, 2007 6:01 pm
by Pocus
McNaughton wrote:I figured out the problem.

If a model is not on the map, then it 'cancels' the event. I separated events, and those with Elite Models, and Colored Models, gave errors (These were the ones not on the map). So, I suppose that the event was cancelled when it couldn't find all of the models in the list. So, I will just have to have separate events for each model (to be safe).


This is very strange, the command has no such limitation. I will have to check that myself.

There is no command for the limitation on health loss, for now, sorry.

Posted: Sun Sep 30, 2007 6:16 pm
by McNaughton
Pocus wrote:This is very strange, the command has no such limitation. I will have to check that myself.

There is no command for the limitation on health loss, for now, sorry.


This is what it says in the ScirptReport.txt

Code: Select all

Line 14274:  SelectFactions, 1 Faction selected: United States of America
Line 14276:  Started processing event: evt_nam_USA_SicknessInfantryEastLate1
Line 14276:  Event already referenced, current occurences 2 Max allowed: 999   <<Active>>
Line 14279:  Min date evaluated: 1861/06/01 converted to turn  2675 current turn 2679  True
Line 14281:  Entering triggered actions for event evt_nam_USA_SicknessInfantryEastLate1
Line 14285:  [WARNING] AlterCuSubUnit: Selection is empty (Apply To List)
Line 14287:  Finished processing event: evt_nam_USA_SicknessInfantryEastLate1


Basically, this warning on line 14285 appears in any of these events that has a model type that is not on the map (even if I say look for these 3 models, and 1 is not on the map, it says it is empty for all). A solution is to have a separate event for each model, as if the model is not on the map, it won't take down other models (that are on the map) with it.

Posted: Sun Sep 30, 2007 6:17 pm
by McNaughton
Primasprit wrote:Hi McNaughton!


I know of no command which can do this.



[font="Courier New"]EvalMorale
(Condition)

Syntax:
EvalMorale = Operator; Value
EvalMorale = Operator; Faction

Value: Integer, morale value
Operator: [<,>,<=,>=]
Faction: Faction alias

Description:
EvalMorale compares the value of the National Morale of a selected faction with another value or the NM of another faction.[/font]

Cheers
Norbert


Thanks a lot, this is exactly what I was looking for!

Posted: Sun Sep 30, 2007 6:24 pm
by Rafiki
McNaughton wrote:Thanks a lot, this is exactly what I was looking for!

I hereby pledge that I'll add at least one entry to the overview I've started putting together at the wiki each day till it is as complete as I can make it :)

Posted: Sun Sep 30, 2007 6:39 pm
by Primasprit
Rafiki wrote:I hereby pledge that I'll add at least one entry to the overview I've started putting together at the wiki each day till it is as complete as I can make it :)

The list of keywords I created isn't complete too, EvalEvent for example wasn't in it, I added it just now. I will post an updated document as soon as I added some more keywords which are waiting patiently in the queue. :)

Posted: Sun Sep 30, 2007 6:47 pm
by Rafiki
Sounds good :)

(How nice of you to add to my backlog ;) )

Posted: Sun Sep 30, 2007 6:56 pm
by Primasprit
Rafiki wrote:[...](How nice of you to add to my backlog ;) )

You are welcome. Causing work for others is what I can do best. :)

Posted: Fri Oct 05, 2007 10:20 pm
by hattrick
Hi McNaughton,

Very nice work!


How is this modication progressing, interested in trying it out?

Will the medical units have any effect to this loss if in the same stack?

It might make them more usefull.

Posted: Fri Oct 05, 2007 11:17 pm
by McNaughton
hattrick wrote:Hi McNaughton,

Very nice work!


How is this modication progressing, interested in trying it out?

Will the medical units have any effect to this loss if in the same stack?

It might make them more usefull.


I have tested the loss of manpower due to sickness attrition, and think maybe my values are a bit high (the AI seems to be barely holding on). I have also tested, and successfully ran the morale/desertion events (based on NM levels). I will have two events, one for less than 100, another for less than 50. If you have less than 50 NM, then you will get two desertion events having the possibility of firing per regiment, plus the sicnkess event (meaning that you could lose 3 hits a turn without combat or epidemics/weather affecting a unit).

It is presently for my mod, but, I will probably create a variation that will apply to the basic game (just overwrite a few event files).

Posted: Sat Oct 06, 2007 3:15 pm
by McNaughton
I am implementing a change. For an AI difficulty level of Normal or Greater the Sickness/Desertion events will not trigger (just for the AI).

I still notice that the AI lets their units go off into unsupplied regions, and weakens themselves already, I don't figure that they need extra help in weakening their forces via events.

These events should trigger for an Easy AI, as well as a Human Player.

However, desertion with a National Morale of under 50 will be in place for all variations of the AI.

Posted: Sun Oct 07, 2007 1:15 am
by hattrick
Sounds good, really looking forward to it. :dada:

Thanks for the update.

Posted: Tue Oct 16, 2007 3:33 pm
by Pocus
McNaughton wrote:This is what it says in the ScirptReport.txt

Code: Select all

Line 14274:  SelectFactions, 1 Faction selected: United States of America
Line 14276:  Started processing event: evt_nam_USA_SicknessInfantryEastLate1
Line 14276:  Event already referenced, current occurences 2 Max allowed: 999   <<Active>>
Line 14279:  Min date evaluated: 1861/06/01 converted to turn  2675 current turn 2679  True
Line 14281:  Entering triggered actions for event evt_nam_USA_SicknessInfantryEastLate1
Line 14285:  [WARNING] AlterCuSubUnit: Selection is empty (Apply To List)
Line 14287:  Finished processing event: evt_nam_USA_SicknessInfantryEastLate1
Basically, this warning on line 14285 appears in any of these events that has a model type that is not on the map (even if I say look for these 3 models, and 1 is not on the map, it says it is empty for all). A solution is to have a separate event for each model, as if the model is not on the map, it won't take down other models (that are on the map) with it.


You were right, I found a bug, but not in the command, more in how the aliases can be parsed or not... It works now (we will need that for NCP so I had to double check anyway). Thanks for spotting this one, this is most welcome.

Posted: Tue Oct 16, 2007 10:12 pm
by McNaughton
Glad that I could be of some help!