ruff_hi
Live 4ever! Or die trying
I have a couple of python questions.
Stuff I can do / already have done
I've randomly (I have code to do the random part) added a direction to the name of my units (eg for south). The direction will depend on the type of unit and will be randomly assigned. EG. A worker will get [F] (free movement) 80% of the time and one compass direction the other 20% of the time (5% each direction). So, 5% of my workers with have [N], 5% , etc at the end of their name.
Stuff I need help with
Why do I want to do this? I'm putting together this mod so that I can play a really stupid Succession Game where your units have restricted movement.
Stuff I can do / already have done
I've randomly (I have code to do the random part) added a direction to the name of my units (eg
Stuff I need help with
- How do I parse a unit name (ie test if the name ends with ']' so that I can tell if I have already given a unit a name? (in VBA I would just use right(name,1) = "]")
- I also need to be able to extract the actual direction (in VBA, the mid function)
- How do I determine the type of unit it is (ie worker, archer, melee, etc)?
- How do I restrict a unit with '[N]' at the end of its name from moving North?
- I also need to turn that restriction off if the unit is on a boat (ie a boat carrying a '[N]' unit can move north).
Why do I want to do this? I'm putting together this mod so that I can play a really stupid Succession Game where your units have restricted movement.