HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

armor system..

03-07-2005, 01:21 AM#1
Ponzini
Ok this will be a bit difficult for me to explain. I am making a Natural Selection map and have been working on making an armor system. From the information on their website it says that the light armor has a 70% reduction to damage. And if you acquire heavy armor its 95%. You start as light armor with 25 points into it.

Now I have been working on this alot and nothing is working for me. Ok I know this is a buggy trigger proably since I scrapped the idea because it isnt gonna work. I am just trying to show where im going at:

Quote:
Events
Unit - A unit Is attacked

Conditions
CurrentArmor[(Player number of (Owner of (Attacked unit)))] Greater than 0

Actions
Set CurrentHealth[(Player number of (Owner of (Attacked unit)))] = (Integer((Life of (Attacked unit))))
Wait 2.00 game-time seconds
Set Damage = (((Real(CurrentHealth[(Player number of (Owner of (Attacked unit)))])) - (Life of (Attacked unit))) x 0.30)
Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + ((Real(CurrentHealth[(Player number of (Owner of (Attacked unit)))])) - (Life of (Attacked unit))))
Set CurrentArmor[(Player number of (Owner of (Attacked unit)))] = (CurrentArmor[(Player number of (Owner of (Attacked unit)))] - (Integer(Damage)))
Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) - Damage)

I had to throw in the wait 2 seconds because the damage had not yet been done to the unit. So I got its health before it hit and after then I found out the damage that was done, multiplied by 30% to get the 70% reduction and took that 30% from the units health and armor. This worked when a unit would attack really slow to wait for the 2 second wait time which wouldnt work because I have fast firing weapons.

So I am trying another idea to make it so that the unit will have the damage reduced on contact. I basically guessed and checked to find out 38 armor on a unit is 70% reduction which works. Now im having the same problem of making it take that damage from the armor.

I really didnt like both ways while doing them because its kind of sloppy. Any ideas at all on how I can start the trigger maybe when it does the damage or any other ways of how this will work?

Thanks for all help!!
03-07-2005, 06:24 AM#2
Raptor--
well personally i'd hold all players damages/armors in an array, and cause players to do no damage by changing the damage % to 0, and then basically do everything through triggers

i'd use the event "unit - takes damage" its a specific unit event, so just add the event to the trigger dynamically as new units are made, so it would calculate the damage based on the attacking player's damage reduced by the armor, and then use the damage unit trigger to do the actual damage with a temp unit

but then again i like to rely everything on triggers and variables
03-07-2005, 07:25 AM#3
Pheonix-IV
Set the units armor to 38 or edit the armor values to whatever you want. Then create an ability with X number of levels (X being the maximum amount you want armor to drop) thats based on the item ring of protection ability but has a negative armor bonus. Then have a trigger thats something like this:

Use the unit - takes damage event dynamically like Raptor said, but have the actions as follows:

If custom value of unit taking damage equal to 0 then do:
Add Devalue Armor to unit taking damage and set unit taking damage custom value to current custom value of unit taking damage + 1.
Else do
If custom value of unit taking damage equal to 1 then do:
Increase level of Devalue Armor for unit taking damage and set unit taking damage custom value to current custom value of unit taking damage + 1.
Else do (repeat above trigger as needed)

Then, to reset the armor simply have a trigger that removes the ability.


If you want a more detailed description or an example map, i can provide them.