Unit experience, damage taken and dealt?

Unit experience, damage taken and dealt?

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

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Unit experience, damage taken and dealt?

Post by smoth »

Trying to track these.

Has anyone figured out how to accurately log them on a per player basis?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit experience, damage taken and dealt?

Post by knorke »

Spring.GetTeamStatsHistory ?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Unit experience, damage taken and dealt?

Post by smoth »

Per unit?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit experience, damage taken and dealt?

Post by knorke »

Code: Select all

damageDealt = {}

UnitCreated (blabla unitid)
  damageDealt[unitid] = 0
end

UnitDamaged (blabla attackerid, damage, bla) 
  damageDealt[attackerid] = damageDealt[attackerid] + damage
end

UnitKilled (unitid, bla)
  damageDealt[unitid] = nil
end
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Unit experience, damage taken and dealt?

Post by smoth »

What about xp?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit experience, damage taken and dealt?

Post by knorke »

Spring.GetUnitExperience ?
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Unit experience, damage taken and dealt?

Post by Regret »

knorke wrote:Spring.GetUnitExperigence ?
I guess to track experience gained one would have to compare present/past experience of attacker in UnitDamaged.
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: Unit experience, damage taken and dealt?

Post by KaiserJ »

you may want to consider somehow applying XP within a radius of a dying enemy; otherwise you'll just end up feeding the units with the strongest attacks
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Unit experience, damage taken and dealt?

Post by smoth »

Thing is spring has a built in xp system with levels and all but I have no idea how it works. I like the current but want to boost it for healing peeplz/taking damage(for tanks) so that not just fighters get xp out the yoohoo
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit experience, damage taken and dealt?

Post by knorke »

Thing is spring has a built in xp system with levels and all
afaik it is just a number that goes up when a unit deals damage, no levels or something.
it increases health and some other things like accurracy/target leading.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Unit experience, damage taken and dealt?

Post by Forboding Angel »

Moreover, it is biased towards units to that have short reload times attacking large units. For example a unit with a laser that has a reload of 0.1 and does 1 damage per hit shooting a unit that is worth much more than it will rack up experience at a stupidly high rate. Imagine jeffy with reload rate of 0.1 shooting a goliath. Does practically no real damage, but by the time the golly has died, the jeffy has 5x the amount of health it started with.

If it were weighted upon actual damage done, it would be a quite good system.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit experience, damage taken and dealt?

Post by knorke »

and then the goli shots the jeffy and there it goes flying in pieces.
whats your point?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Unit experience, damage taken and dealt?

Post by Forboding Angel »

now imagine that the weapons are reversed

Golly has uber hp but a little pew pew laser that does fuckall for damage but fires rapidly. 2 Gollies meet, and start firing upon each other, neither can kill the other because xp builds up so exponentially.

Before you know it, gollie has tripled it's hp.

That's the point. It's dependent upon shots fired and metal cost of the target, and as such it's a very broken system.

Best system would be xp gained for kills. Not for shots landed.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Unit experience, damage taken and dealt?

Post by smoth »

last hit, I get all xp, I win.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Unit experience, damage taken and dealt?

Post by Google_Frog »

For experience: Lua it. As Forboding pointed out the xp gaining system is a bit broken. Also units do not have levels and only HP and Reload Time can be modified. They follow a hardcoded curve based on XP which can be scaled with modrules.

Anyway back to the topic. To track damage taken and dealt use
function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam)
You can keep a table and track whatever you want with this. Be aware that projectiles from dead units will have nil attackerID and attackerTeam (I cannot recall what attackerDefID does in this situation). So for example a unit that is a single shot missile will never have damaged registered for it's team.
Post Reply

Return to “Lua Scripts”