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?)
2 posters
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
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
Similar topics
» Librarian bugs
» Fatal Error bugs
» new switch code -again -.-
» List of Major Bugs/Problems in 0.46b44
» jass jump code
» Fatal Error bugs
» new switch code -again -.-
» List of Major Bugs/Problems in 0.46b44
» jass jump code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Thu Mar 05, 2020 5:09 am by Occuli.Imperator.Aquillon
» 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