Page 1 of 1
Upgrade system
Posted: 18 Feb 2012, 01:48
by Forboding Angel
Look I want to do something fairly simple, but I don't know how.
I want to unlock upgrades if a certain unit exists. These upgrades would affect damage taken and dealt
For example, lets say I have 2 categories, weapons and armor.
Having Weapons upgrade 1 adds a modifier in unitdefs post that increases all damage dealt by a percentage, say 5% or something. Triggered by whether a unit exists.
So for example, player builds unit, unitdefs post gets triggered adding the modifier as long as that unit exists.
Is this difficult? Am I over simplifying it?
Basically what I would like is significantly more detailed, but I'm settling for what I might be able to actually pull off. Hopefully that makes sense.
Re: Upgrade system
Posted: 18 Feb 2012, 02:10
by knorke
you can not change unitdefs while the game is running, not even with unitdefs_post.
use return value of UnitDamaged to do "quad damage."
http://answers.springlobby.info/questio ... e-upgrades
Re: Upgrade system
Posted: 18 Feb 2012, 02:21
by Google_Frog
Use gadget:UnitPreDamaged for weapons and armour.
You will have to investigate each individual upgrade you wish to include. Some can be done through gadget callins, some can be done with Spring.SetUnitWeaponState, others with Spring.MoveCtrl.SetGroundMoveTypeData and many are probably impossible without a unit swap.
Re: Upgrade system
Posted: 18 Feb 2012, 05:48
by Forboding Angel
I'm sorry, I don't mean editing the unitdefs, I mean applying a percentage to them.
For example, the armor system used by evo and gundam will modify damage based upon a unitdef and weapondef entry (entry being what the damagetype is vs armortype) and it modifies it when it happens.
Basically takes the total value and applies a modifier to it. Could that method be used?
Hmm maybe you guys already answered my question and I didn't realize it...
Re: Upgrade system
Posted: 18 Feb 2012, 06:13
by smoth
it can be used at unit predamaged.
Re: Upgrade system
Posted: 18 Feb 2012, 07:53
by Google_Frog
Does "applying a percentage to them (unitdefs)" mean anything?
Re: Upgrade system
Posted: 18 Feb 2012, 21:55
by Forboding Angel
I just happened to think... Is it even possible to apply boosts to one team or another? The armor stuffs that gundam and evo use are global. I didn't think of that till late last night.
Re: Upgrade system
Posted: 19 Feb 2012, 00:58
by Google_Frog
It is possible to do what you want but you seem to be confused about the technicalities. The way you think should be possible is probably not possible.
Re: Upgrade system
Posted: 19 Feb 2012, 02:30
by Forboding Angel
Yeah, that's the impression I was getting
Re: Upgrade system
Posted: 19 Feb 2012, 14:08
by Google_Frog
Here, I will write the gadget for you:
Code: Select all
function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam)
local newDamage = damage
*** ARBITRARY LOGIC ***
return newDamage
end
The damage value passed to the function takes all the hardcoded engine armour into account. Afair that is armormod, damages vs different armor types and damage falloff from things like AOE and falloff lasers.