help with events program

Post bug reports and ask for tech support here. Post any Community Site Requests here as well.

Moderator: Vic

Post Reply
LJBurstyn
Posts: 626
Joined: Tue Apr 19, 2011 11:29 am

help with events program

Post by LJBurstyn »

When I use the exec event code to give an area to another regime (using to surrender a people)
area slot, area code, new regime, what happens to units

the codes on what happens to people
-1 destroyed all units
-2 leaves ALL units as is but changes their loyalty to new regime
0-up forces unit to another area

What I would like is change the owner of the hex to a new regime UNLESS it is occupied by a unit of another people who
remain loyal to the regime they belonged to

goal: German troops in Italy remain in place and remain loyal to Axis when Italy surrenders.

ALSO
the change morale execute command
???(regime, mutation = +-points) does nothing apparently.
I don't want morale to be set at another point I just want a temporary decrease/increase in morale.
User avatar
Vic
Posts: 9931
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: help with events program

Post by Vic »

For the core question: To accomplish that quite specific goal I would write something like this:

LOOPER tempvar0 to CheckMapWidth
.LOOPER tempvar1 to CheckMapHeight
..tempvar2=CheckRegime(tempvar0,tempvar1)
..CHECK (tempvar2 = Italy)
...tempvar3=0
...LOOPER tempvar4 to ChecHexUnitCounter()
....tempvar5= CheckHexUnit(tempvar0,tempvar1,tempvar4)
....tempvar6= CheckUnitRegime(tempvar5)
....CHECK tempvar6==Italy
.....tempvar3=1
....END CHECK
...END LOOPER
...CHECK tempvar3=0
....SetHexRegime(Germany)
...END CHECK
..END CHECK
.END LOOPER
END LOOPER

But to be honest the exploit here for Italy is to put just empty units everywhere. So I would do a power point check on the unit before counting it as italian occupation.

For the other question..
There are the following execs

ExecAddRegimeMorale = Adds points or removes points from base morale. This has no direct impact on units on map. But does reduce/increase their maximum morale they rise to naturally
ExecSetBaseMorale = Sets a new basemorale for a regime (and makes a percentual change similar to all units on the map)

There is also ExecSetPeopleMorale but that one is a bit more complicated to explain. I think ExecSetBaseMorale is the one you are looking for.

Best wishes,
Vic
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
LJBurstyn
Posts: 626
Joined: Tue Apr 19, 2011 11:29 am

RE: help with events program

Post by LJBurstyn »

Here's how I solved the problem for the capture of Norway by Germans.

Looper0 84 to 137 (hex eastmost to westmost of Norway.
Looper1 7 to 53 (same south/north)
CheckSlot (0,1,1)=13 (Norway was set up as Slot 1, Value 13)
ExecRemoveTroopsbyPeople (0,1,21,100) {Remove Norwegians)
CheckHexUnitCounter(0,1) = -1 {check hex for any unit counters -1 means none)
execSetHexOwner (0,1,0) set any unoccupied hex to German)
EndCheck
EndCheck
EndLooper
EndLooper


Darn spacing did not work...
This leaves all other people's troops as placed and does not change hex owner. So British troops in Norway suddenly
find themselves without any Norwegians . . can be very bad or not for British. Allows them to continue the fight
for Norway...since EVERY nation has it's own slot 1 value can be done for every nation. Used slot so I don't include
other nations or empty sea in check routine.

I just want to temporarily lower morale not permanently set it lower...all your commands seem to permanently lower it
'

BTW to discourage the setting of empty units each unit created cost 1 PP (hq cost 3).





User avatar
cpdeyoung
Posts: 5392
Joined: Tue Jul 17, 2007 3:26 pm
Location: South Carolina, USA

RE: help with events program

Post by cpdeyoung »

Code: Select all

 Looper0 84 to 137 (hex eastmost to westmost of Norway. 
     Looper1 7 to 53 (same south/north) 
         CheckSlot (0,1,1)=13 (Norway was set up as Slot 1, Value 13) 
             ExecRemoveTroopsbyPeople (0,1,21,100) {Remove Norwegians) 
             CheckHexUnitCounter(0,1) = -1 {check hex for any unit counters -1 means none) 
                 execSetHexOwner (0,1,0) set any unoccupied hex to German) 
             EndCheck 
         EndCheck 
     EndLooper 
 EndLooper 
 

@Larry

There are code tags.

Chuck
Post Reply

Return to “Advanced Tactics Support”