HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Manual Attack

04-25-2010, 01:06 AM#1
Malohi
Hi, I have tried to trigger a spell, that spell being a attack spell. I want it instead of the auto attack because I think it's kinda lame in an RPG.
I don't see any problems in my trigger and such only that when I press my spell it lags really bad...
Trigger:
Strike
Events
Unit - Paladin 0002 <gen> Begins casting an ability
Conditions
(Ability being cast) Equal to (==) Weapon Swing
Actions
Unit Group - Pick every unit in (Units in Rect 001 <gen>) and do (Actions)
Loop - Actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 75.00)
Trigger:
Region move
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Rect - Center Rect 001 <gen> on ((Position of Paladin 0002 <gen>) offset by 100 towards (Facing of Paladin 0002 <gen>) degrees)

Is there a better way to do this? Anyone that can see why it lags?
I use the War Stomp ability as the triggering spell.

Thanks in advance!
Attached Images
File type: pngUntitled.png (9.3 KB)
04-25-2010, 02:15 PM#2
Michael Peppers
Theorically the cause should be the "Region Move" trigger... also, you don't need that rect, use "Unit Group - Pick Every Unit In Range" action in the "Strike" trigger instead, it's way better.
04-25-2010, 10:56 PM#3
Fledermaus
"Regions" don't work like you think they do in GUI. If you want further info on that, check out my posts in this thread.

As for solving your problem, like Michael Peppers said - use Unit Group - Pick Every Unit In Range
04-26-2010, 09:22 PM#4
[VDM]Amn
that stuff leaks everywhere
anyways, this is what u want

Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
Unit-type of (triggering unit) equal to Paladin
(Ability being cast) Equal to Weapon Swing
Collapse Actions
set temp_unitgroup = units within 700 of triggering unit matching not dead, enemy, not immune
Collapse pick every unit in temp_unitgroup and do actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 75.00)

(create the temp_unitgroup variant)

i dont understand why u need to substract life by trigger when u're using War Stomp as the triggering ability, it clearly has a damage value u can use
04-26-2010, 09:30 PM#5
[VDM]Amn
oh i c
maybe u want to give a try to orb of annihilation ability
u wont need a trigger for it
04-27-2010, 10:46 AM#6
0zyx0
Quote:
Originally Posted by [VDM]Amn
that stuff leaks everywhere
anyways, this is what u want

Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
Unit-type of (triggering unit) equal to Paladin
(Ability being cast) Equal to Weapon Swing
Collapse Actions
set temp_unitgroup = units within 700 of triggering unit matching not dead, enemy, not immune
Collapse pick every unit in temp_unitgroup and do actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 75.00)

(create the temp_unitgroup variant)
That trigger does also leak. This is how it should be done:
Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
Unit-type of (triggering unit) equal to Paladin
(Ability being cast) Equal to Weapon Swing
Collapse Actions
set temp_unitgroup = units within 700 of triggering unit matching not dead, enemy, not immune
Collapse pick every unit in temp_unitgroup and do actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 75.00)
custom script: call DestroyGroup(udg_temp_unitgroup)
04-28-2010, 01:56 AM#7
[VDM]Amn
i dont think so, why u want to destroy the unit group?
every time u set the variant's value it gets the new value and destroys the old one

i did a lot of stupid triggers like this and nobody got performance problems or whatsoever
04-28-2010, 06:39 AM#8
0zyx0
Quote:
Originally Posted by [VDM]Amn
every time u set the variant's value it gets the new value and destroys the old one
Noo...
04-28-2010, 07:23 AM#9
Fledermaus
Trigger:
Unit Group - Pick every unit in (Units within 700.00 of (Center of (Playable map area)) matching (((Triggering unit) is A structure) Equal to True)) and do (Actions)
Loop - Actions
becomes
call ForGroupBJ( GetUnitsInRangeOfLocMatching(700.00, GetRectCenter(GetPlayableMapRect()), Condition(function Trig_SomeTrigger_Func001001003)), function Trig_SomeTrigger_Func001A )
Expand ForGroupBJ:
That one is fine, it doesn't leak anything (just a little slower than the actual native).

The one that leaks is this:
Expand GetUnitsInRangeOfLocMatching:

See, it creates a new group each time you call it so you need to destroy it afterwards.
04-28-2010, 10:25 PM#10
[VDM]Amn
nice, hey Fledermaus how about this, to avoid that leak on GetUnitsInRangeOfLocMatching

Trigger:
actions
set mytempug = units within 600 of triggering unit
Collapse pick every unit in mytempug and do actions
actions

it works, right?
04-28-2010, 10:32 PM#11
Michael Peppers
Every BJ function that creates a group leaks, as they all work the same way as the one Fiedermaus posted, so any GUI function that creates a group leaks too, call DestroyGroup(groupname) is the only way to solve this in GUI.

Well, except for calling the GroupEnumUnitsInRange native via a custom script, and that would be overkill in GUI.

(So... no, it won't work)
04-29-2010, 12:12 AM#12
Fledermaus
As Peppers pointed out, since it creates a group each time, the group then needs to be destroyed to prevent the leak.

The other option would be to set bj_wantDestroyGroup = true before you call the "Pick Every Unit in...." function. That way you wouldn't need to set it to a TempGroup either.

Trigger:
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units within 700.00 of (Center of (Playable map area)) matching (((Triggering unit) is A structure) Equal to True)) and do (Actions)
Loop - Actions