Page 1 of 1
Unit experience, damage taken and dealt?
Posted: 16 May 2011, 16:41
by smoth
Trying to track these.
Has anyone figured out how to accurately log them on a per player basis?
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 17:30
by knorke
Spring.GetTeamStatsHistory ?
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 18:58
by smoth
Per unit?
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 19:06
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
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 19:20
by smoth
What about xp?
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 19:25
by knorke
Spring.GetUnitExperience ?
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 19:46
by Regret
knorke wrote:Spring.GetUnitExperigence ?
I guess to track experience gained one would have to compare present/past experience of attacker in UnitDamaged.
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 20:10
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
Re: Unit experience, damage taken and dealt?
Posted: 16 May 2011, 22:04
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
Re: Unit experience, damage taken and dealt?
Posted: 17 May 2011, 00:36
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.
Re: Unit experience, damage taken and dealt?
Posted: 17 May 2011, 01:49
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.
Re: Unit experience, damage taken and dealt?
Posted: 17 May 2011, 01:55
by knorke
and then the goli shots the jeffy and there it goes flying in pieces.
whats your point?
Re: Unit experience, damage taken and dealt?
Posted: 17 May 2011, 02:22
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.
Re: Unit experience, damage taken and dealt?
Posted: 17 May 2011, 03:23
by smoth
last hit, I get all xp, I win.
Re: Unit experience, damage taken and dealt?
Posted: 17 May 2011, 08:32
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.