luafy the aim/targeting/priorty code please?
Moderator: Moderators
luafy the aim/targeting/priorty code please?
The reason I am asking is because many projects include armor systems(s44, gundam, 0k) which should definitely effect target priority/selection. However, as it stands we cannot take these sort of things into account and have this weird power tag which cannot take take into account the armor class systems employed by the games.
So is it possible to break this out into lua instead of hard-coded in the engine? Would it hurt performance?
*INB4LUAIT* I don't want to do a targeting override gadget as I would be fighting the spring targeting system
So is it possible to break this out into lua instead of hard-coded in the engine? Would it hurt performance?
*INB4LUAIT* I don't want to do a targeting override gadget as I would be fighting the spring targeting system
Re: luafy the aim/targeting/priorty code please?
There's an argument that this is already possible through the script callins like BlockShot & TargetWeight...
Re: luafy the aim/targeting/priorty code please?
Already done, wait for 0.83.
Code: Select all
AllowWeaponTargetCheck(attUnitID, attWeaponNum, attWeaponDefID) --> true | false
AllowWeaponTarget(attUnitID, tgtUnitID, attWeaponNum, attWeaponDefID) --> true | false [, tgtPriority]
Re: luafy the aim/targeting/priorty code please?
Ah sweet, even better. How exactly do they work?
Re: luafy the aim/targeting/priorty code please?
That's best explained by some pseudocode:FLOZi wrote:Ah sweet, even better. How exactly do they work?
Code: Select all
Engine:SlowUpdate()
for every unit u
for every weapon w of u
if Lua:AllowWeaponTargetCheck(u, w, ...)
for each potential target unit t in range of w
allowed, priority = Lua:AllowWeaponTarget(u, t, w, ...)
if allowed
insert t into target list of w with returned priority
else
-- this is subject to change (I may have it skip t
-- entirely if the callin exists but returns false,
-- as opposed to when it doesn't exist at all)
calculate priority value via hardcoded logic
insert t into target list of w with that value
sort target list by priority (increasing order)
for each target t in list
if t can be hit by w
select t as target for w; break
False, enough with the FUD.knorke wrote:nobody knows.
Re: luafy the aim/targeting/priorty code please?
"nobody knows" as in "i would like to know more."
BlockShot is quite obvious (though I do not understand in what details it is different from return true/false in AimWeapon) and seems to work but on how TargetWeight and UnitScript.SetUnitValue(COB.CHANGE_TARGET, 1) work I understood practically nothing.
ie what is up with that:
But of course more functions and info on all that is always greatly appreciated.
Maybe related request:
scripts chosing what weapon the unit uses for manouering/getting in range, maybe also with weighting between multiple weapons.
Right now it seems to be done using a fake weapon1 which seems to have some problems (?)
BlockShot is quite obvious (though I do not understand in what details it is different from return true/false in AimWeapon) and seems to work but on how TargetWeight and UnitScript.SetUnitValue(COB.CHANGE_TARGET, 1) work I understood practically nothing.
ie what is up with that:
If we knew how it works then I think what smoth wants is already possible.Rafal on Q&A page wrote:I am working on it and have a half ready solution that works if userTarget == false. The problem is that Spring ingores COB.CHANGE_TARGET if userTarget == true, and it is true in most cases.
It is true if you tell the unit to attack, but is also true if the unit is idle and something gets into range and it starts firing. It is only false if the unit has some non-combat order in its queue
But of course more functions and info on all that is always greatly appreciated.
Maybe related request:
scripts chosing what weapon the unit uses for manouering/getting in range, maybe also with weighting between multiple weapons.
Right now it seems to be done using a fake weapon1 which seems to have some problems (?)
Re: luafy the aim/targeting/priorty code please?
Cool. Can BA and ZK and all the other games with anti-air-specific weapon and aircraft-that-lands amend their SAM code to target *all* airborne units and ignore landed units? And make anti-ground weapons target (and harm) landed aircraft? Because the current behavior of landed aircraft being magically different from other units on the ground seems silly.
Re: luafy the aim/targeting/priorty code please?
Thanks. I'm a little unsure of what happens if AllowWeaponTargetCheck returns false, though?Kloot wrote:That's best explained by some pseudocode:FLOZi wrote:Ah sweet, even better. How exactly do they work?
*snip*
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
Re: luafy the aim/targeting/priorty code please?
Is there going to be a way to get hold of the list of targets the unit is considering cause 'AllowWeaponTarget' doesn't seem to allow you to implement BadTargetCategory if you don't know what else the unit would target if you declined the check... (See: http://springrts.com/phpbb/viewtopic.php?f=21&t=23417)
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: luafy the aim/targeting/priorty code please?
I would like a list of possible targets as well. I would like to implement dynamic bad targets for status effect weapons that gain nothing from attacking a unit once the unit is fully effected. It is much like the current hardcoded retarget behaviour for EMP.
Re: luafy the aim/targeting/priorty code please?
So do these callings allow to replace OnlyTargetCategory with custom code or not yet?
I would like to be able to change unit's targetCategory in real time.
Possible uses are submarines surfacing/submerging and aircraft landing/taking off.
An Anti-Air cannon that cannot shoot ground units but somehow can shoot landed aircraft doesn't make much sense.
I would like to be able to change unit's targetCategory in real time.
Possible uses are submarines surfacing/submerging and aircraft landing/taking off.
An Anti-Air cannon that cannot shoot ground units but somehow can shoot landed aircraft doesn't make much sense.
Re: luafy the aim/targeting/priorty code please?
That was what i wanted for capture - prevent allies froma ttacking unit being captured and focus capture power on same unit.Google_Frog wrote:I would like a list of possible targets as well. I would like to implement dynamic bad targets for status effect weapons that gain nothing from attacking a unit once the unit is fully effected. It is much like the current hardcoded retarget behaviour for EMP.