HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit slide and kill trigger. Need help plz

07-25-2007, 02:51 PM#1
evilmapcreater
Trigger:
UNIT movement
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Set UnitGroup[1] = (Units of type UNIT)
Collapse Unit Group - Pick every unit in UnitGroup[1] and do (Actions)
Collapse Loop - Actions
Set Point[1] = ((Position of (Picked unit)) offset by 2.00 towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to Point[1], facing (Facing of (Picked unit)) degrees
Custom script: call RemoveLocation( udg_Point[1] )
Set Units[1] = (Picked unit)
Set UnitGroup[2] = (Units within 120.00 of (Position of (Picked unit)) matching (((Matching unit) Not equal to (Picked unit)) and (((Matching unit) is alive) Equal to True)))
Custom script: call DestroyGroup( udg_UnitGroup[1] )
Collapse Unit Group - Pick every unit in UnitGroup[2] and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(((Owner of (Picked unit)) is an ally of (Owner of Units[1])) Equal to False) or ((Owner of Units[1]) Not equal to (Owner of (Picked unit)))
Collapse Then - Actions
Set Point[1] = (Position of (Picked unit))
Special Effect - Create a special effect at Point[1] using Abilities\Weapons\GryphonRiderMissile\GryphonRiderMissileTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation( udg_Point[1] )
Unit - Cause Units[1] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
Animation - Play (Picked unit)'s death animation
Collapse Else - Actions
Do nothing
Custom script: call DestroyGroup( udg_UnitGroup[2] )

There is a spell to create the unit infront of the caster. Then with this trigger it slides away and kills a peon in my test. But when i keep casting it towards the peon and lots of 'UNITS' slide towards him, the LAST one kills him. Also it lags. Can some one please tell me what i should do?
07-25-2007, 04:42 PM#2
Ghan_04
I think your second Pick Every Unit actions should be embedded in the first. As it is now, the second loop will only use the last group as defined by the first loop, it won't use each group as it is created.
07-25-2007, 04:50 PM#3
TheSecretArts
Quote:
Originally Posted by Ghan_04
I think your second Pick Every Unit actions should be embedded in the first. As it is now, the second loop will only use the last group as defined by the first loop, it won't use each group as it is created.
bad, dont embed Pick Every Unit, that will cause some stuff not to work as planned sometimes, but if you really feel like it, then try it yourself.
07-25-2007, 04:56 PM#4
Ghan_04
> bad, dont embed Pick Every Unit, that will cause some stuff not to work as planned sometimes, but if you really feel like it, then try it yourself.

Why would that happen? It certainly looks like that's what the code needs.
07-25-2007, 04:58 PM#5
evilmapcreater
Here is my new trigger:
Trigger:
water movement
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Set UnitGroup[1] = (Units of type Water)
Collapse Unit Group - Pick every unit in UnitGroup[1] and do (Actions)
Collapse Loop - Actions
Set Point[1] = ((Position of (Picked unit)) offset by 2.00 towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to Point[1], facing (Facing of (Picked unit)) degrees
Custom script: call RemoveLocation( udg_Point[1] )
Set Units[1] = (Picked unit)
Set UnitGroup[2] = (Units within 120.00 of (Position of (Picked unit)) matching (((Matching unit) Not equal to (Picked unit)) and (((Matching unit) is alive) Equal to True)))
Collapse Unit Group - Pick every unit in UnitGroup[2] and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(((Owner of (Picked unit)) is an ally of (Owner of Units[1])) Equal to False) or ((Owner of Units[1]) Not equal to (Owner of (Picked unit)))
Collapse Then - Actions
Set Point[1] = (Position of (Picked unit))
Special Effect - Create a special effect at Point[1] using Abilities\Weapons\GryphonRiderMissile\GryphonRiderMissileTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation( udg_Point[1] )
Unit - Cause Units[1] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
Animation - Play (Picked unit)'s death animation
Collapse Else - Actions
Do nothing
Custom script: call DestroyGroup( udg_UnitGroup[1] )
Custom script: call DestroyGroup( udg_UnitGroup[2] )

But it still gets very laggy. Do you see any leaks or anything wroug?
07-25-2007, 05:07 PM#6
Ghan_04
You need to destroy the second unit group inside the first unit group loop. Otherwise you only get rid of the last leak.

On an unrelated note, does anyone know why I can only post once every 10 minutes?
07-25-2007, 05:13 PM#7
evilmapcreater
Trigger:
water movement
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Set UnitGroup[1] = (Units of type Water)
Collapse Unit Group - Pick every unit in UnitGroup[1] and do (Actions)
Collapse Loop - Actions
Custom script: call DestroyGroup( udg_UnitGroup[2] )
Set Point[1] = ((Position of (Picked unit)) offset by 2.00 towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to Point[1], facing (Facing of (Picked unit)) degrees
Custom script: call RemoveLocation( udg_Point[1] )
Set Units[1] = (Picked unit)
Set UnitGroup[2] = (Units within 120.00 of (Position of (Picked unit)) matching (((Matching unit) Not equal to (Picked unit)) and (((Matching unit) is alive) Equal to True)))
Collapse Unit Group - Pick every unit in UnitGroup[2] and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(((Owner of (Picked unit)) is an ally of (Owner of Units[1])) Equal to False) or ((Owner of Units[1]) Not equal to (Owner of (Picked unit)))
Collapse Then - Actions
Set Point[1] = (Position of (Picked unit))
Special Effect - Create a special effect at Point[1] using Abilities\Weapons\GryphonRiderMissile\GryphonRiderMissileTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation( udg_Point[1] )
Unit - Cause Units[1] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
Animation - Play (Picked unit)'s death animation
Collapse Else - Actions
Do nothing
Custom script: call DestroyGroup( udg_UnitGroup[1] )

Like that? im testing it now...
07-25-2007, 05:18 PM#8
evilmapcreater
still lags bad
07-25-2007, 05:19 PM#9
Ghan_04
I would destroy the group right after it's used, not before it is declared. Also, I don't think that every .01 seconds is any different from .03 seconds. I think the game only allows a minimum of something like .027 second intervals. If you still get lag, you might try increasing the interval.

Lastly, there's no need for the Do Nothing action. What's it going to do if you don't put it there? :P
07-25-2007, 07:35 PM#10
Castlemaster
@EvilMapCreator
Please don't double post, there is an edit key. Also do not bump your post unless it is more than two days old. Site policy.
@Ghan 04
You can't post more than 1/10 minutes to prevent spamming.

How many 'Water' units are there? Chances are that the lag is caused by the 'pick every unit in unit group' command going through an incredible amount of units.

If you only need to control one 'Water' unit, then as soon as you create it, set it to a variable and use the same commands (using (last created unit) to identify it), completely bypassing the 'pick every unit' command. I'm confused why you would set the 'Water' units to a unit group if you only have one.

For the command
Trigger:
Set UnitGroup[2] = (Units within 120.00 of (Position of (Picked unit)) matching (((Matching unit) Not equal to (Picked unit)) and (((Matching unit) is alive) Equal to True)
the ((Matching unit) is alive) command is redundant if you are just doing damage.

It seems like you are trying to make the damage affect only enemies.
Trigger:
(((Owner of (Picked unit)) is an ally of (Owner of Units[1])) Equal to False) or ((Owner of Units[1]) Not equal to (Owner of (Picked unit)))
You can completely omit this statement if you replace your UnitGroup[2] variable to only include 'units matching(matching unit belongs to an enemy of (owner of picked unit))' This will consolidate the command.

As Ghan 04 said, the biggest lag factor is increasing the periodic time. There is a certain point where people simply cannot notice the difference between moving 2 feet every 0.01 seconds and 10 feet every 0.1 seconds. Try and find the highest interval that still gives a good effect.

Finally, yeah. Remove the 'do nothing' it is pointless.
07-25-2007, 07:39 PM#11
Ghan_04
> You can't post more than 1/10 minutes to prevent spamming.

Does that ever get lifted as I become more active?

Yep. I agree. You can limit the unit group to the units you want when it is defined, with no need of an If/Then/Else function. That should help your lag.
07-25-2007, 08:24 PM#12
Pyrogasm
Quote:
Originally Posted by Ghan_04
Does that ever get lifted as I become more active?
It's only for the first month after you join.

Do not use nested Group Loops! They will get fucked up when you refer to "picked unit" (in JASS: GetEnumUnit()) inside the second loop because the game won't know which picked unit to refer to.

However, if you do what you've done, evilmapcreater, and set the first Picked Unit to a variable before starting the loop, you should be fine.
07-25-2007, 08:28 PM#13
Ghan_04
> They will get fucked up when you refer to "picked unit"

> However, if you do what you've done, evilmapcreater, and set the first Picked Unit to a variable before starting the loop, you should be fine.

That's basically what I thought. I think it refers to the most recent picked unit, so if you want to use the other one, you have to store it.

> It's only for the first month after you join.

Hmph. What? Am I a spammer? Not like I'm new to WC3 or anything.... (I'm a mod on TH)
07-25-2007, 08:34 PM#14
Pyrogasm
No, it's not singling you out; the post delay is active on all new members unless Vexorian or Tim. disables it for some amount of time.

It's to prevent massive spam attacks from people who register new accounts.
07-26-2007, 05:35 AM#15
Dil999
Try .04 instead of .01 it may not seem like alot, but it cuts the amount of calculations the computer has to do every second by 4 times.