HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Run over effect

09-08-2002, 04:57 PM#1
Guest
I have triggers that create units. Unit A and Unit B. Unit A is a Steamtank. Unit B is a Peasant. I want the steamtank to "run over" the peasant. And while doing so score a kill. Adding gold.

I have tried to use unit in range trigger but have come to the realization that those only work with pre-existing units. Not ones created through triggers.

I have heard of movable regions that would follow the tank around. I have also read about some other editor mod or something that allows triggers to create events. Is there any other way of doing this? I am relatively new to this, all I know is what I have taken from maps I have opened. Functions totally confuse me at this point still. I have never used an mpq editor.

I will resort to trying the movable region if I have to. Just wanted to know if there were other ways. Also if someone could describe the movable region way in detail I would be very grateful. :)

Thanks in advance
09-08-2002, 06:52 PM#2
CBWhiz
Method 1 (Theory, Probably wont work)
Requirements: GoldenUrg's Trigger Patch

-Event: Creates a steam tank

-Action: Add Event (unit comes with in 342 of triggering unit) to Run Over Trigger

Run Over Trigger:
-Event: (none)
-Condition: (none)
-unit group (all steam tanks within 342 of triggering unit) - kill picked unit
--------------------------------------------------------

Method 2 (Semi Theory, havent tried it but it should work, although I dont know about having 2 diff unit groups nested...)

-Event: Every 2 sec
-Action: pick every (steam tank) and pick every (unit within 324 of picked unit) and do kill picked unit
09-08-2002, 07:05 PM#3
Guest
That's close, but you wouldn't be able to do Pick every Steam tank and then pick every peasent within [x] of (picked unit) and Kill (picked unit)

You'd have to have an action for each steam tank on the map.
09-08-2002, 07:28 PM#4
Newhydra
Not really, you might be able to do something more in custom text, and you'd definatly be able to do it if you made a steam tank array or peasant array and went through the array checking distance...
09-08-2002, 08:08 PM#5
dataangel
Set peasant acquisition range to 50 in unit editor (this is actually really small) or if that doesn't work try something a little bigger.

Event
Unit enters acquisition range
Action
Kill unit

this is a bet over simplified but you can figure it out :)
09-08-2002, 08:19 PM#6
Guest
Ok, dataangel, if I am not mistaken anything in an event that triggers when a unit comes in range of _Unit_, _unit_ has to equal a pre-existing unit. One that existed during map initialization. If I am misunderstanding you please elaborate. :)

All the units in this game are created during gameplay, especially since they will be respawning.
09-08-2002, 08:44 PM#7
Guest
Acquisition range is not what you'd want to use anyway.

Quote:
Not really, you might be able to do something more in custom text, and you'd definatly be able to do it if you made a steam tank array or peasant array and went through the array checking distance...

So then you have to use a For Loop, which is a streamlined way of having an action for each unit. I was kinda hoping that would be obvious.

You would want to use an Array for the Steamtanks, not the peasants, then Pick every unit within [x] of steamtankarray[integer A] matching unit-type peasant and do kill picked unit.
09-08-2002, 08:50 PM#8
Guest
Time to learn arrays then. :-/

I never knew what an array was before today. But I'll learn. :)
09-08-2002, 09:13 PM#9
Guest
Quote:
-Event: Every 2 sec
-Action: pick every (steam tank) and pick every (unit within 324 of picked unit) and do kill picked unit

Oh my, I was positive that this wouldn't work, but gave it a try anyway, and it does!

Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (matching unit)) Equal to Steam Tank) and do (Unit Group - Pick every unit in (Units within 200.00 of (Positition of (Picked Unit)) matching ((Unit-Type of (Matching unit)) Equal to Peasant)) and do (Unit - Kill (Picked unit)))

My first thought would be that the Picked Units would get mixed up somehow, and it would either do nothing or kill the Steam Tanks. But it works fine, and no need for a single variable, array, or Loop.
09-08-2002, 11:08 PM#10
Guest
Think it would be possible to relate back to what unit caused the death and give gold? That would probably get glitched when two people are close. Perhaps I just crap that idea as a recource and just make it a neat side effect.

On a side note, I adjusted the camera field. (so it would lock on a unit and give for field of vision) But when I use the scroll mouse to zoom it gets rid of the camera field I had set and goes to default. I had it expanded through a trigger. Anyone run into that?
09-08-2002, 11:44 PM#11
dataangel
Sorry, thought acquisition range worked for player owned units.

Although you can use the Unit Enters Range event, but you'll need goldenurg's patch to add events for units not created at map init....although the editor lets you though I haven't actually tested it.
09-08-2002, 11:45 PM#12
dataangel
Zoom always makes it default to normal camera view...not sure there's a way around that.
09-09-2002, 12:17 AM#13
Guest
Thanks DrunkOM that worked perfectly.

Thanks to everyone else that offered help too.
09-09-2002, 12:56 AM#14
Guest
You know, depending on the situation, an easier solution may be to make the Steam Tanks invincible and give them "Permenant Immolation". The peasants could be customized to give out gold to their assassin upon death, and only have a few HP.

Although the other suggestions sound like a lot of fun debugging ;)
09-09-2002, 05:51 AM#15
Guest
Quote:
Think it would be possible to relate back to what unit caused the death and give gold? That would probably get glitched when two people are close. Perhaps I just crap that idea as a recource and just make it a neat side effect.

It's entirely possible, and would be similar to what I do to keep score in my Pac Man map (although I'm modifying it light of recent thought). First create a new trigger with an event/condition for when a Peasant dies. Then try the actions:

- Set ScoringTank = (Random Unit from (units in (playable map area) matching ((Unit-Type of (matching unit) equal to Steam Tank)))

- Pick every unit in ((playable map area) matching ((Unit-Type of (matching unit) equal to Steam Tank) and Do If (Distance Between (position of (Dying Unit))) and (position of (picking Unit)) Less than or equal to (Distance Between (position of (Dying Unit))) and (position of ScoringTank)) Do Set Scoring Tank = (Picked Unit)

- Add [x] gold to (Owner of (ScoringTank))

This way, whichever Steamtank is closest to the unit that dies, will get credit for the kill (at least in monetary means). The chances of the distances being Equal are slim to none, and would hardly be disputable by the players. You may want to make the periodic Event from before more frequent than 2 seconds however.