-
Notifications
You must be signed in to change notification settings - Fork 33
Modding Movement through units
Robosturm edited this page May 3, 2021
·
5 revisions
This is something a lot of people have asked or requested. After some thinking through. I came up with a solution that will/is possible with Beta Release 19
Step by steup walk through:
- Give a unit the ability to ignore unit collision. See oozium-code for an example.
- Change the movement cost function signature to:
this.getMovementpoints = function(terrain, unit, currentTerrain, trapChecking = false)
- Go to the movement table used by the given unit and add the following code:
var currentUnit = terrain.getUnit(); if ((currentUnit !== null) && (unit.getOwner().isEnemy(currentUnit .getOwner()))) { if (!currentUnit.isStealthed(unit.getOwner()) || trapChecking) { if (unit should not cross this currentUnit condition) { return -1; } } }
- Replace the pseudo code for when a unit should not cross through the other unit. E.g. an air unit should cross another air unit or a sea unit another sea unit etc. Be creative.
E-Mail-Contact: commanderwars@gmx.de ask for help here. :)