A Warhammer 40k MOBA by Grasshopper72
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Log in

I forgot my password

Current Version: v0.0.01A

Alpha version


Changelogs to come



Poll

Changes to the way I release versions? (read the thread)

autobalance mode I_vote_lcap63%autobalance mode I_vote_rcap 63% [ 5 ]
autobalance mode I_vote_lcap38%autobalance mode I_vote_rcap 38% [ 3 ]

Total Votes : 8

Latest topics
» With everyone dead
autobalance mode I_icon_minitimeThu Mar 05, 2020 5:09 am by Occuli.Imperator.Aquillon

» Faction creeps
autobalance mode I_icon_minitimeSun Dec 21, 2014 12:49 am by Grass Hopper

» [SCII] [Inquisition] Hector Rex
autobalance mode I_icon_minitimeThu Dec 18, 2014 9:06 am by Grass Hopper

» [necrons] Orikan, the Diviner
autobalance mode I_icon_minitimeTue Dec 16, 2014 5:58 pm by Grass Hopper

» Talent System
autobalance mode I_icon_minitimeMon Dec 15, 2014 10:59 am by Grass Hopper

» Capture Points system
autobalance mode I_icon_minitimeFri Dec 12, 2014 2:36 pm by Grass Hopper

» [SCII] [Orks] Warboss(es)
autobalance mode I_icon_minitimeFri Dec 12, 2014 11:44 am by Grass Hopper

» Game Guide
autobalance mode I_icon_minitimeThu Dec 11, 2014 2:12 pm by Grass Hopper

» [Inquisition] Mordrak
autobalance mode I_icon_minitimeWed Dec 10, 2014 3:28 pm by Grass Hopper

» [inquiition] Kaldor Draigo
autobalance mode I_icon_minitimeWed Dec 10, 2014 3:07 pm by Grass Hopper

Version Progress
Changes for v0.02.0A
||||||||||||||||||||[] [general]
||||||||||||||||||||[] [Heroes]
||||||||||||||||||||[] [Items]
||||||||||||||||||||[] [Bugs]
||||||||||||||||||||[] [Total]

autobalance mode

Go down

autobalance mode Empty autobalance mode

Post by Grass Hopper on Sun Sep 06, 2009 11:23 am

im gona add in a new mode that autobalances when players leave, instead of people having to type -switch and -ok (cause aparently people are too stupid)

Spoiler:
Code:
struct leaver
    player p
endstruct
function set_udg_voted_to_false2 takes nothing returns nothing
    local integer OP = GetConvertedPlayerId(GetEnumPlayer())
    set udg_voted[OP]= false
endfunction
function end_switch2 takes nothing returns nothing
    set udg_brip = false
    call DisableTrigger(gg_trg_Vote)
    call ForForce(udg_team[1], function set_udg_voted_to_false2)
    call ForForce(udg_team[2], function set_udg_voted_to_false2)
    set udg_vc[1] = 0
    set udg_vc[2] = 0
    set udg_tpc[1] = 0
    set udg_tpc[2] = 0
endfunction
function leaver_timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer i = 1
    local integer n
    local integer e
    local leaver d = GetTimerData(t)
   
    set n = GetPlayerId(d.p)
    set e = GetPlayerState(d.p, PLAYER_STATE_RESOURCE_GOLD)
   
    loop
        exitwhen i >= 12 
        if i == n or i == 6 then
            set i = i+1
        endif
       
        if team(n) == team(i) and GetPlayerSlotState(Player(i)) != PLAYER_SLOT_STATE_LEFT then
            call SetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD) + e/udg_PlayerCount[team(n)])
        endif
       
        set i = i +1
    endloop 
    call SetPlayerState(d.p, PLAYER_STATE_RESOURCE_GOLD, 0)
   
endfunction
function Trig_Leaver_Actions takes nothing returns nothing
    local timer t = NewTimer()
    local player p = GetTriggerPlayer()
    local integer j = GetPlayerId(p)
    local integer i = 1
    local integer n
    local leaver d = leaver.create()
    local integer pt1
    call DisplayText(udg_ColorString[GetPlayerId(GetTriggerPlayer())] + GetPlayerName(GetTriggerPlayer()) + "|r has left the game.")
       
    set d.p = p
    call SetTimerData(t, d)
    call TimerStart(t, 1, true, function leaver_timer) 
       
    set udg_PlayerCount[team(j)] = udg_PlayerCount[team(j)] - 1
    call  UnitAddAbility(udg_PlayerHero[j], 'A00M')
    loop
        exitwhen i == 12     
       
        if team(j) == team(i) then
            call SetPlayerAlliance(p, Player(i), ALLIANCE_SHARED_CONTROL, true)       
        endif
       
        set i = i +1
    endloop     
   
    call ForceAddPlayer(udg_team[(PlayerForceById(j)+3)], p)
    call ForceRemovePlayer(udg_team[1], p)
    call ForceRemovePlayer(udg_team[2], p)   
   
    call SetPlayerController(p, MAP_CONTROL_COMPUTER)
    call SetPlayerName(p, GetPlayerName(p) + "(Left)")
   
    // for -ab mode
    if udg_AutoBalance == true then
       
        // setting team player count
        call end_switch2()
        loop
            exitwhen pt1 == 12
           
            if pt1 == 6 then
                set pt1 = pt1 + 1
            endif
           
            if GetPlayerSlotState(Player(pt1)) == PLAYER_SLOT_STATE_PLAYING and PlayerForceById(pt1) == 0 then
                set udg_tpc[1] = udg_tpc[1] + 1
            elseif GetPlayerSlotState(Player(pt1)) == PLAYER_SLOT_STATE_PLAYING and PlayerForceById(pt1) == 1 then
                set udg_tpc[2] = udg_tpc[2] + 1
            endif
           
            set pt1 = pt1 + 1
        endloop
       
        if udg_tpc[1] == udg_tpc[2] then
            return
        elseif udg_tpc[2] - udg_tpc[1] < 2 and IsPlayerInForce(p,udg_team[1]) then
            return       
        elseif udg_tpc[1] - udg_tpc[2] < 2 and IsPlayerInForce(p,udg_team[2]) then
            return
        endif
       
        if udg_tpc[1] < udg_tpc[2] then
            set udg_twlp = 1
        elseif udg_tpc[2] < udg_tpc[1] then
            set udg_twlp = 2
        endif
       
        call DisplayText("The teams are being autobalanced because team " + I2S(PlayerForceById(GetPlayerId(p))+1) + " has 2 less players than the other team")
        call TriggerSleepAction(1)
        call ExecuteFunc("autobalance")
    endif
   
endfunction
//===========================================================================
function InitTrig_Leaver takes nothing returns nothing
    set gg_trg_Leaver = CreateTrigger(  )
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(1), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(2), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(3), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(4), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(5), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(7), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(8), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(9), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(10), EVENT_PLAYER_LEAVE)
    call TriggerRegisterPlayerEvent(gg_trg_Leaver, Player(11), EVENT_PLAYER_LEAVE)
    call TriggerAddAction( gg_trg_Leaver, function Trig_Leaver_Actions )
endfunction

_________________
warning! very-stubborn, sarcastic, self-important, argumentative developer detected!

And unto the masses, He doth spoke:
"Behold The Stuff! It Is Good!"
And the Stuff was good.

Heroes:
Commander Farsight (colab - implemented) - Ku'gaath Plaguefather(incomplete) - Ilyana Arienal(incomplete) - Harlequin Shadowseer(incomplete) - Modular Tau Battlesuit(sandbox)
Grass Hopper
Grass Hopper
Admin

Posts : 3839
Join date : 2009-03-30

https://40kaos.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum