| 07-27-2008, 11:01 PM | #1 |
I made this trigger, but it won't do anything. I added a KillUnit so I know whether or not it fires, but it doesn't. I can only get it to kill the unit when that's the only line in the Action sections. But why won't this do anything? JASS:function Trig_tester_Actions takes nothing returns nothing local integer x = GetUnitUserData(GetTriggerUnit) local force f call ForceAddPlayer (f, GetTriggerPlayer()) call KillUnit(GetTriggerUnit()) if (GetOwningPlayer(GetTriggerUnit()) == GetTriggerPlayer()) then call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) elseif ( IsUnitAlly(GetTriggerUnit(), GetTriggerPlayer()) ) == true then call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) else call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) call DisplayTextToForce( f, "--------------------" ) endif call DestroyForce(f) endfunction //=========================================================================== function InitTrig_tester takes nothing returns nothing set gg_trg_tester = CreateTrigger( ) call TriggerRegisterPlayerSelectionEventBJ( gg_trg_tester, Player(0), true ) call TriggerRegisterPlayerSelectionEventBJ( gg_trg_tester, Player(1), true ) call TriggerRegisterPlayerSelectionEventBJ( gg_trg_tester, Player(2), true ) call TriggerRegisterPlayerSelectionEventBJ( gg_trg_tester, Player(3), true ) call TriggerRegisterPlayerSelectionEventBJ( gg_trg_tester, Player(4), true ) call TriggerAddAction( gg_trg_tester, function Trig_tester_Actions ) endfunction Also, this does nothing either. I'm getting frustrated that my triggers are doing simply nothing. JASS:function Trig_Income_Update_Actions takes nothing returns nothing local integer i loop set udg_CityIncome[i] = ( udg_CityPop[i] / 266 ) set i = i + 1 exitwhen i >=100 endloop endfunction //=========================================================================== function InitTrig_Income_Update takes nothing returns nothing set gg_trg_Income_Update = CreateTrigger( ) call TriggerRegisterTimerEventSingle( gg_trg_Income_Update, 60.00 ) call TriggerAddAction( gg_trg_Income_Update, function Trig_Income_Update_Actions ) endfunction |
| 07-27-2008, 11:21 PM | #2 |
* triple check the name of the trigger, if you are using jasshelper. * Make sure you are not crashing the thread somewhere else. |
| 07-27-2008, 11:43 PM | #3 |
JASS:local force f call ForceAddPlayer (f, GetTriggerPlayer()) Force is uninitialized. |
| 07-28-2008, 12:09 AM | #4 |
Okay, I think I understand. So I'll just do local force f = null ? And then in the second problem I see that I need to set my integer to start at 0. Thanks for pointing these things out. |
| 07-28-2008, 12:25 AM | #5 |
no, you need to create the force before adding players to it, so: local force f = CreateForce() you need set force to null after you destroy it: JASS:call DestroyForce(f) set f = null |
| 07-28-2008, 12:31 AM | #6 |
Ok, thanks. I heard that you don't have to null forces if you destroy them, but I'll do it anyway. |
| 07-28-2008, 09:29 AM | #7 |
JASS:function Trig_tester_Actions takes nothing returns nothing local integer x = GetUnitUserData(GetTriggerUnit) JASS:GetTriggerUnit() |
