- Joined
- May 4, 2007
- Messages
- 2,260
Guys, i have a problem with my reward system...
To explain the reward system in my map rewards the players that train more units.
So every time a player trains 1 unit, i add that unit to a group.
Ex: An Unit owned by Player 1 finishes training a unit > add trained unit yo 'P1_Units_Trained'.
When 'P1_units_trained' reaches 20 (this means that Player 1 trained 20 units), my reward system will be activated and the player will summon a dwarf army in his aid.
Here is the trigger:
I will explain, to start i have to regions: m and p.
1- The number is reached, the camera starts shacking and a text is displayed
2- Create a portal in region m
3- Create the special Town Portal Effect in region m
4- create 9 units in region m for Player 6
5- order those units to move to region p
6- Once the units reach the region, their ownership goes to Player 1
7- Stop shacking the camera
However i have several problems with BJ's and even more problems with the dam locations .... i just don't know how to use them .... yet ..
So what i ask here is if some1 who understands my script to plz help me improve it and, more important, please help me make it work (ya, because it doesn't work).
This is my next level of JASS learning ... as you can see i tried to dismount the Cam BJ's and i think i did it ... Anyway help please ?
Also if you have a better system to keep track of trained units, instead of creating a single UnitGroup for each player, plz share that method with me.
To explain the reward system in my map rewards the players that train more units.
So every time a player trains 1 unit, i add that unit to a group.
Ex: An Unit owned by Player 1 finishes training a unit > add trained unit yo 'P1_Units_Trained'.
When 'P1_units_trained' reaches 20 (this means that Player 1 trained 20 units), my reward system will be activated and the player will summon a dwarf army in his aid.
Here is the trigger:
JASS:
function army_conds takes nothing returns boolean
return CountUnitsInGroup(udg_TrainedUnits_P1) == 20
endfunction
//============================================================================
function army_acts takes nothing returns nothing
local location m = gg_rct_Region_033
local location p = gg_rct_p1_workers_start
local unit gate = CreateNUnitsAtLoc( 1, 'hprt', Player(0), GetRectCenter(m), bj_UNIT_FACING )
local effect ef = AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", m)
local unit m1 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
local unit m2 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
local unit m3 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
local unit m4 = CreateUnitAtLoc(Player(5), 'h014', GetRectCenter(m), 90.00)
local unit r1 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
local unit r2 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
local unit r3 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
local unit r4 = CreateUnitAtLoc(Player(5), 'hrif', GetRectCenter(m), 90.00)
local unit h1 = CreateUnitAtLoc(Player(5), 'H015', GetRectCenter(m), 90.00)
call TriggerExecute( gg_trg_Army1_text )
call CameraSetTargetNoiseEx(10, 5*Pow(10, 5), true)
call CameraSetSourceNoiseEx(10, 5*Pow(10, 5), true)
call GroupPointOrder(GetUnitsInRectAll(m), "move", GetRectCenter(p))
call DestroyEffect(ef)
call KillUnit( gate )
call TriggerSleepAction(4.00)
call SetUnitOwner(m1, Player(0), true)
call SetUnitOwner(m2, Player(0), true)
call SetUnitOwner(m3, Player(0), true)
call SetUnitOwner(m4, Player(0), true)
call SetUnitOwner(r1, Player(0), true)
call SetUnitOwner(r2, Player(0), true)
call SetUnitOwner(r3, Player(0), true)
call SetUnitOwner(r4, Player(0), true)
call SetUnitOwner(h1, Player(0), true)
call CameraSetTargetNoiseEx(0, 0*Pow(0, 0), true)
call CameraSetSourceNoiseEx(0, 0*Pow(0, 0), true)
call RemoveLocation(m)
call RemoveLocation(p)
set gate = null
set ef = null
set m = null
set p = null
set m1 = null
set m2 = null
set m3 = null
set m4 = null
set r1 = null
set r2 = null
set r3 = null
set r4 = null
set h1 = null
call DisableTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function Army_P1 takes nothing returns nothing
local trigger army = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH )
call TriggerAddCondition(army, Condition(function army_conds))
call TriggerAddAction( army, function army_acts )
endfunction
I will explain, to start i have to regions: m and p.
1- The number is reached, the camera starts shacking and a text is displayed
2- Create a portal in region m
3- Create the special Town Portal Effect in region m
4- create 9 units in region m for Player 6
5- order those units to move to region p
6- Once the units reach the region, their ownership goes to Player 1
7- Stop shacking the camera
However i have several problems with BJ's and even more problems with the dam locations .... i just don't know how to use them .... yet ..
So what i ask here is if some1 who understands my script to plz help me improve it and, more important, please help me make it work (ya, because it doesn't work).
This is my next level of JASS learning ... as you can see i tried to dismount the Cam BJ's and i think i did it ... Anyway help please ?
Also if you have a better system to keep track of trained units, instead of creating a single UnitGroup for each player, plz share that method with me.