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.
Upgrade system
Moderator: Moderators
Re: Upgrade system
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
use return value of UnitDamaged to do "quad damage."
http://answers.springlobby.info/questio ... e-upgrades
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Upgrade system
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.
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.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Upgrade system
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...
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
it can be used at unit predamaged.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Upgrade system
Does "applying a percentage to them (unitdefs)" mean anything?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Upgrade system
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.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Upgrade system
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.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Upgrade system
Yeah, that's the impression I was getting
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Upgrade system
Here, I will write the gadget for you:
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.
Code: Select all
function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam)
local newDamage = damage
*** ARBITRARY LOGIC ***
return newDamage
end