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)

-ar code (to find any bugs?) I_vote_lcap63%-ar code (to find any bugs?) I_vote_rcap 63% [ 5 ]
-ar code (to find any bugs?) I_vote_lcap38%-ar code (to find any bugs?) I_vote_rcap 38% [ 3 ]

Total Votes : 8

Latest topics
» With everyone dead
-ar code (to find any bugs?) I_icon_minitimeThu Mar 05, 2020 5:09 am by Occuli.Imperator.Aquillon

» Faction creeps
-ar code (to find any bugs?) I_icon_minitimeSun Dec 21, 2014 12:49 am by Grass Hopper

» [SCII] [Inquisition] Hector Rex
-ar code (to find any bugs?) I_icon_minitimeThu Dec 18, 2014 9:06 am by Grass Hopper

» [necrons] Orikan, the Diviner
-ar code (to find any bugs?) I_icon_minitimeTue Dec 16, 2014 5:58 pm by Grass Hopper

» Talent System
-ar code (to find any bugs?) I_icon_minitimeMon Dec 15, 2014 10:59 am by Grass Hopper

» Capture Points system
-ar code (to find any bugs?) I_icon_minitimeFri Dec 12, 2014 2:36 pm by Grass Hopper

» [SCII] [Orks] Warboss(es)
-ar code (to find any bugs?) I_icon_minitimeFri Dec 12, 2014 11:44 am by Grass Hopper

» Game Guide
-ar code (to find any bugs?) I_icon_minitimeThu Dec 11, 2014 2:12 pm by Grass Hopper

» [Inquisition] Mordrak
-ar code (to find any bugs?) I_icon_minitimeWed Dec 10, 2014 3:28 pm by Grass Hopper

» [inquiition] Kaldor Draigo
-ar code (to find any bugs?) I_icon_minitimeWed Dec 10, 2014 3:07 pm by Grass Hopper

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

-ar code (to find any bugs?)

2 posters

Go down

-ar code (to find any bugs?) Empty -ar code (to find any bugs?)

Post by Grass Hopper Tue Aug 04, 2009 12:10 am

so just recently the -ar code bugged, and gave everyone 2 heros... so here goes


code for the -ar commande
Code:
function Trig_all_random_Actions takes nothing returns nothing
    local integer i = 1
    if udg_timer_sec < 15 and udg_timer_min < 1 and udg_timer_hour < 1 then
       
        set udg_AllRandom = true
        call DisplayText("Player 2 has selected the game mode 'All Random' each player will be given a random hero.")
        call DisplayText("If you repick, you will be given another random hero.")
       
        loop
            exitwhen i >= 12
            if i == 6 then
                set i = i+1
            endif
            if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                call random_start(Player(i))
            endif
            set i = i+1
        endloop
    endif
endfunction
//===========================================================================
function InitTrig_all_random takes nothing returns nothing
    set gg_trg_all_random = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_all_random, Player(1), "-ar", true )
    call TriggerAddAction( gg_trg_all_random, function Trig_all_random_Actions )
endfunction

random library
Code:
library random requires cache
private function DisplayText takes string s returns nothing
// short-hand to display text to all players
    call DisplayTextToForce(GetPlayersAll(), s)
endfunction
public function ExistsAlready takes integer i, integer n returns boolean
    local group  g = CreateGroup()
    local boolean b = false
    local unit    v
  // call GroupEnumUnitsInRect(g, GetPlayableMapRect(), null)
  // loop
  //    set  v = FirstOfGroup(g)
    //  call GroupRemoveUnit(g, v)
      // exitwhen (v == null) or (b)
       
      //  if GetUnitTypeId(v) == i then
    //      set b = true
    //    endif
  //   
  //      set v = null
 //  endloop
   
    if udg_HeroExists[n] then
        set b = true
    endif
   
    call DestroyGroup(g)
    set g = null
    return b
endfunction
public function start takes player p returns nothing
    local unit u
    local integer i = GetPlayerId(p)
    local integer n
   
    set udg_PlayerSelected[i] = true
    set udg_PlayerRandomed[i] = true
   
    if udg_Repicked[i] then
        set udg_PlayerRandomed[i*10] = true
    endif   
   
    loop
        set  n = GetRandomInt(0, udg_HeroCount - 1)
        exitwhen ExistsAlready(udg_AllHero[n], n) == false
    endloop
   
    if IsPlayerAlly(p, Player(0)) then
        set u = CreateUnit(p, udg_AllHero[n], GetRectCenterX(gg_rct_Revive1), GetRectCenterY(gg_rct_Revive1), 0)
        call ConditionalTriggerExecute(GetCacheTrigger(CacheOwner(udg_GameHandler), SubString(UnitId2String(GetUnitTypeId(u)), 7, 11)))
        call DisplayText(udg_ColorString[i] + GetPlayerName(p) + "|r has randomed " + GetUnitName(u))
        set  udg_PlayerHero[i] = u
    else
        set u = CreateUnit(p, udg_AllHero[n], GetRectCenterX(gg_rct_Revive2), GetRectCenterY(gg_rct_Revive2), 0)
        call ConditionalTriggerExecute(GetCacheTrigger(CacheOwner(udg_GameHandler), SubString(UnitId2String(GetUnitTypeId(u)), 7, 11)))
        call DisplayText(udg_ColorString[i] + GetPlayerName(p) + "|r has randomed " + GetUnitName(u))
        set  udg_PlayerHero[i] = u
    endif
   
    // set this hero has been picked
    set i = 0
    loop
        exitwhen i == udg_HeroCount + 1
        if GetUnitTypeId(u) == udg_AllHero[i] then
            set udg_HeroExists[i] = true
        endif
        set i = i+1
    endloop
   
    // disable purchasing other heroes
    set n = 0
    loop
        exitwhen n == udg_HeroCount
        call SetPlayerTechMaxAllowed(p, udg_AllHero[n], 0)
        //call SetPlayerTechMaxAllowed(p, 'H00O', 0)
        set n = n + 1
    endloop
   
    // disable picked hero for all players
    call RemoveUnitFromAllStock(GetUnitTypeId(u))
    set n = 0
    loop
        exitwhen n >= 12
        call SetPlayerTechMaxAllowed(Player(n), GetUnitTypeId(u), 0)
        set n = n +1
    endloop
endfunction
endlibrary
Grass Hopper
Grass Hopper
Admin

Posts : 3839
Join date : 2009-03-30

https://40kaos.forumotion.com

Back to top Go down

-ar code (to find any bugs?) Empty Re: -ar code (to find any bugs?)

Post by DarkWanderer Tue Aug 04, 2009 9:45 am

K, got it hopper. I'll look into after work today.

If you figure it out before me, just let me know; Otherwise, I'll do my best to solve the problem.

DarkWanderer
Contributor
Contributor

Posts : 122
Join date : 2009-07-19

Back to top Go down

-ar code (to find any bugs?) Empty Re: -ar code (to find any bugs?)

Post by Grass Hopper Tue Aug 04, 2009 11:10 am

kk thx Very Happy
Grass Hopper
Grass Hopper
Admin

Posts : 3839
Join date : 2009-03-30

https://40kaos.forumotion.com

Back to top Go down

-ar code (to find any bugs?) Empty Re: -ar code (to find any bugs?)

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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