Destroy force help

jomik

New Member
Reaction score
17
JASS:
scope BaseIncome initializer Init

    private function fTrue takes nothing returns boolean
        return true
    endfunction
    
    function GiveGold takes nothing returns nothing
        local player p = GetEnumPlayer()
        call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) + 2)
    endfunction

//From here
    
    private function actions takes nothing returns nothing
        local force f = CreateForce()
        call ForceEnumPlayers(f,Condition(function fTrue)) 
        call ForForce(f, function GiveGold)
        call DestroyForce(f)
        set f = null
    endfunction

//To here

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEvent(t, 1.00, true)
        call TriggerAddAction(t, function actions)
    endfunction
    
endscope


vJASS...
This will not destroy all players right? :O
 

Jesus4Lyf

Good Idea™
Reaction score
397

jomik

New Member
Reaction score
17
Why're you making FORCE global? :O
And can you explain the Filter(...) incase I want it to be only playing players? :O
And should I loop through all players instead, and just check if players are playing? - I don't want that in this code buut :p
 

Rushhour

New Member
Reaction score
46
just curious: what about the local player handle? No need to null it in that case or simply forgotten ?^^
Edit: Guess jesus4life copy pasted and the mistake wasn't made by him?! ;P
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top