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)

63% 63% [ 5 ]
38% 38% [ 3 ]

Total Votes : 8

Latest topics
» Faction creeps
Sun Dec 21, 2014 12:49 am by Grass Hopper

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

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

» Talent System
Mon Dec 15, 2014 10:59 am by Grass Hopper

» Capture Points system
Fri Dec 12, 2014 2:36 pm by Grass Hopper

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

» Game Guide
Thu Dec 11, 2014 2:12 pm by Grass Hopper

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

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

» [inquisitoin] Brother-captain Stern
Wed Dec 10, 2014 12:37 pm by Grass Hopper

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

-ar code (to find any bugs?)

View previous topic View next topic Go down

-ar code (to find any bugs?)

Post by Grass Hopper on 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

_________________
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)
avatar
Grass Hopper
Admin

Posts : 3839
Join date : 2009-03-30

View user profile http://40kaos.forumotion.com

Back to top Go down

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

Post by DarkWanderer on 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

View user profile

Back to top Go down

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

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

kk thx Very Happy

_________________
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)
avatar
Grass Hopper
Admin

Posts : 3839
Join date : 2009-03-30

View user profile http://40kaos.forumotion.com

Back to top Go down

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

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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