• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Starcraft bunker Ability + Trigger help

Status
Not open for further replies.
Level 7
Joined
Jan 1, 2005
Messages
133
while working onmy new map updates i wanted 2 make a the terran bunker act more like the 1 in the starcraft game. The ability i had worked almost the same but i was only able 2 add 1 type of unit it at 1 time so only marines were allowed in the bunker. (battle station ability)

Wat i need is an ability that would allow for more then 1 type of unit to enter the bunker and wen a unit is in the bunker it can attack enemy units wen they come in range.

i was able to get a ability that enablked me 2 allow more then 1 type of unit but the bunker doesnt attack. it also came with a trigger which made dummies of the unit but i cant understand the point of it, unfortunately i cant test the trigger i got cuz it was from the Samurolosttemple map which is protected. but if any1 can understand the proper function of the trigger plz post ur advice or suggestions here

______________________________________________________

//===========================================================================
// Trigger: Enter marine
//===========================================================================
function Trig_Enter_marine_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTransportUnitBJ(), UNIT_TYPE_STRUCTURE) == true ) ) then
return false
endif
return true
endfunction

function Trig_Enter_marine_Func002C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetLoadedUnitBJ()) == 'zmar' ) ) then
return false
endif
return true
endfunction

function Trig_Enter_marine_Actions takes nothing returns nothing
if ( Trig_Enter_marine_Func002C() ) then
call CreateNUnitsAtLoc( 1, 'z001', GetOwningPlayer(GetLoadedUnitBJ()), GetUnitLoc(GetTransportUnitBJ()), bj_UNIT_FACING )
else
endif
call IssueImmediateOrderBJ( GetLastCreatedUnit(), "holdposition" )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Bunker_Dummys )
endfunction

//===========================================================================
function InitTrig_Enter_marine takes nothing returns nothing
set gg_trg_Enter_marine = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Enter_marine, EVENT_PLAYER_UNIT_LOADED )
call TriggerAddCondition( gg_trg_Enter_marine, Condition( function Trig_Enter_marine_Conditions ) )
call TriggerAddAction( gg_trg_Enter_marine, function Trig_Enter_marine_Actions )
endfunction

//===========================================================================
// Trigger: Enter firebat
//===========================================================================
function Trig_Enter_firebat_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTransportUnitBJ(), UNIT_TYPE_STRUCTURE) == true ) ) then
return false
endif
return true
endfunction

function Trig_Enter_firebat_Func002C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetLoadedUnitBJ()) == 'zcso' ) ) then
return false
endif
return true
endfunction

function Trig_Enter_firebat_Actions takes nothing returns nothing
if ( Trig_Enter_firebat_Func002C() ) then
call CreateNUnitsAtLoc( 1, 'z000', GetOwningPlayer(GetLoadedUnitBJ()), GetUnitLoc(GetTransportUnitBJ()), bj_UNIT_FACING )
else
endif
call IssueImmediateOrderBJ( GetLastCreatedUnit(), "holdposition" )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Bunker_Dummys )
endfunction

//===========================================================================
function InitTrig_Enter_firebat takes nothing returns nothing
set gg_trg_Enter_firebat = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Enter_firebat, EVENT_PLAYER_UNIT_LOADED )
call TriggerAddCondition( gg_trg_Enter_firebat, Condition( function Trig_Enter_firebat_Conditions ) )
call TriggerAddAction( gg_trg_Enter_firebat, function Trig_Enter_firebat_Actions )
endfunction

//===========================================================================
// Trigger: Exit marine
//
//
// ...bevor du fragst:
// Ja, das gehampel mit den Points WAR nötig :C
//===========================================================================
function Trig_Exit_marine_Conditions takes nothing returns boolean
if ( not ( GetIssuedOrderIdBJ() == String2OrderIdBJ("unload") ) ) then
return false
endif
if ( not ( GetUnitTypeId(GetOrderedUnit()) == 'o000' ) ) then
return false
endif
return true
endfunction

function Trig_Exit_marine_Func003C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetOrderTargetUnit()) == 'zmar' ) ) then
return false
endif
return true
endfunction

function Trig_Exit_marine_Func005Func002C takes nothing returns boolean
if ( not ( DistanceBetweenPoints(udg_Point[0], udg_Point[1]) <= 50.00 ) ) then
return false
endif
return true
endfunction

function Trig_Exit_marine_Func005A takes nothing returns nothing
set udg_Point[1] = GetUnitLoc(GetEnumUnit())
if ( Trig_Exit_marine_Func005Func002C() ) then
call RemoveUnit( GetEnumUnit() )
call RemoveLocation( udg_Point[0] )
call RemoveLocation( udg_Point[1] )
return
else
call RemoveLocation( udg_Point[1] )
endif
endfunction

function Trig_Exit_marine_Actions takes nothing returns nothing
set udg_Point[0] = GetUnitLoc(GetOrderedUnit())
// Legt fest welche Einheit den Bunker verlässt
if ( Trig_Exit_marine_Func003C() ) then
set udg_Dummy = 'z001'
else
endif
// Entfernt die oben festgelegte Einheit
call ForGroupBJ( GetUnitsOfTypeIdAll(udg_Dummy), function Trig_Exit_marine_Func005A )
call RemoveLocation( udg_Point[0] )
endfunction

//===========================================================================
function InitTrig_Exit_marine takes nothing returns nothing
set gg_trg_Exit_marine = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Exit_marine, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_Exit_marine, Condition( function Trig_Exit_marine_Conditions ) )
call TriggerAddAction( gg_trg_Exit_marine, function Trig_Exit_marine_Actions )
endfunction

//===========================================================================
// Trigger: Exit firebat
//
//
// ...bevor du fragst:
// Ja, das gehampel mit den Points WAR nötig :C
//===========================================================================
function Trig_Exit_firebat_Conditions takes nothing returns boolean
if ( not ( GetIssuedOrderIdBJ() == String2OrderIdBJ("unload") ) ) then
return false
endif
if ( not ( GetUnitTypeId(GetOrderedUnit()) == 'o000' ) ) then
return false
endif
return true
endfunction

function Trig_Exit_firebat_Func003C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetOrderTargetUnit()) == 'zcso' ) ) then
return false
endif
return true
endfunction

function Trig_Exit_firebat_Func005Func002C takes nothing returns boolean
if ( not ( DistanceBetweenPoints(udg_Point[0], udg_Point[1]) <= 50.00 ) ) then
return false
endif
return true
endfunction

function Trig_Exit_firebat_Func005A takes nothing returns nothing
set udg_Point[1] = GetUnitLoc(GetEnumUnit())
if ( Trig_Exit_firebat_Func005Func002C() ) then
call RemoveUnit( GetEnumUnit() )
call RemoveLocation( udg_Point[0] )
call RemoveLocation( udg_Point[1] )
return
else
call RemoveLocation( udg_Point[1] )
endif
endfunction

function Trig_Exit_firebat_Actions takes nothing returns nothing
set udg_Point[0] = GetUnitLoc(GetOrderedUnit())
// Legt fest welche Einheit den Bunker verlässt
if ( Trig_Exit_firebat_Func003C() ) then
set udg_Dummy = 'z000'
else
endif
// Entfernt die oben festgelegte Einheit
call ForGroupBJ( GetUnitsOfTypeIdAll(udg_Dummy), function Trig_Exit_firebat_Func005A )
call RemoveLocation( udg_Point[0] )
endfunction

//===========================================================================
function InitTrig_Exit_firebat takes nothing returns nothing
set gg_trg_Exit_firebat = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Exit_firebat, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_Exit_firebat, Condition( function Trig_Exit_firebat_Conditions ) )
call TriggerAddAction( gg_trg_Exit_firebat, function Trig_Exit_firebat_Actions )
endfunction

//===========================================================================
// Trigger: Destroy Copy
//
// Hier brauchst nix mehr ändern. Alle Bunkerdummys werden entfernt sobald er Bunker stirbt.
//===========================================================================
function Trig_Destroy_Copy_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetDyingUnit()) == 'o000' ) ) then
return false
endif
return true
endfunction

function Trig_Destroy_Copy_Func004Func002C takes nothing returns boolean
if ( not ( DistanceBetweenPoints(udg_Point[0], udg_Point[1]) <= 50.00 ) ) then
return false
endif
return true
endfunction

function Trig_Destroy_Copy_Func004A takes nothing returns nothing
set udg_Point[1] = GetUnitLoc(GetEnumUnit())
if ( Trig_Destroy_Copy_Func004Func002C() ) then
call RemoveUnit( GetEnumUnit() )
else
call RemoveLocation( udg_Point[1] )
endif
endfunction

function Trig_Destroy_Copy_Actions takes nothing returns nothing
set udg_Point[0] = GetUnitLoc(GetDyingUnit())
call ForGroupBJ( udg_Bunker_Dummys, function Trig_Destroy_Copy_Func004A )
call RemoveLocation( udg_Point[0] )
call RemoveLocation( udg_Point[1] )
endfunction

//===========================================================================
function InitTrig_Destroy_Copy takes nothing returns nothing
set gg_trg_Destroy_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Destroy_Copy, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Destroy_Copy, Condition( function Trig_Destroy_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Destroy_Copy, function Trig_Destroy_Copy_Actions )
endfunction

Varibles it uses
group - udg_Bunker_Dummys = null
location array - udg_Point
integer - udg_Dummy = 0

The varible info on the bunker dummys for me didnt end with null it only had 'Empty unit group' so i dunno if there is a difference.

Anyways i had 2 make 2 dummy units for the triggers and the bunkers attack had damage but it said use attack = none

if any1 can understand the point of this trigger and if i should use it plz post ur comments here.
 
Level 9
Joined
Aug 27, 2004
Messages
471
Whitehorn said:
Just use the existing burrow ability.

I dont think you got what he was trying to do...

Please surround this in "jass" brackets, its very hard to read without them.

And I dont get your problem, to me it sounds like your dummies were replace with null units or something, try and explain a little better.

(Oh and btw, this is not multi-instancable. See, you use global variables, but locals are the only way to multi-instance soemthing. See Kattanas handler system or vexorians CScache for some details. The idea is to pass the locals through a game cache, its much more efficient than globals.)
 
Level 6
Joined
Sep 17, 2005
Messages
276
isnt it possible to give the bunker a spell based on the (huh i dont know the exact english translation) ability that attacks automatically surrounding units - like in battleships. so it would be easy: if marine enter add ability MarineShoots to bunker if firebat enters add ability FirebatShoots to it....
 
Level 15
Joined
Mar 31, 2004
Messages
860
Sunny_D said:
isnt it possible to give the bunker a spell based on the (huh i dont know the exact english translation) ability that attacks automatically surrounding units - like in battleships. so it would be easy: if marine enter add ability MarineShoots to bunker if firebat enters add ability FirebatShoots to it....

There you go!

Make 3 abilities based off Phoenix fire. 1 for marine, firebat, ghost.

When a unit enters/leaves, apply as appropriate.
 
Level 6
Joined
Sep 17, 2005
Messages
276
hehe, reduced the sites of trigger from uncountable to 1. :shock:

a wise man (ME) once (NOW) said - if you are stuck, clear your mind and start from the beginning. :wink:
 
Level 7
Joined
Jan 1, 2005
Messages
133
Thanx for every1s help so far

Thank you so much fellows, i do believe their to b sum progress from every1s contributions on this issue and i will test the all asap.

I like the phoniex fire ability for the units attack, its just the trigger itself im not sure ill b able 2 create, i sorta tried making a trigger based on wen a unit enters sumthing but thats where i got stumpped so if u guys could post me a rough trigger layout, i would much approiate it but i will attempt my own trigger in the meantime.

Also im sry if i wasnt very clear with the JASS triggers i posted, i didnt make the triggers myself i got them from a map. I did implenment them in2 my maps but for me the dummy units were actually being created outside the bunker every time a unit loaded the bunker. Whereas i think they were surpose to b destroyed, Also i wasnt sure if there was coding in the JASS trigger to allow the bunker to turn its attack on which i need to know.
 
Status
Not open for further replies.
Top