| 01-25-2004, 01:46 PM | #1 |
I actually created a spell based on Dark Portal which allows me to spawn permanent summons. and i wanted to limit the total amount of spawns at a time.Thus, I create this following triggers, (ideas gotten from somebody else). function Trig_Herd_Leaders_Level_1_Copy_Conditions takes nothing returns boolean if ( not ( GetUnitTypeId(GetSummonedUnit()) == 'n00S' ) ) then return false endif return true endfunction function Trig_Herd_Leaders_Level_1_Copy_Func001001 takes nothing returns boolean return ( udg_HerdCurrentSpawn[1] == null ) endfunction function Trig_Herd_Leaders_Level_1_Copy_Actions takes nothing returns nothing if ( Trig_Herd_Leaders_Level_1_Copy_Func001001() ) then set udg_HerdCurrentSpawn[1] = GetSummonedUnit() else call RemoveUnit( udg_HerdCurrentSpawn[1] ) endif set udg_HerdCurrentSpawn[1] = GetSummonedUnit() endfunction //=========================================================================== function InitTrig_Herd_Leaders_Level_1_Copy takes nothing returns nothing set gg_trg_Herd_Leaders_Level_1_Copy = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Herd_Leaders_Level_1_Copy, EVENT_PLAYER_UNIT_SUMMON ) call TriggerAddCondition( gg_trg_Herd_Leaders_Level_1_Copy, Condition( function Trig_Herd_Leaders_Level_1_Copy_Conditions ) ) call TriggerAddAction( gg_trg_Herd_Leaders_Level_1_Copy, function Trig_Herd_Leaders_Level_1_Copy_Actions ) endfunction Now the question is, what if i wanted to limit a group of units that consist only two kinds of units, and the number of units in that group have a limit between 2-4(number differs each time the spell are casted) Can somebody tell me how to create trigger(s) for this? spell number(dark portal) |
| 01-26-2004, 05:48 AM | #2 |
Anyone? =( pls help me Bump |
| 01-26-2004, 04:18 PM | #3 |
why is it all in custom-text ? and from this "text", migh i sugest renaming the triggers to their "proper" names ? and if everything fails, upload the map and let someone fix it... as for your problem, i think i know whats bothering you...when u cast your dark portal, it creates 1 to n unit1 or unit2. i guess you want to limit the number of unit1 to x and/or unit2 to y. so, try something like this, make 2 variables "Unit1Count" and unit2count which will be integer variables... now the trigger: E:unit is summoned C:summoned unit-type equal to unit1-type A:set unit1count to (unit1count + 1) this one will increase for every unit1 summoned, so u need a trigger that will deplete it when the unit is killed (since it can't unsummon itself out by running out of time), also do it for unit 2 E:unit is killed C:none A:if (unit type of (dying unit) equals to (unit1-type) then do (set unit1counter = (unit1counter - 1))) <- something like this...also do it for unit2 this trigger will reduce the integer counting the summoned units, and now the part u need... E:unit is summoned C:none or summoning unit equal to (your hero having that skill) C:summoned unit-type is unit1-type A: if Unit1Count equal to 4, then remove summoned unit from game, else do nothing u might want to consider trying these triggers since u don't have any solution...hope it helps :) |
| 01-27-2004, 07:10 AM | #4 |
yah, i think this may be the best alternative. Thanks alot for your help, I paste the trigger in custom text as I have no idea of how to paste the GUI version to the board. I'll make sure to rename those text to their 'proper' names next time i encounter any problems. Thanks again. |
