1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Starcraft bunker Ability + Trigger help

Discussion in 'Map Development' started by night_wolveX, Nov 3, 2005.

  1. night_wolveX

    night_wolveX

    Joined:
    Jan 1, 2005
    Messages:
    131
    Resources:
    7
    Maps:
    7
    Resources:
    7
    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.
     
  2. Horn

    Horn

    Joined:
    Mar 31, 2004
    Messages:
    938
    Resources:
    20
    Models:
    14
    Icons:
    1
    Skins:
    3
    Tutorials:
    2
    Resources:
    20
    Just use the existing burrow ability.
     
  3. Modeler

    Modeler

    Joined:
    Aug 27, 2004
    Messages:
    496
    Resources:
    0
    Resources:
    0
    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.)
     
  4. Sunny_D

    Sunny_D

    Joined:
    Sep 17, 2005
    Messages:
    277
    Resources:
    0
    Resources:
    0
    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....
     
  5. Horn

    Horn

    Joined:
    Mar 31, 2004
    Messages:
    938
    Resources:
    20
    Models:
    14
    Icons:
    1
    Skins:
    3
    Tutorials:
    2
    Resources:
    20
    There you go!

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

    When a unit enters/leaves, apply as appropriate.
     
  6. Sunny_D

    Sunny_D

    Joined:
    Sep 17, 2005
    Messages:
    277
    Resources:
    0
    Resources:
    0
    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:
     
  7. night_wolveX

    night_wolveX

    Joined:
    Jan 1, 2005
    Messages:
    131
    Resources:
    7
    Maps:
    7
    Resources:
    7
    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.