| 01-16-2004, 11:09 PM | #1 |
I want a unit to be unselectable at one point in time, and selectable in another. But I can't ADD the ability Locust to a unit. It just doesn't show up as an available ability when using 'Add ability to unit' action. Then I thought I could reproduce the ability in the object editor, but I looked throughout the entire list and couldn't find it. Is there anyway to do this? Or a work around? But remember, I want my unit to remain a unit owned by the same person all the time. Help would be appreciated. |
| 01-17-2004, 12:02 AM | #2 |
Code:
call UnitAddAbilityBJ( 'Aloc', (your unit) ) call UnitRemoveAbilityBJ( 'Aloc', (your unit) ) |
| 01-17-2004, 12:11 AM | #3 |
Eww! Well, I don't know jass. What I specifically wanted was this trigger - Action - Pick every unit in 'FinishedUnits' and do call UnitAddAbilityBJ( 'Aloc', (your unit) ) and then another one such as Action - Pick all units (owned by player 1) and do call UnitRemoveAbilityBJ( 'Aloc', (your unit) ) Can you write that in jass? I would deeply appreciate it. |
| 01-17-2004, 12:26 AM | #4 |
any events or conditions in that? |
| 01-17-2004, 12:31 AM | #5 |
Nope. I'm just running it via another trigger. |
| 01-17-2004, 02:54 AM | #6 |
k, give me a min. Code:
function Trig_Joe_Func001002 takes nothing returns nothing
call UnitRemoveAbilityBJ( 'Aloc', GetEnumUnit() )
endfunction
function Trig_Joe_Actions takes nothing returns nothing
call ForGroupBJ( udg_FinishedUnits, function Trig_Joe_Func001002 )
endfunction
//===========================================================================
function InitTrig_RemoveAloc takes nothing returns nothing
set gg_trg_RemoveAloc = CreateTrigger( )
call TriggerAddAction( gg_trg_RemoveAloc, function Trig_Joe_Actions )
endfuncti#1, the trigger name needs to be RemoveAloc Code:
function Trig_Joe_Func001002 takes nothing returns nothing
call UnitAddAbilityBJ( 'Aloc', GetEnumUnit() )
endfunction
function Trig_Joe_Actions takes nothing returns nothing
call ForGroupBJ( udg_FinishedUnits, function Trig_Joe_Func001002 )
endfunction
//===========================================================================
function InitTrig_AddAloc takes nothing returns nothing
set gg_trg_AddAloc = CreateTrigger( )
call TriggerAddAction( gg_trg_AddAloc, function Trig_Joe_Actions )
endfunction
#2, the trigger name needs to be AddAloc all references to the name joe were just stupid names I made up, they don't have to do w/anything. crap. They aren't right. I have to go somewhere right now, but I will post the corrected triggers after I get back. |
| 01-17-2004, 03:08 AM | #7 |
Or use a custom text line ://// . |
| 01-17-2004, 03:35 AM | #8 |
what custom text line? please find it and come back and tell me where it is. . . edit - thanks narwanza, it worked perfectly. All I had to do was convert my trigger to custom text and replace the spell code with Aloc. Much appreciation! |
| 01-17-2004, 05:25 AM | #9 |
oh, i'm glad it worked. I changed the second set of code so that it would pick all units owned by player 1 red instead of all units in the global variable finished units. Here it is Code:
function Trig_RemoveAloc takes nothing returns nothing
call UnitRemoveAbilityBJ( 'Aloc', GetEnumUnit() )
endfunction
function Trig_RemoveAloc_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsOfPlayerAll(Player(0)), function Trig_RemoveAloc )
endfunction
//===========================================================================
function InitTrig_RemoveAloc takes nothing returns nothing
set gg_trg_RemoveAloc = CreateTrigger( )
call TriggerAddAction( gg_trg_RemoveAloc, function Trig_RemoveAloc_Actions )
endfunction
|
| 01-17-2004, 05:35 AM | #10 |
Thanks alot! |
