sry but, were do i put this?

Discussion in 'JASS Zone' started by sunshinex3, Apr 23, 2016.

  1. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    call UnitMakeAbilityPermanent(unit, true, ability)

    // i need to make abilities given permanent; were do i place the line above into the trigger below?

    function Trig_unit_bonuses_Conditions takes nothing returns boolean
    if ( not ( IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_HERO) == false ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_unit_bonuses_Func001Func001C takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('A0Z2', GetKillingUnitBJ()) <= 100 ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_unit_bonuses_Func001C takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('A0Z2', GetKillingUnitBJ()) < 1 ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_unit_bonuses_Actions takes nothing returns nothing
    if ( Trig_unit_bonuses_Func001C() ) then
    call UnitAddAbilityBJ( 'A0Z2', GetKillingUnitBJ() )
    call UnitAddAbilityBJ( 'A0Z3', GetKillingUnitBJ() )
    call UnitAddAbilityBJ( 'A0Z5', GetKillingUnitBJ() )
    else
    if ( Trig_unit_bonuses_Func001Func001C() ) then
    call IncUnitAbilityLevelSwapped( 'A0Z2', GetKillingUnitBJ() )
    call IncUnitAbilityLevelSwapped( 'A0Z3', GetKillingUnitBJ() )
    call IncUnitAbilityLevelSwapped( 'A0Z5', GetKillingUnitBJ() )
    else
    call DoNothing( )
    endif
    endif
    endfunction

    //===========================================================================
    function InitTrig_unit_bonuses takes nothing returns nothing
    set gg_trg_unit_bonuses = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_unit_bonuses, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_unit_bonuses, Condition( function Trig_unit_bonuses_Conditions ) )
    call TriggerAddAction( gg_trg_unit_bonuses, function Trig_unit_bonuses_Actions )
    endfunction


    // this is the trigger above, where do i place the line?; call UnitMakeAbilityPermanent(unit, true, ability)
     
  2. jonas

    jonas Well-Known Member

    Ratings:
    +42 / 4 / -0
    You don't have to convert the whole trigger to JASS to insert a single line. There is a "custom script" action in the trigger editor.
     
  3. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    unit bonuses
    Events
    Unit - A unit Dies
    Conditions
    ((Killing unit) is A Hero) Equal to False
    Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
    (Level of Damage Bonus (all units) for (Killing unit)) Less than 1
    Then - Actions
    Unit - Add Damage Bonus (all units) to (Killing unit)
    Unit - Add Armor Bonus (All Units) to (Killing unit)
    Unit - Add Attack Speed Bonus (All Units) to (Killing unit)
    Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
    (Level of Damage Bonus (all units) for (Killing unit)) Less than or equal to 100
    Then - Actions
    Unit - Increase level of Damage Bonus (all units) for (Killing unit)
    Unit - Increase level of Armor Bonus (All Units) for (Killing unit)
    Unit - Increase level of Attack Speed Bonus (All Units) for (Killing unit)
    Else - Actions
    Do nothing

    lol, im so stupid, were do i put it in the custom script in?
     
  4. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    also for the part call (unit, true, ability) do i need to alter unit, to be killing unit and the ability to be the name of the actual ability.
     
  5. jonas

    jonas Well-Known Member

    Ratings:
    +42 / 4 / -0
    Yes.

    I would asume you want to put it below the Add Ability
     
    • Informative Informative x 1
  6. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    finally figured it out. will make a new post explaining it. (post name: MakeAbilityPermanent)

    this is the end trigger:
    Code:
    [noparse]
    unit bonuses
      Events
      Unit - A unit Dies
      Conditions
      ((Killing unit) is A Hero) Equal to False
      Actions
      If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
      (Level of Damage Bonus (all units) for (Killing unit)) Less than 1
      Then - Actions
      Unit - Add Damage Bonus (all units) to (Killing unit)
      Custom script:  call UnitMakeAbilityPermanent(GetKillingUnitBJ() , true, 'A0Z2')
      Unit - Add Armor Bonus (All Units) to (Killing unit)
      Custom script:  call UnitMakeAbilityPermanent(GetKillingUnitBJ() , true, 'A0Z3')
      Unit - Add Attack Speed Bonus (All Units) to (Killing unit)
      Custom script:  call UnitMakeAbilityPermanent(GetKillingUnitBJ() , true, 'A0Z5')
      Else - Actions
      If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
      (Level of Damage Bonus (all units) for (Killing unit)) Less than 100
      Then - Actions
      Unit - Increase level of Damage Bonus (all units) for (Killing unit)
      Unit - Increase level of Armor Bonus (All Units) for (Killing unit)
      Unit - Increase level of Attack Speed Bonus (All Units) for (Killing unit)
      Else - Actions
      Do nothing
    [B]
     

Share This Page