mattyspatty
New Member
- Reaction score
- 0
JASS:
scope MapInit initializer Init
private function Actions takes nothing returns nothing
local integer n = 0
local group g = null
local unit u = null
//local rect vis1 = Rect(-14976, 14912, -9920, 10976)
//local rect vis2 = Rect(-14976, 11040, -12512, 9344)
//local rect gate = Rect(-10560, 11552, -10208, 11264)
// Define schools
set SCHOOL_NAMES[SCHOOL_EARTH] = "|c00006600Earth|r"
set SCHOOL_NAMES[SCHOOL_AIR] = "|c0033ccffAir|r"
set SCHOOL_NAMES[SCHOOL_FIRE] = "|c00ff0000Fire|r"
set SCHOOL_NAMES[SCHOOL_WATER] = "|c000033ffWater|r"
call SetTimeOfDay(8.00)
call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, 50) // Test if anything works
//call CreateFogModifierRect(Player(11), FOG_OF_WAR_VISIBLE, vis1, true, true)
//call CreateFogModifierRect(Player(11), FOG_OF_WAR_VISIBLE, vis2, true, true)
//call ModifyGateBJ(bj_GATEOPERATION_OPEN, RandomDestructableInRectSimpleBJ(gate))
set n = 0
loop
exitwhen n == 8
if(GetPlayerSlotState(Player(n)) == PLAYER_SLOT_STATE_PLAYING) then
call SetPlayerAllianceStateBJ(Player(n), Player(11), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ(Player(11), Player(n), bj_ALLIANCE_ALLIED_VISION)
call SetPlayerState(Player(n), PLAYER_STATE_RESOURCE_GOLD, 750)
call CreateUnit(Player(n), 039;H000039;, -12380, 11486, 0)
call CreateUnitAtLoc(Player(n), 039;H000039;, GetRectCenter(bj_mapInitialPlayableArea), 0)
endif
set n = n + 1
endloop
// Add Spell Books to MagicSchool
// ==============================
// ========== EARTH ==========
set n = GetRandomInt(1, 3)
if(n == 1) then
call AddItemToStock(gg_unit_h006_0001, 039;I000039;, 0, 1)
elseif(n == 2) then
call AddItemToStock(gg_unit_h006_0001, 039;I00S039;, 0, 1)
else
call AddItemToStock(gg_unit_h006_0001, 039;I01Q039;, 0, 1)
endif
// =========== AIR ===========
set n = GetRandomInt(1, 2)
if(n == 1) then
call AddItemToStock(gg_unit_h006_0001, 039;I00M039;, 0, 1)
else
call AddItemToStock(gg_unit_h006_0001, 039;I00H039;, 0, 1)
endif
// =========== FIRE ==========
set n = GetRandomInt(1, 2)
if(n == 1) then
call AddItemToStock(gg_unit_h006_0001, 039;I01H039;, 0, 1)
else
call AddItemToStock(gg_unit_h006_0001, 039;I01B039;, 0, 1)
endif
// ========== WATER ==========
set n = GetRandomInt(1, 3)
if(n == 1) then
call AddItemToStock(gg_unit_h006_0001, 039;I00B039;, 0, 1)
elseif(n == 2) then
call AddItemToStock(gg_unit_h006_0001, 039;I00R039;, 0, 1)
else
call AddItemToStock(gg_unit_h006_0001, 039;I01L039;, 0, 1)
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger MapInit = CreateTrigger()
call TriggerAddAction(MapInit, function Actions)
endfunction
endscope
essentially, im trying to create the heroes, add a visibility mod and add some items into a building stock
but for now, it wont seem to work at all I just converted all my code from jass to vJass, the map saves without any errors but i cannot figure out why this trigger wont run.
When i play the map there are no units created and i have no gold. Would anyone be able to shed some light on this issue?
Also any tips on how my code is would be appreciated, i'm sure ive done some parts the hard way