• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Triggering lives and powerups. (unit comes within range of <variable>)

Status
Not open for further replies.
Level 27
Joined
Sep 24, 2006
Messages
4,979
I have a bit of a problem,

I want to make a system which will revive the player af he dies, so he will have like 3 lives and every time he dies 1 live will go off his total amount of lives.

I know how to make such a thing.

But now there's a problem, to make this i need a variable to equal to a unit. The only problem is that the trigger

''Unit - A unit comes within (range) of (unit)''

does not allow variables to be put into the unit part.

And i require this to make the power ups work!

(You know those power ups, when you get near them they dissapear and you receive a bonus)

Is there any other way to make those power ups? Or anything.
 
Level 27
Joined
Sep 24, 2006
Messages
4,979
Try making a region around the pwerup? Unit enters region

The power ups will be moving from left to right (only once), would be too complicated =/

You could base the power ups of an item, when picked up it gets removed and u create a dummy unit casting the power-up spell on it.
Would seem best to me.

In the game every second counts, so picking up an item would take some more time then just walking over it. so.. yeah it's a solution but i don't want to turn out that way.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Well then you need to add an event for every unit when an other unit comes in range.
This is what you are looking for I guess, but it's bad for performance because if you have to many the main trigger will have 1000 events at a certain point.

You basically need 2 things, a trigger to add the event for when a unit comes in range of a unit. And the main trigger to add the units that you create to put in it.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Maybe unit is selected? Making the powerup the selected unit? You would have to be close and it will take less time. And sometimes maybe people want to leave powerups not take them, like leave them for allys.

Right clicking a item to pick it up takes less time then trying to select it.
And if what the guy says is true, every second counts.

So the best way would be creating a unit etc and when it's walked over it gets picked up
And that's possible to make, just a tad laggy is used to much.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
You mean trigger? Sure I'll edit soon.

EDIT: This is a small example of what you could do, but it's not very effective but as far as I know the only way.
Comments in the trigger.
  • Adding Events
    • Events
    • Conditions
    • Actions
      • -------- Just use w/e events and conditions you want to add bonuses. --------
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • -------- Base your bonuses of an unit with no movement speed etc. --------
      • Trigger - Add to Apply Bonus <gen> the event (Unit - A unit comes within 200.00 of (Last created unit))
      • -------- This adds the event to the next trigger to make it run when a unit comes within range of the last created unit. --------
      • -------- Take note that I do not clean leaks, it´s better if you do it. --------
  • Apply Bonus
    • Events
    • Conditions
    • Actions
      • -------- Now you put your actions when an unit comes in range here, --------
      • -------- You can also add preset units. --------
  • Preset Units
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Footman) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Apply Bonus <gen> the event (Unit - A unit comes within 200.00 of (Picked unit))
I did not clean leaks because it's late over here and I want to sleep... xD
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
How about giving unit abiity to Hero named "Get Powerup"? Once he uses it on the item we will be able to use the event "starts the effect of an ability". Also you can modify the range so you'll have to walk over to the item.

Pay attention to the other posts aswell as he said every second counts, and if he finds it taking to long to even select the unit then using a spell is rly no option. :p
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Create a small (locusted, and no mdl) unit, and order it to follow your main unit.

Create one for each player. Also, if the player leaves/isn't in use, just remove it by triggers.

You can use specific units (<gen>) in close to.

Why not just use the hero then? Btw doesn't that whole locust remove that possibility?
I tried it before and it didn't work for me.

Other then that it's more effective.
 
Status
Not open for further replies.
Top