HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

New armor system with triggers, please help before my brain explodes

10-19-2003, 01:49 AM#1
Zealot888
The goal is to create an armor system like the one in Warcraft 2. Say we have footman who has 1 armor and a ghoul deals 10 damage (average). Each time the ghoul attacks the footman receives 1 HP, thus the real damage is 9 (10-1).

Isn't it possible to have a trigger that detects when a unit is attacked and then subtracts the units armor value (a variable) from the damage being dealt? If it is not possible to subtract this value from the damage about to be inflicted then the cheap alternative is to increase the HP of the attacked unit by its armor level each time it is attacked.

As Starcraftfreak puts it:
"Event:
A unit owned by player[#] is [attacked]
Condition:
Unit type of [Attacking Unit] =[*]"

As PitzerMike Puts it:
"Well, that shouldn't be the problem
you just set the life of the demaged unit to it's current life - the demage you want"

In either custom text or not how do you add a number to the attacked units life? Or how do you subtract from the damage that's about to hit him? If I am unclear in any way please say so.
10-19-2003, 10:34 AM#2
AIAndy
There is a trigger action to set the HP of a unit. So use that to set it to its current HP + the armor value you want. But that will not increase it beyond its current max HP. So in that case you will have to add some of that armor HP after the damage has been applied.
10-19-2003, 01:05 PM#3
KaTTaNa
Using that event will cause a lot of problems with ranged units, since it triggers from the moment the unit begins to attack.
I suggest that you use the Unit takes damage event instead.
10-19-2003, 01:25 PM#4
Grater
The thought of using "is attacked" or "takes damage" events makes me cringe... they just seem so flaky when it comes to various types of attacks.

Personally I'd use hardened skin, make a bunch of "armor" skills, starting at 1 and increasing by 1 to however high you want armor to go. (not that high I imagine.. due to it's nature and the fact you'll have to manually code the units armor values). Add all the armor skills to an array and just give each unit the appropriate one, if their armor is upgraded, remove the old one and add the new.

Well, the armor skill icon would appear on the unit, it'd be a useful way to display the armor value & upgrade level actually, seeing as the normal armor would probably be set to 0.
10-19-2003, 05:11 PM#5
Zealot888
KaTTaNa, I totally agree in that when 'unit is attacked' event should be avoided because of the delay before the unit actually takes damage is cheesy. I don't know how to use the unit 'owned by player is damaged' event. I found where to get a specific 'unit taking damage' event, but I do not know how to use it for a generally produced unit.

AIAndy, I do not know how to add a value to the 'set unit hit point' action. Can somebody give step by step instruction for either the WE gui or in custom text how to add or subtract from a 'setunitlife' action? In concept this whole armor idea is so easy but it has been bothering me for a long time.

Grater, could you go into detail of what you are explaining (specific examples). I believe you have some good ideas as to accomplish the same idea I have for an armor system that uses upgrades and can be displayed in the game. This idea is gold and I would love to hear more on how to do it.

The most preferred method is that the armor value is subtracted from the damage that is going to be delt. I can already theorize logically how to do this, but specifically I don't know how to or where to begin. Can somebody show me step by step how to do this? Anybody that can come up with something will most definitely receive credit for it in the project that I'm working on. This type of an armor system is truly my biggest desire for the mod I'm working on and I need help desperately.


Here's the list of questions:
How do you have an event ‘unit owned by player is damaged'?
How do you add/subtract a number to a player's health?
How do you get the amount of damage being inflicted?
Better still, how do you add/subtract a number (the armor value) to the damage about to be dealt?

A condition is needed so that different units can use different values.
What do these things look like In custom text? How would you go about creating them in the WE GUI?
10-19-2003, 06:46 PM#6
KaTTaNa
You need two triggers to use the Unit is Damaged event.
Code:
Trigger
  Unit Apply Armor
Events
  [i]None[/i]
Conditions
  [i]None[/i]
Actions
  Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
As you can see above, that's how to add life. Just set the life to its life + some more.
Here's the other trigger:
Code:
Trigger
  Register Damage
Events
  Unit - A unit enters (Playable map area)
Conditions
  [i]None[/i]
Actions
  Trigger - Add to Unit Apply Armor <gen> the event: (Entering unit) Takes damage
I think I answered most of your questions here.
10-19-2003, 07:02 PM#7
Zealot888
KaTTaNa, in WE I can only see unit - set life to value, set life of (triggering unit) to (life of (triggering unit)). I can't find an option anywhere to -/+ a value to this action.

... I'm looking into the second part of your post

What is <gen>? What is the action in the second series of code you posted going? I'm having a very difficult time trying to find all the options in WE for the second part. Oddly enough, I might be able to understand it more if I could see it in custom text.
10-19-2003, 07:07 PM#8
AIAndy
Grater is right. That is probably the easiest way for you to do it.
Hardened skin does exactly what you want with your armor. Unlike using the damage events hardened skin does not reduce spell damage which is probably what you want.

In the object editor you can edit and copy that ability. So you can make a hardened skin that reduces attack damage by 1 point, one that reduces by 2 points and so on. That way you just give each unit the hardened skin ability that fits to his armor. If you want upgrades that increase the armor you can remove the ability and give the one that fits to his new armor instead. As Grater mentioned that is probably easiest done with arrays. There is a trigger action to remove and to give abilities ingame.
10-19-2003, 07:12 PM#9
Zealot888
Oh crap I never even heard of this 'hardened skin', let me check into it. Sounds goood.
10-19-2003, 07:33 PM#10
Starcraftfreak
Which project?
Btw, when did I say what you posted in your first post?
10-19-2003, 07:52 PM#11
AIAndy
Hardened skin is the ability of the mountain giants that reduces the damage they take. It can be researched on tier3 in the standard game.
10-19-2003, 08:02 PM#12
Zealot888
Starcraftfreak I was just quoting past posts that had to do with a similiar topic.

As for the project, its' been something I've been working on for a long time. Until I feel it's worthy to be shown to the public it will remain classified. If enough people like it enough I'll see if people want to join in and form a team. My weak area is in coding and somewhat in modeling, hence the need for other members some time down the road.

After looking at hardened skins for a couple minutes I am overjoyed. No triggers are needed, 'hardened skins' is perfect. Thanks everyone for the help though.