Log in

I forgot my password

Current Version: v0.0.01A

Alpha version


Changelogs to come



Poll

Changes to the way I release versions? (read the thread)

63% 63% [ 5 ]
38% 38% [ 3 ]

Total Votes : 8

Latest topics
» 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

» [inquisitoin] Brother-captain Stern
Wed Dec 10, 2014 12:37 pm by Grass Hopper

Version Progress
Changes for v0.02.0A
||||||||||||||||||||[] [general]
||||||||||||||||||||[] [Heroes]
||||||||||||||||||||[] [Items]
||||||||||||||||||||[] [Bugs]
||||||||||||||||||||[] [Total]

creep defense and such

View previous topic View next topic Go down

creep defense and such

Post by Grass Hopper on Wed Jul 29, 2009 12:36 am

protect friendlies
Code:
function Trig_Protect_Friendly_Conditions takes nothing returns boolean
    return SameTeam(GetTriggerUnit(), GetAttacker())
endfunction
function Trig_Protect_Friendly_Actions takes nothing returns nothing
    if GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) > 150 then
        call IssueImmediateOrderById(GetAttacker(), OrderId("stop"))
    endif
endfunction
//===========================================================================
function InitTrig_Protect_Friendly takes nothing returns nothing
    set gg_trg_Protect_Friendly = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Protect_Friendly, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Protect_Friendly, Condition( function Trig_Protect_Friendly_Conditions ) )
    call TriggerAddAction( gg_trg_Protect_Friendly, function Trig_Protect_Friendly_Actions )
endfunction

and the functions SameTeam and PlayerForceById

Code:
function PlayerForceById takes integer i returns integer
    if IsPlayerInForce(Player(i), udg_team[1]) then
        return 0
    elseif IsPlayerInForce(Player(i), udg_team[2]) then
        return 1
    endif
   
    return 3
endfunction
Code:
function SameTeam takes unit u, unit v returns boolean
    return PlayerForceById(GetPlayerId(GetOwningPlayer(u))) == PlayerForceById(GetPlayerId(GetOwningPlayer(v)))
endfunction

_________________
warning! very-stubborn, sarcastic, self-important, argumentative developer detected!

And unto the masses, He doth spoke:
"Behold The Stuff! It Is Good!"
And the Stuff was good.

Heroes:
Commander Farsight (colab - implemented) - Ku'gaath Plaguefather(incomplete) - Ilyana Arienal(incomplete) - Harlequin Shadowseer(incomplete) - Modular Tau Battlesuit(sandbox)
avatar
Grass Hopper
Admin

Posts : 3839
Join date : 2009-03-30

View user profile http://40kaos.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum