| 04-25-2010, 01:06 AM | #1 |
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! |
| 04-25-2010, 02:15 PM | #2 |
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 |
"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 |
that stuff leaks everywhere anyways, this is what u want Trigger: (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 |
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 | |
Quote:
|
| 04-28-2010, 01:56 AM | #7 |
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 | |
Quote:
|
| 04-28-2010, 07:23 AM | #9 |
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 - Actionscall ForGroupBJ( GetUnitsInRangeOfLocMatching(700.00, GetRectCenter(GetPlayableMapRect()), Condition(function Trig_SomeTrigger_Func001001003)), function Trig_SomeTrigger_Func001A ) ForGroupBJ:function ForGroupBJ takes group whichGroup, code callback returns nothing // If the user wants the group destroyed, remember that fact and clear // the flag, in case it is used again in the callback. local boolean wantDestroy = bj_wantDestroyGroup set bj_wantDestroyGroup = false call ForGroup(whichGroup, callback) // If the user wants the group destroyed, do so now. if (wantDestroy) then call DestroyGroup(whichGroup) endif endfunction The one that leaks is this: GetUnitsInRangeOfLocMatching:function GetUnitsInRangeOfLocMatching takes real radius, location whichLocation, boolexpr filter returns group local group g = CreateGroup() call GroupEnumUnitsInRangeOfLoc(g, whichLocation, radius, filter) call DestroyBoolExpr(filter) return g endfunction 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 |
| 04-28-2010, 10:32 PM | #11 |
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 |
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. |
