MapScript Question - Can i add units at start location via map Script ?

Refar

Deity
Joined
Apr 10, 2005
Messages
4,608
The thread title say it all...

I would like to construct a map script, where a additional unit is added on the starting location of each civ - depending on surrounding terrain for example.

Any hints, how i would need to go about this ?
 
I don't know why , but if you try to assign some units , there is some problems with other civs . Player 0 will get all but for other players the units are skipped . I've seen in the SDK that's because when the process add initial items , it check if there is already units for the player .

I've also encounter some bug doing that (except with barbarian units) . But i've not try to add some units with the last BtS patch . This bug will perhaps not occur anymore .

The way i use to add some units with my script is to add an event in the event manager , call it during map generation (it's done after onGameStart) and delete the event in CvEventManager when the units are added .

Tcho !
 
Thanks.
That was fast :D
 
If you want to check my example , you can download the beta version of full of resource :

You can check this 3 functions :

_ the event is launch in normalizeAddExtra
_ the global to check if the event is doable in initCanUseGameOptions (be carefull that this global is changed if the player use lock modified assets (that make bugs the event add)
_ initStoAddEvent where the event is added .
_ check the function added with initStoAddEvent

Tcho !
 
Back
Top Bottom