Log in
Current Version: v0.0.01A
Alpha version
Changelogs to come
Latest topics
Version Progress
Changes for v0.02.0A||||||||||||||||||||[●] [general]
||||||||||||||||||||[●] [Heroes]
||||||||||||||||||||[●] [Items]
||||||||||||||||||||[●] [Bugs]
||||||||||||||||||||[●] [Total]
-ar code (to find any bugs?)
Page 1 of 1
-ar code (to find any bugs?)
so just recently the -ar code bugged, and gave everyone 2 heros... so here goes
code for the -ar commande
random library
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)
Re: -ar code (to find any bugs?)
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.
If you figure it out before me, just let me know; Otherwise, I'll do my best to solve the problem.
DarkWanderer- Contributor
- Posts : 122
Join date : 2009-07-19
Re: -ar code (to find any bugs?)
kk thx 

_________________
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)

» Emoticon Code from Neopets!
» Can't Register New Friend Or Receipt Code
» DC Infinite Heroes Find
» JOIN THE MOST BEASTLY DOJO WITH THE CODE: AFAEAHGE
» New Cheerleading Move Code
» Can't Register New Friend Or Receipt Code
» DC Infinite Heroes Find
» JOIN THE MOST BEASTLY DOJO WITH THE CODE: AFAEAHGE
» New Cheerleading Move Code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
» Faction creeps
» [SCII] [Inquisition] Hector Rex
» [necrons] Orikan, the Diviner
» Talent System
» Capture Points system
» [SCII] [Orks] Warboss(es)
» Game Guide
» [Inquisition] Mordrak
» [inquiition] Kaldor Draigo