- Joined
- Jun 30, 2006
- Messages
- 230
Creating Forces and assigning an upgrade?
I've taken a 2 year break from Warcraft III, and now I'm getting back into it. Horay for me. However, it means I've lost almost everything I learned.
Problem:
In Scenario > Force Properties I've created two forces, Alliance and Horde. Now... how do I use those forces in a trigger? Do they have a global variable or something?
I'd also like to know how to create a force in JASS, I can't seem to remember all the aspects of doing this. I mean, selecting a player in a slot and then adding them to a force depending on the slot they are in. Then depending on which force they are in, research an upgrade.
Obviously, I've rusted
I've taken a 2 year break from Warcraft III, and now I'm getting back into it. Horay for me. However, it means I've lost almost everything I learned.
Problem:
In Scenario > Force Properties I've created two forces, Alliance and Horde. Now... how do I use those forces in a trigger? Do they have a global variable or something?
I'd also like to know how to create a force in JASS, I can't seem to remember all the aspects of doing this. I mean, selecting a player in a slot and then adding them to a force depending on the slot they are in. Then depending on which force they are in, research an upgrade.
Obviously, I've rusted
JASS:
scope InitForces
private function Alliance takes nothing returns nothing
call SetPlayerState( GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, 900 )
call SetPlayerTechResearched( GetEnumPlayer(), 1, udg_ResearchId[0] )
endfunction
private function Horde takes nothing returns nothing
call SetPlayerState( GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, 900 )
call SetPlayerTechResearched( GetEnumPlayer(), 1, udg_ResearchId[25] )
endfunction
private function Actions takes nothing returns nothing
local integer i = 0
call CreepSpawnPreload()
set udg_Alliance = CreateForce()
set udg_Horde = CreateForce()
loop
exitwhen i==6
call ForceAddPlayer(udg_Alliance,Player(i))
call ForceAddPlayer(udg_Horde,Player(i+6))
set i = i+1
endloop
call ForForce(udg_Alliance, function Alliance )
call ForForce(udg_Horde, function Horde )
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerAddAction( trig, function Actions )
endfunction
endscope
JASS:
scope Init
private function Alliance takes nothing returns nothing
call SetPlayerTechResearched( GetEnumPlayer(), 1, udg_ResearchId[0] )
endfunction
private function Horde takes nothing returns nothing
call SetPlayerTechResearched( GetEnumPlayer(), 1, udg_ResearchId[25] )
endfunction
private function Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
call CreepSpawnPreload()
if i < 10 then
if i < 5 then
call ForceAddPlayer( udg_Alliance, GetTriggerPlayer() )
else
call ForceAddPlayer( udg_Horde, GetTriggerPlayer() )
endif
endif
call ForForce( udg_Alliance, function Alliance )
call ForForce( udg_Horde, function Horde )
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerAddAction( trig, function Actions )
endfunction
endscope
JASS:
scope InitialResearch
private function Research takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if i < 10 then
if i < 5 then
call SetPlayerTechResearched( GetEnumPlayer(), 1, udg_ResearchId[0] )
else
call SetPlayerTechResearched( GetEnumPlayer(), 1, udg_ResearchId[25] )
endif
endif
endfunction
private function Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
local force f = CreateForce()
if i < 10 then
if i < 5 then
set f = udg_Alliance
else
set f = udg_Horde
endif
endif
call ForForce( f, function Research )
set f = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerAddAction( trig, function Actions )
endfunction
endscope
Attachments
Last edited: