I am making a map where you can switch weapons throughout the game and I was wondering if it is possible to keep the hitpoints from the previous unit(weapon) to the new one. The only idea i have come up with is when the unit has 100% hp to set a switch that would allow the player to switch weapons and if they attempt to switch when its not set do give them a warning that tells them to heal. If any of you could help me i would much appreciate it.

Based off of what I know, that is almost impossible. To my knowledge, you can't use triggers to determine a unit's HP and you can't subtract or add specific amounts of HP without a medic or a damage dealing unit. If somehow you could pull it off that would be great! But I don't think its possible without having to go with something like gas for HP or something similar.
That was the idea is was considering after i was reading around in the forums seems like a popular thing. Anyways ill try to see if i can come up with something that may work. May be a while before i get a decent chance. Since starting this map and my horrid terrain skills. Don't expect anything soon. Thanks for the help.
I dont think so... But u can try. I think it might be possible... but i cant do it. GL!
Now u really got me thinking!
Yeah, you can do it. It's realy quite easy.
Make the unit used by players be a non attacking unit, like a civ. Then have the weapons be outher units which show up, and are invincable. You'll also want to bind them to the civ, with a "stay close to me" set of triggers.
I'm fairly certian it will work with a non attacking unit, if the 'bad guys' just run away, use a peon unit instead.
What did you just say!!? That makes no sense.
Either you are really bad at explaining things or ur editor has weird trigs....
He is saying have your guy be a civilian and have say an invincible ghost follow you around killing enemies as your "sniper" or whatever.
My best idea would be upon switching weapons, put the unit in a place where it takes a predetermined amount of damage per second and then you set a death counter going up to find out how long it takes for the unit to die. There you have a rough approximation of the unit's hp. Then recreate the other unit at a percentage you deem reasonable. I'll elobarte into triggers if you want.
QUOTE(DT_Battlekruser @ Mar 28 2005, 04:26 PM)
He is saying have your guy be a civilian and have say an invincible ghost follow you around killing enemies as your "sniper" or whatever.
My best idea would be upon switching weapons, put the unit in a place where it takes a predetermined amount of damage per second and then you set a death counter going up to find out how long it takes for the unit to die. There you have a rough approximation of the unit's hp. Then recreate the other unit at a percentage you deem reasonable. I'll elobarte into triggers if you want.
[right][snapback]174593[/snapback][/right]
If you would be so kind as to explain in triggers that would very helpful.
Hmm lets see something like
C:
-when you switch weapons, say "Current Player Brings at least 1 civilian to 'sniper'"
A:
-move all men for current player at 'Arena' (area where your character dude is) to 'shot spot'*
-move the civilian off the beacon (obviously)
-set deaths of 'cantina' for 'Player 1' to '0'
-set switch 1
-set deaths of cantina for Player 2 to 1**
-preserve
*this is an isolated spot where one unit attacks the player, and you have the units attack set to something so that it does a fixed amount of damage per 84 mS. Let's say you have a marine there and its attack is such that in 1008 milliseconds (84 * 12) it can deal 8 damage to your character unit.
**This is a variable representing what unit you're swapping in. If you're swapping in a flamethrower, set it to say 2.
C:
-switch 1 is set
A:
-add 1 deaths of 'cantina' for 'Player 1'
When the switch is set, provided you have hypertriggers it will add 1 death count for every 84 milliseconds it runs.
C:
-Player <computer> (computer player owning the marine that is attacking your character) kills score is at least 1. (or some other method of detecting that the character guy dies).
A:
-clear switch 1
-set switch 2
-preserve
You now have a variable, deaths of Cantina for Player 1, that represents the switched-out character's health. If the variable is 12, the character had 8 hp (remeber the marine we had was capable of 8 damage in 1008 milliseconds (84 * 12 mS) and that each death count stands for 84 milliseconds .
C:
-Always (or only when you want it to happen)
A:
-center location 'p1guy' on Men owned by 'Player 1' at 'arena'
-preserve
This keeps a location on where the guy was.
--------------------------------------------------------------------------------------------------
C:
-switch 2 is set
-deaths of cantina for player 2 is 1**
A:
-create 1 'Sniper Rifle (Ghost)' at 'p1guy' for Player 1
-preserve
**Or if it's 2 make a flamethrower (firebat) etc.
C:
-switch 2 is set
-deaths of cantina for player 1 is at least 1
-deaths of cantina for player 1 is at most 12
A:
-set hit points of men for player 1 at p1guy to 8% (let's say that the hero guy had 100 hp)
-clear switch 2
-preserve
C:
-switch 2 is set
-deaths of cantina for player 1 is at least 1
-deaths of cantina for player 1 is at most 12
A:
-set hit points of men for player 1 at p1guy to 8% (let's say that the hero guy had 100 hp)
-clear switch 2
-preserve
C:
-switch 2 is set
-deaths of cantina for player 1 is at least 13
-deaths of cantina for player 1 is at most 24
A:
-set hit points of men for player 1 at p1guy to 16% (let's say that the hero guy had 100 hp)
-clear switch 2
-preserve
C:
-switch 2 is set
-deaths of cantina for player 1 is at least 25
-deaths of cantina for player 1 is at most 36
A:
-set hit points of men for player 1 at p1guy to 24% (let's say that the hero guy had 100 hp)
-clear switch 2
-preserve
...and so on for all values of the death counter.
Kinda hard to explain, maybe someone can word it better.
Maybe I might just try gas and minerals but then again wouldn't it kind of be the same thing because you can get a specific amount of hp lost and subtract it from the minerals? Correct me if im wrong but I if im correct wouldnt it be sort of the same thing?

Wow, i must say that is a great system DTK. I just tried doing it and it was, well, kind of annoying to work out, but, if you have patience, it's a rather accurate thing to use.
The best thing i could come up with is make the weapon invincible and have an observer always moving over his head thats not owned by that player so you dont accidently select him when trying to select your unit. Every time you switch a weapon it will just appear under the observer, which keeps the same health.
why the observer? i can do that without observers... Plus when you switch...the person you cose would be 100% hp again.
probably the only really good way is to when you swtich weapons, the old wewapon keeps it's hp, so when you swtich back, it has the same.
EDIT: OOOOHH I get it now! so the enemies attack the observer. a problem would be though, if you ran faster than the observer

you'd have to telpeport it al lthe time. also you would not know the hp...
EDIT AGAIN: You could make like an scourge on top, its kidna of small anyways. also when you mass select, your units are the higher priority, so it would select your unit even if you are over the scourge. just make sure the "bait" you are using doesnt go off running and blowing up enemies.
So what if u have to teleport it, and you would have ally vision to the computer that owns the observer above ur head.
QUOTE(SaGa @ Mar 29 2005, 06:40 PM)
Maybe I might just try gas and minerals but then again wouldn't it kind of be the same thing because you can get a specific amount of hp lost and subtract it from the minerals? Correct me if im wrong but I if im correct wouldnt it be sort of the same thing?

[right][snapback]175838[/snapback][/right]
Gas and minerals would work just as well as death counters but I figured you'd already be using them. Or is that not what you're asking.
The only downside to my method is if you have like 8hp/sec dmg on units with 6000 hp.
If your unit has 6000hp, use a higher-damage unit!
You can only modify hp by percentages, so for a 6000hp unit, you should be dealing at least 60 damage at a time (1% of hp)
You could also try to set hp (using DT's hp measurement technique) by creating a damaged unit near a medic with constantly renewed energy for some time (as measured by a death count), and giving it to the player at the right time. If you can get it to work, it takes heaps less triggers.
Yes, but the thing is the more exact you want it to be, the more trigger you need. For 6000hp units, you would need to have a sethp trigger for every %, with the appropraite range in death counts.