HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

~*[Unit enters region, given spell.]*~

05-30-2006, 09:07 AM#1
Opxono
Hi, how do you make it such that when an unit enters a region. It is given a spell: Blink. and how do you make it such that when it enters another different region, the spell: Blink will be removed? Thank you.
05-30-2006, 09:18 AM#2
The)TideHunter(
To add blink you can use this:

Trigger:
Add Blink
Collapse Events
Unit - A unit enters Some Region <gen>
Conditions
Collapse Actions
Unit - Add Blink to (Entering unit)

To remove it use this:

Trigger:
Remove Blink
Collapse Events
Unit - A unit enters Some Other Region <gen>
Conditions
Collapse Actions
Unit - Remove Blink from (Entering unit)
05-30-2006, 09:57 AM#3
Opxono
Thanks .. seems like ur online may i just request another question?

Trigger:
Mortars Attack
Collapse Events
Map initialization
Conditions
Collapse Actions
Unit - Order Mortar Team 0004 <gen> to Attack Ground (Center of MortarsA1 <gen>)

SOMEHOW, it just doesnt work .. When i test the map (Ctrl + F9), the mortar team doesnt attack the ground .. my units patrol works.

edit: Its like the mortar team "hates" the region that its attacking, it sounds funny, but its what happened. Its like nothing happened. ..
05-30-2006, 10:09 AM#4
Blade.dk
If it is able to attack other places, maybe you have a trigger interrupting, or it can't reach the region, maybe the way is blocked by destructables or doodads?
05-30-2006, 11:09 AM#5
PipeDream
Do orders work during map init? Perhaps a Wait - 0.00 before the order will do the trick.
05-30-2006, 03:44 PM#6
The)TideHunter(
Yea, orders shouldent work at Map Init.
Use this instead:

Trigger:
Mortars Attack
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Unit - Order Mortar Team 0004 <gen> to Attack Ground (Center of MortarsA1 <gen>)
05-30-2006, 04:09 PM#7
Opxono
ARHGG IT JUST CANT WORK. It only works when:
1) i place the mortar team uber far from the mortar team that works.
2) when i just .. "randomly" placed my region and my mortar.
I'll attach my map, hopefully you guys can help?

Quote:
Yea, orders shouldent work at Map Init.

Tried it.. dl my map and you'll see.
Attached Files
File type: w3xtestingmap123.w3x (31.7 KB)
05-30-2006, 04:34 PM#8
The)TideHunter(
The reason its not working is because the mortar team you are ordering to attack is to close to the attacked region.

Move the mortar team further away from the center of the region and it should work fine

If you've ever played normal blizzard maps, with the human mortar team, the message comes up saying "Target inside minium range" or something.
Mortar teams have a max and a min attack range

EDIT: I realised your using the action Center Of Region, and quite alot of times.
This is critically bad, it 'leaks' a point (location).
So after a while it will get slower, and slower and slower.
Instead of something like this:

Trigger:
Mortars Attack 1
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Unit - Order Mortar Team 0005 <gen> to Attack Ground (Center of MA2 <gen>)

Use this:

Make a point variable called TempPoint
Trigger:
Mortars Attack 1
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Set TempPoint = (Center of MA2 <gen>)
Unit - Order Mortar Team 0005 <gen> to Attack Ground TempPoint
Custom Script: call RemoveLocation(udg_TempPoint)
05-30-2006, 08:30 PM#9
Anopob
If you do "Set TempPoint = No region" instead of "Custom Script: call RemoveLocation(udg_TempPoint)", will the "Set TempPoint = No region" leak?
05-31-2006, 04:26 AM#10
Opxono
Thank you, my mortar teams are working fine now :).
I have another question, if you ever played a maze, there will be a checkpoint where everyone is killed, and revived. My trigger doesnt work:
Trigger:
Revive
Collapse Events
Unit - A unit enters Revive <gen>
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Thief
Collapse Actions
Unit - Pause all units
Unit - Kill Thief 0012 <gen>
Unit - Kill Thief 0013 <gen>
Unit - Kill Thief 0014 <gen>
Unit - Kill Thief 0015 <gen>
Unit - Kill Thief 0016 <gen>
Unit - Kill Thief 0017 <gen>
Unit - Kill Thief 0018 <gen>
Unit - Kill Thief 0019 <gen>
Unit - Kill Thief 0020 <gen>
Wait 2.00 seconds
Hero - Instantly revive Thief 0012 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0013 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0014 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0015 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0016 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0017 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0018 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0019 <gen> at (Center of Revive <gen>), Show revival graphics
Hero - Instantly revive Thief 0020 <gen> at (Center of Revive <gen>), Show revival graphics
Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of Revive <gen>) over 0.00 seconds)
Hero - Add 450 experience to (Triggering unit), Show level-up graphics
Unit - Unpause all units
Trigger - Turn off (This trigger)

Thief is the player which will play the maze.
05-31-2006, 05:46 AM#11
Blade.dk
I am not sure at all, but try to unpause the units when you kill and revive them, that *might* help, but it is just a guess. Of course remember to pause them after you have killed/revived them.
05-31-2006, 09:30 AM#12
The)TideHunter(
Quote:
Originally Posted by Anopob
If you do "Set TempPoint = No region" instead of "Custom Script: call RemoveLocation(udg_TempPoint)", will the "Set TempPoint = No region" leak?

Yes it will still leak, you need to destroy the point or it will be in your game forever!. Also, doing this:

Collapse JASS:
Set TempPoint = No region
Wouldent ever happen, TempPoint is a location, No Region (isent a rect, but a different instance of null) (W/E wont let you do that in GUI)

Fact:

If you do NOT need to use any variable anymore (such as points, orders, unit creation etc) you do not need the point anymore, so you MUST remove it or that memory is making your game slower, the more you dont delete the slower it gets!
(if you leak about 150, you will not get lag, if you run a action, like "Order unit to move to (center of someregion)" every 0.01 seconds. You are done for.
05-31-2006, 09:41 AM#13
PipeDream
Quote:
If you do NOT need to use any variable anymore (such as points, orders, unit creation etc)
Confusing wording. If you don't need the _contents_ of a variable anymore... Same with orders/unit creation: When you use a point for an order or to create a unit and are then done with it, you need to deallocate the point. Semantics, but I think it's the root of a lot of confusion in memory management.
05-31-2006, 09:43 AM#14
The)TideHunter(
Sorry, i read over the things i write before i write them, but im not good at explaining things
05-31-2006, 01:03 PM#15
Opxono
ehm im still having problem .. the revive trigger wont work. tried unpausing and pausing units between the wait 2.00 seconds ..