This would be for target acquisition control that does not require extensive unit target checks. (I assume power is a unit attribute used in target acquisition...)
Something like "Spring.SetUnitPower(unitID, newPower)". If this was added a getter would be useful as well.
I know you can currently modify xp for limited control of power but that is a really really bad workaround.
dynamic power control
Moderator: Moderators
Re: dynamic power control
i think this is already possible using TargetWeight and BlockShot in unit scripts? I never got that to work though 
In this file: https://github.com/spring/spring/blob/m ... LuaRules.h the callins AllowWeaponTargetCheck & AllowWeaponTarget also look promising. (for 0.83)

In this file: https://github.com/spring/spring/blob/m ... LuaRules.h the callins AllowWeaponTargetCheck & AllowWeaponTarget also look promising. (for 0.83)
Assuming the game uses experienceMult=0 and xp is used for nothing else, what side effects does it have?I know you can currently modify xp for limited control of power but that is a really really bad workaround.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: dynamic power control
The request stems from this thread. In this example I would like to make every single unit treat this unit as a less important target when closed, this would be trivial to do in the unit script if lua could modify power.
The new callins look promising but they seem like overkill for this application. Any solution with these callins looks like it would be slower than a power modification as every unit would need to use the callin to modify the weight of a single target.
This gives a limit range; power range = default power*[1, 1+powerScale)
To be able to 'lose power' a unit must be created with xp. Anyway ZK uses XP to some extent so this isn't a solution. It demonstrates to me that power modification during the game is technically possible (well the parameter could be broken....)
The new callins look promising but they seem like overkill for this application. Any solution with these callins looks like it would be slower than a power modification as every unit would need to use the callin to modify the weight of a single target.
From a comment in modrules.luaAssuming the game uses experienceMult=0 and xp is used for nothing else, what side effects does it have?
Code: Select all
power = default power * (1 + (powerScale * xp/(1 + xp) ) )
To be able to 'lose power' a unit must be created with xp. Anyway ZK uses XP to some extent so this isn't a solution. It demonstrates to me that power modification during the game is technically possible (well the parameter could be broken....)