Staredit Network

Staredit Network -> UMS Assistance -> Killing a Special Unit gives you one of that Unit
Report, edit, etc...Posted by squirrels on 2006-05-09 at 10:40:46
I'm trying to set up a multiplayer scenario...kind of a free-for-all, but with a special unit available.

I set it up so when a player enters a certain area, a very powerful hero unit appears. This hero unit is controlled by a computer player so it will attack players who enter the area. That was the easy part.

The part I'm having trouble figuring out is this...I want to make it so if a player kills the hero unit, the game creates a hero-unit under the control of that player. For example, if player 1 kills the hero, create one of that hero unit under the control of player 1.

Then if one of the other players, say, player 2, kills player 1's hero unit, then the game creates one of those units for player two. And so on and so forth...you gain control of the hero unit by killing it.

The problem is with the kill trigger. From what I understand, kill counts for a certain player/certain unit cannot be modified. I was going to set it up like, "Current player kills exactly 1 of Hero" as the condition and say "Give current player 1 hero" and "preserve trigger".

But from what I'm reading, it sounds like this will just keep creating hero units as long as the player kill count for that unit is 1. Then, if the player kills another unit, the trigger will stop, never to fire for that player again, since the player's hero kill count is now "2".

I'm trying to figure out a way to use the death counter, but all I can do from that is indicate that the hero-unit has died, not who killed it. Also, using the scoring method becomes problematic because it's possible a group of units could be killed in the game which would amount to the same score given for killing the hero...or another unit could be killed before the game checks the trigger condition.

So I'm wondering if there's an easy way to do this that I'm overlooking. I'm not a "pro" at this...I'm just making some maps with unique twists that me and my bros can play on.

Thanks in advance.
Report, edit, etc...Posted by Thyrax on 2006-05-09 at 12:31:30
isnt gonna work if you simply put kill count for current player to 0 after each kill ? so with a preserv trigger , i guess every thing is gonna be fine.
Report, edit, etc...Posted by Kenoli on 2006-05-09 at 12:41:07
You could do it with triggers like this:
Trigger
Players:
¤ All Players.
Conditions:
¤ Current Player kills exactly 1 Hero Unit.
Actions:
¤ Create 1 Hero Unit at 'Location' for Current Player.
¤ (Don't Preserve)

Trigger
Players:
¤ All Players.
Conditions:
¤ Current Player kills exactly 2 Hero Unit.
Actions:
¤ Create 1 Hero Unit at 'Location' for Current Player.
¤ (Don't Preserve)

Trigger
Players:
¤ All Players.
Conditions:
¤ Current Player kills exactly 3 Hero Unit.
Actions:
¤ Create 1 Hero Unit at 'Location' for Current Player.
¤ (Don't Preserve)
Etc.

Each time you kill the hero you will get one, and only one. The problem with this method is that you may need to make alot of triggers, depending on how often you plan on the hero unit being killed.
Report, edit, etc...Posted by squirrels on 2006-05-09 at 12:55:20
QUOTE(Kenoli @ May 9 2006, 12:40 PM)
You could do it with triggers like this:



Trigger
Players:
¤ All Players.
Conditions:
¤ Current Player kills exactly 1 Hero Unit.
Actions:
¤ Create 1 Hero Unit at 'Location' for Current Player.
¤ (Don't Preserve)




Trigger
Players:
¤ All Players.
Conditions:
¤ Current Player kills exactly 2 Hero Unit.
Actions:
¤ Create 1 Hero Unit at 'Location' for Current Player.
¤ (Don't Preserve)




Trigger
Players:
¤ All Players.
Conditions:
¤ Current Player kills exactly 3 Hero Unit.
Actions:
¤ Create 1 Hero Unit at 'Location' for Current Player.
¤ (Don't Preserve)
Etc.

Each time you kill the hero you will get one, and only one. The problem with this method is that you may need to make alot of triggers, depending on how often you plan on the hero unit being killed.
[right][snapback]482883[/snapback][/right]


Yeah I was thinking that. The thing is, if I was going to do that I would want each player to have an even number of chances to obtain the hero unit, so one player couldn't, for example, just kill off his own Hero unit 10 times and disable the trigger.


So what I was going to do is something like this:

-Check each player for a loss of one hero-unit. If they have one, set a "deceased" flag and decrement the loss counter to "0"

-Run through each player as you suggested above, checking for 1 kill, 2 kills, 3 kills, etc up to a predefined amount and if the condition is met, set a "kill" flag for that player

-Have a check that checks to see if both the deceased flag and the player's current kill flag is set...if so, clear both flags and give a hero unit to the player whose kill flag was set (preserved)

-Have a final check that checks if the deceased flag is set and NO kill flags are set (for cases where a player has killed the hero more than the triggers were written for), and in that case, reset the deceased flag and give the hero unit back to the computer player. (preserved)


I'm assuming all of these triggers run serially. It's kind of dependent on that, because if, say, player 1 kills player 2's hero-unit, it's possible that player 2's deceased trigger could be detected before player 1 sets his "kill flag" and the hero-unit could be given back to the computer player by mistake.

I was just going to run them for one player (a neutral player or the computer player) to avoid synchronization errors with flags getting set/not getting set in time to activate the proper triggers. I hope this is correct. If it works right, it should let a player acquire the hero by killing it up to the number of times I include the "kill flag" trigger, then for subsequent kills, give the unit back to the computer player. Does that sound like it will work? I'm not going to write out ALL the triggers because it'd be a lot, but you get the idea.

Of course, the other factor is Mind Control, so I have to put in some kind of trick to "punish" anyone who tries to get clever and control the hero-unit. biggrin.gif
Report, edit, etc...Posted by Kenoli on 2006-05-09 at 13:01:58
When you assign a trigger to multiple players, a force with multiple players, or "All Players" you actually have multiple copies of that trigger. If you made 10 triggers such as the ones I described, each player would be able to claim the Hero 10 times. One player would not be able to exaust all the triggers by himself.
Report, edit, etc...Posted by AshaMeD on 2006-05-09 at 13:05:37

Trigger
Description:
or this?
Players:
¤ all players
Conditions:
¤ Current player kills exacly 1 hero unit.
¤ Current player Death for hero is exacly 0.
Actions:
¤ set death counter unit 1
¤ perserve trigger


Trigger
Players:
¤ all players
Conditions:
¤ Current player Death for hero is exacly 1.
Actions:
¤ creat unit at location.
¤ set death counter unit 0
¤ perserve trigger


and also have a location following the hero to make it right there...

This might work ^_^!! better then all the other 1s so you dont have to make 100000 triggers.. for every death!!
Report, edit, etc...Posted by squirrels on 2006-05-09 at 13:33:38
QUOTE(AshaMeD @ May 9 2006, 01:05 PM)




Trigger
Description:
or this?
Players:
¤ all players
Conditions:
¤ Current player kills exacly 1 hero unit.
¤ Current player Death for hero is exacly 0.
Actions:
¤ set death counter unit 1
¤ perserve trigger





Trigger
Players:
¤ all players
Conditions:
¤ Current player Death for hero is exacly 1.
Actions:
¤ creat unit at location.
¤ set death counter unit 0
¤ perserve trigger


and also have a location following the hero to make it right there...

This might work ^_^!! better then all the other 1s so you dont have to make 100000 triggers.. for every death!!
[right][snapback]482891[/snapback][/right]


Since the trigger is preserved, when triggers execute again, won't the kill count for current player still be exactly one hero-unit and it'll run through the whole cycle again? That's the problem I'm trying to get around.

The method using multiple triggers and not preserving them works, but once you run out of triggers and someone kills the hero unit, it's gone and won't respawn.

That's where I'm having trouble...finding a way to create a trigger system to respawn the hero for a computer/neutral player once it's killed by a player with no more triggers.

I think I have a system that'll work but it's kinda ugly.
Report, edit, etc...Posted by Kenoli on 2006-05-09 at 14:06:48
You could make so many triggers that they will never run out. Either do this manually (which could be time consuming), or use MindArchon's Trigger Duplicator.
Or... make it so, when a player exausts all his triggers, the computer player gets the hero again.
Report, edit, etc...Posted by AshaMeD on 2006-05-09 at 18:52:45
Dude.. just do mine.. because of the death triggers... it wont continue unless you kill the unit again.. thats why i had it.. just trust me on this 1 ^_^ TRY IT!!
Report, edit, etc...Posted by Heimdal on 2006-05-09 at 18:56:39
Ashamed, you're wrong - the triggers will continually fire - the actions of the first are the conditions of the second, and the actions of the second are the conditions of the first.
Next Page (1)