fortyporkpies -> RE: Lua - Damage Points and List of Sides (9/22/2017 7:45:22 PM)
|
quote:
ORIGINAL: apache85 Also, I was wondering if there's a way to return all the sides that are in a scenario? Something like: ScenEdit_ListSides() --returns a table of sides with name and guid p_side = ScenEdit_PlayerSide()
side = VP_GetSide({name=p_side})
for i = 1,#side.units do
unit = ScenEdit_GetUnit({guid=side.units[i].guid})
damage = unit.damage
damage_start = tonumber(damage.startdp)
damage_current = tonumber(damage.dp)
if damage_current < damage_start then
ScenEdit_SetUnit({guid=unit.guid,damage={dp=damage_start}})
end
end Any suggestions? Hi Apache- As a crude workaround, could you briefly switch the player's side awareness to omniscient , grab all the contacts from that side, parse all those contacts with a for..do loop, get each contact's side and side guid info, add this info to a table - checking for duplicates, then switch the side back to normal awareness? This is suboptimal because a)every side would have to have at least one unit when the routine is run; b) the map would have to be zoomed somewhere that wouldn't reveal "spoilers" for the player-side; Is something like that feasible?
|
|
|
|