HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit within Range collision problem

06-22-2007, 10:18 AM#1
Skurai
Here is wat i did
Create a unit
every 0.01 sec , trigger unit to move to target point of ability being cast [can some1 tell me how do i make the unit continiously move towards the direction it was moving before. It stops at the target point of ability being cast at the moment]

Every 0.02secs, pick every unit within 80range [except the hero type of unit who cast the spell] and deal dmg to units within 800 range.
The created unit has locust. The problem is, if the unit does not hit its intended target , the animation of the unit is still there and i cant seem 2 remove it with remove unit.

Also, when i remove locust from the unit, it does not work. I cast the spell as per normal and i dont even see the unit being created. How to do this without locust and how to do it with locust but remove the "unit's animation" when the unit does not collide?At the moment, when it does not collide, the unit just stands there. I rather ask the experts than spend time experimenting cause i still have alot to do on the map.

GUI please, this shouldnt be too hard i think.
Thanks for any help u may offer
06-22-2007, 01:20 PM#2
Histenchist
I think you should explain yourself better,
Ex:
What kind of spell are you are trying to create?
06-22-2007, 01:45 PM#3
blu_da_noob
I think this will be most helpful to you: http://www.wc3campaigns.net/showthread.php?t=93313 .

We can't help you until you clearly explain what you are trying to do and what your problem is.
06-22-2007, 03:08 PM#4
Silvenon
Make a trigger with Unit Comes In Range Of Unit event?
06-23-2007, 02:03 AM#5
Skurai
Trigger:
Unit - A unit Begins casting an ability
(Ability being cast) Equal to Carrion Swarm
Unit - Create 1 missle2 for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees
Unit Group - Add (Last created unit) to bulletgroup
Unit - Make (Last created unit) face (Target point of ability being cast) over 0.00 seconds
Set bulletcasterpoint = (Target point of ability being cast)
Set bulletcaster = (Triggering unit)
Trigger - Turn on Bullet missle move <gen>

Trigger:
Time - Every 0.02 seconds of game time
Collapse Unit Group - Pick every unit in bulletgroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 8.00 towards (Angle from ((Position of (Picked unit)) offset by (0.00, 0.00)) to bulletcasterpoint) degrees)
Set bullet = (Picked unit)


Trigger:
Time - Every 0.02 seconds of game time
Collapse Unit Group - Pick every unit in (Units within 80.00 of (Position of bullet)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Not equal to Tinker
Collapse Then - Actions
Unit - Add a 0.01 second Generic expiration timer to bullet
Unit - Cause bullet to damage (Picked unit), dealing 400.00 damage of attack type Spells and damage type Normal
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions
Collapse Else - Actions
Do nothing

I havent bothered to add all the turn-on/turn-off triggers yet.

All right, managed to solve all the problems. I SWEAR LOCUST IS THE MOST FRUSTRATING ABILITY EVER, buggy and i had to experiment so much to get it working properly.

Minor problem now. When i cast the the spell at a point on the ground, the locust missle thats created moves to the point on the ground only. How do i make it move continiously in the same direction that it was moving.

This means if i cast the spell at 100 distance northwards. The locust unit will move northwards all the way. Currently, it moves only to the 100 distance northwards and stops there.
06-23-2007, 04:59 AM#6
Skurai
All right, managed to solve all the problems. I SWEAR LOCUST IS THE MOST FRUSTRATING ABILITY EVER, buggy and i had to experiment so much to get it working properly.

Minor problem now. When i cast the the spell at a point on the ground, the locust missle thats created moves to the point on the ground only. How do i make it move continiously in the same direction that it was moving.

This means if i cast the spell at 100 distance northwards. The locust unit will move northwards all the way. Currently, it moves only to the 100 distance northwards and stops there
06-23-2007, 05:28 AM#7
Earth-Fury
create the unit at position of casting unit, make it face in the direction of the cast spells casting point. make it move in facing direction on a periodic timer.
06-23-2007, 08:25 AM#8
Skurai
Thanks earth, That did it for me.

Now for my final problem. For example i cast a spell, save it and call it bullet. I intend to put all those names of ppl who help me into my map when i finally finish it, god knows there is alot 2 do.
Trigger:
Bullet missle damage
Collapse Events
Time - Every 0.04 seconds of game time
Collapse Conditions
(Unit-type of (Picked unit)) Equal to missle4
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 80.00 of (Position of bullet)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Not equal to Tinker
(Unit-type of (Picked unit)) Not equal to Air Tinker
((Picked unit) is alive) Equal to True
(bullet is alive) Equal to True
Collapse Then - Actions
Unit - Cause bullet to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
Unit - Create 1 bulletbombmodel for Player 1 (Red) at (Position of bullet) facing Default building facing degrees
Unit - Make bullet Explode on death
Special Effect - Create a special effect attached to the overhead of bullet using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
Unit - Kill bullet
Unit - Remove bullet from the game
Game - Display to (All players) the text: asd
Collapse Else - Actions
Do nothing

Point is when i cast 2 bullets, only the last bullet will collide with a target. The first bullet will not collide with the target at all. This is because the trigger works only recognizes "bullet" as the most recently created unit which is the 2nd unit. How do i fix this?

I tried alot of things but cant seem to get it to work.
06-23-2007, 08:45 AM#9
Tide-Arc Ephemera
Quote:
Originally Posted by Skurai
Trigger:
Collapse Events
Time - Every 0.04 seconds of game time
Collapse Conditions
(Unit-type of (Picked unit)) Equal to missle4


The first problem there is that the trigger NEVER fires, because of that condition.
06-23-2007, 09:30 PM#10
Skurai
Quote:
Originally Posted by Tide-Arc Ephemera
The first problem there is that the trigger NEVER fires, because of that condition.
oh yeah sry, i removed the unit type of picked unit equal to missle4 already. I added that to sort of test, and the trigger fires properly, its just it only works for 1 missle at a time, i need it to work for multiple missles.

Its currently this

Bullet missle damage
Trigger:
Collapse Events
Time - Every 0.04 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 80.00 of (Position of bullet)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Not equal to Tinker
(Unit-type of (Picked unit)) Not equal to Air Tinker
((Picked unit) is alive) Equal to True
(bullet is alive) Equal to True
Collapse Then - Actions
Unit - Cause bullet to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
Unit - Create 1 bulletbombmodel for Player 1 (Red) at (Position of bullet) facing Default building facing degrees
Unit - Make bullet Explode on death
Special Effect - Create a special effect attached to the overhead of bullet using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
Unit - Kill bullet
Unit - Remove bullet from the game
Game - Display to (All players) the text: asd
Collapse Else - Actions
Do nothing
06-23-2007, 09:42 PM#11
Tide-Arc Ephemera
After a few seconds that system will lag out because of the leaks... but you know how to fix it don't you? :)

That variable isn't even an array... it's just... one unit. I'm not sure how this could be multi instanceable...

Try making "bullet" 'n' stuff an array...
06-23-2007, 10:41 PM#12
Skurai
Quote:
Originally Posted by Tide-Arc Ephemera
After a few seconds that system will lag out because of the leaks... but you know how to fix it don't you? :)

That variable isn't even an array... it's just... one unit. I'm not sure how this could be multi instanceable...

Try making "bullet" 'n' stuff an array...

hmm so i guess i need 2 make it an array, I am a noob and never used arrays be4, not even sure wat it is lol. Can roughly give me an idea how do i set it to be an array especially with units within range trigger, does that trigger work with arrays?
06-24-2007, 01:58 AM#13
Tide-Arc Ephemera
Variables, when you make variables, you can choose to make them "array" or not. Array just means you can have multiples of the same variable at the same time.

If you're having 1 bullet per player at a time, then you'd be best doing something like this:

Trigger:
Actions
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse Unit Group - Pick every unit in (Units within 80.00 of (Position of bullet[(Integer A)])) and do (Actions)
Collapse Loop - Actions
-------- Do blah... --------

Else otherwise, do this if you have more than one bullet per player:
Trigger:
Actions
Collapse Unit Group - Pick every unit in (Units of type *Your Bullet Type*) and do (Actions)
Collapse Loop - Actions
Collapse Unit Group - Pick every unit in (Units within 80.00 of (Position of (Picked unit))) and do (Actions)
Collapse Loop - Actions
-------- Do blah... --------
06-24-2007, 04:03 AM#14
Skurai
Quote:
Originally Posted by Tide-Arc Ephemera
Else otherwise, do this if you have more than one bullet per player:
Trigger:
Actions
Collapse Unit Group - Pick every unit in (Units of type *Your Bullet Type*) and do (Actions)
Collapse Loop - Actions
Collapse Unit Group - Pick every unit in (Units within 80.00 of (Position of (Picked unit))) and do (Actions)
Collapse Loop - Actions
-------- Do blah... --------

I dont see how this can work at all. Now picked units will no longer refer to enemy units surrounding the "bullet". Picked units will then refer to the bullet/missle itself. How am i suppose to damage enemy?

Currently i am doing this

Trigger:
Bullet missle 1st
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Carrion Swarm
Collapse Actions
Unit - Make (Triggering unit) face (Target point of ability being cast) over 0.00 seconds
Wait 0.50 seconds
Unit - Create 1 missle4 for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
Set bullet[(Integer A)] = (Last created unit)
Unit Group - Add bullet[(Integer A)] to bulletgroup
Unit - Make bullet[(Integer A)] face (Facing of (Triggering unit)) over 0.00 seconds
Trigger - Turn on Bullet missle move <gen>


Trigger:
Bullet missle move
Collapse Events
Time - Every 0.02 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in bulletgroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Collapse Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 12.00 towards (Facing of (Picked unit)) degrees)
Else - Actions
Trigger - Turn on Bullet missle damage <gen>

and
Trigger:
Bullet missle damage
Collapse Events
Time - Every 0.03 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 100.00 of (Position of bullet[(Integer A)])) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Not equal to Tinker
(Unit-type of (Picked unit)) Not equal to Air Tinker
((Picked unit) is alive) Equal to True
(bullet[(Integer A)] is alive) Equal to True
Collapse Then - Actions
Unit - Cause bullet[(Integer A)] to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
Unit - Create 1 bulletbombmodel for Player 1 (Red) at (Position of bullet[(Integer A)]) facing Default building facing degrees
Unit - Make bullet[(Integer A)] Explode on death
Unit - Hide bullet[(Integer A)]
Unit - Unhide bullet[(Integer A)]
Unit - Kill bullet[(Integer A)]
Unit - Remove bullet[(Integer A)] from the game
Game - Display to (All players) the text: trigger end
Else - Actions
Do nothing

I truly dont understand why it does not work. For the unit array bullet, i set it as 10 arrays. The missle does collide with the target but if i fire 2 missles, only the last missle collides with the target. The first one just flies through it. Its so frustrating.

Can please tell me whats wrong with this? Pls tell me