I
IKilledKEnny
Guest
Rodead, next time please send next time assignments to me by Private Massaging. Also the second part of the assignment requests that you add at least 5 comments around the trigger.
this is my homework i atacked it in a map here is the code
Code:function Trig_create_unit_Conditions takes nothing returns boolean if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then return false endif return true endfunction function Trig_create_unit_Actions takes nothing returns nothing call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), GetUnitLoc(GetDyingUnit()) ) endfunction //=========================================================================== function InitTrig_create_unit takes nothing returns nothing set gg_trg_create_unit = CreateTrigger( ) call TriggerRegisterPlayerUnitEventSimple( gg_trg_create_unit, Player(0), EVENT_PLAYER_UNIT_DEATH ) call TriggerAddCondition( gg_trg_create_unit, Condition( function Trig_create_unit_Conditions ) ) call TriggerAddAction( gg_trg_create_unit, function Trig_create_unit_Actions ) endfunction
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then
return false
endif
return true//Ok that all seemed retarded, can't you just remove the "not" and then have return true for the then...?
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )//creates a footman (hfoo) at centre of playable map area (get rect centre etc) facing the bj facing (default building facing)
endfunction//ends the function, lol
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )//Eh eh eh? This doesn't seem necessary =/
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Untitled_Trigger_001, Player(0), EVENT_PLAYER_UNIT_DEATH )//Runs the trig if a unit owned by player 1 (or player 0 in JASS) dies
call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )//Makes it check the condition I believe =/
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
Oops... Forgot to make it have the condition of that the triggering unit is a footman. Smart. Hold on...
There, my ugly long comments. If I do write down comments on my JASS, there will probably be tonnes and they will be 3 miles long lolCode:function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then return false endif return true//Ok that all seemed retarded, can't you just remove the "not" and then have return true for the then...? endfunction function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )//creates a footman (hfoo) at centre of playable map area (get rect centre etc) facing the bj facing (default building facing) endfunction//ends the function, lol //=========================================================================== function InitTrig_Untitled_Trigger_001 takes nothing returns nothing set gg_trg_Untitled_Trigger_001 = CreateTrigger( )//Eh eh eh? This doesn't seem necessary =/ call TriggerRegisterPlayerUnitEventSimple( gg_trg_Untitled_Trigger_001, Player(0), EVENT_PLAYER_UNIT_DEATH )//Runs the trig if a unit owned by player 1 (or player 0 in JASS) dies call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )//Makes it check the condition I believe =/ call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions ) endfunction
function Trig_create_unit_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'hfoo'
endfunction
function Trig_create_unit_Actions takes nothing returns nothing
call CreateUnitAtLoc(Player(0),'hfoo',GetRectCenter(GetPlayableMapRect()),0)
endfunction
//===========================================================================
function InitTrig_create_unit takes nothing returns nothing
set gg_trg_create_unit = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_create_unit, Player(0), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_create_unit, Condition( function Trig_create_unit_Conditions ) )
call TriggerAddAction( gg_trg_create_unit, function Trig_create_unit_Actions )
endfunction