concept question #enemies around unit increase damage taken?

concept question #enemies around unit increase damage taken?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
saberRattler
Posts: 9
Joined: 27 Oct 2011, 04:27

concept question #enemies around unit increase damage taken?

Post by saberRattler »

trying to think of a way to implement this idea from http://aichallenge.org/

under battle resolution in game specification:

Code: Select all

(enemies(of my unit) in range of ant) >= (enemies(of enemy unit) in range of enemy)
Is this possible?

I was thinking of taking a circle radius around my unit and finding all units in that circle, take # friends and # foes and adjusting UnitDamaged() by some percent multiplied by the # of friends(less damage) or foes(more damage)...any opinions? Will calculating all of this slow the game too much?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: concept question #enemies around unit increase damage taken?

Post by knorke »

yes, that is possible and should not be too hard.
getting units in circle: Spring.GetUnitsInCylinder
http://springrts.com/wiki/Lua_SyncedRead#GetUnits
Will calculating all of this slow the game too much?
should be doable without too much slowdown, of course depends on number of units etc.

Maybe it will be faster to call Spring.GetUnitsInCylinder every n frames, (instead of every time a unit gets damaged) and store the results. Depends on how many units you have, how fast they shot etc.
saberRattler
Posts: 9
Joined: 27 Oct 2011, 04:27

Re: concept question #enemies around unit increase damage taken?

Post by saberRattler »

sounds good, will try this out :)
Post Reply

Return to “Lua Scripts”