HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Darkys Sell Trigger Needs Fix

03-30-2005, 11:16 PM#1
Arkidas
Code:
function Trig_Sell_Tower_Conditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A000' )
endfunction

function Trig_Sell_Tower_Actions takes nothing returns nothing
    call AdjustPlayerStateBJ( 50000, Player(0), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( 50000, Player(0), PLAYER_STATE_RESOURCE_LUMBER )
    call CreateNUnitsAtLoc( 1, 'hhou', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
    call UnitAddAbilityBJ( 'Asud', GetLastCreatedUnit() )
    call SetUnitFlyHeightBJ( GetLastCreatedUnit(), I2R(GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)), 100000.00 )
    call SetUnitUserData( GetLastCreatedUnit(), GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_LUMBER) )
    call AddUnitToStockBJ( GetUnitTypeId(GetSpellAbilityUnit()), GetLastCreatedUnit(), 1, 1 )
    call IssueTrainOrderByIdBJ( GetLastCreatedUnit(), GetUnitTypeId(GetSpellAbilityUnit()) )
    call TriggerSleepAction( 0.00 )
    call KillUnit( GetSpellAbilityUnit() )
endfunction

function Trig_Sells_Unit_Conditions takes nothing returns boolean
    return ( GetUnitTypeId(GetSellingUnit()) == 'hhou' )
endfunction

function Trig_Sells_Unit_Actions takes nothing returns nothing
    local real percent = 50
    local integer gold = R2I(GetUnitFlyHeight(GetSellingUnit())) - GetPlayerState(GetOwningPlayer(GetSellingUnit()), PLAYER_STATE_RESOURCE_GOLD)
    local integer lumber = GetUnitUserData(GetSellingUnit()) - GetPlayerState(GetOwningPlayer(GetSellingUnit()), PLAYER_STATE_RESOURCE_LUMBER)
    call AdjustPlayerStateBJ( ( -50000 + gold + R2I(I2R(gold) * percent / 100) ), GetOwningPlayer(GetSellingUnit()), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( -50000 + lumber + R2I(I2R(lumber) * percent / 100) ), GetOwningPlayer(GetSellingUnit()), PLAYER_STATE_RESOURCE_LUMBER )
    call RemoveUnit( GetSoldUnit() )
    call RemoveUnit( GetSellingUnit() )
endfunction

//===========================================================================
function InitTrig_Sell_Tower takes nothing returns nothing
    local trigger Sells_Unit = CreateTrigger(  )
    set gg_trg_Sell_Tower = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( Sells_Unit, EVENT_PLAYER_UNIT_SELL )
    call TriggerAddCondition( Sells_Unit, Condition( function Trig_Sells_Unit_Conditions ) )
    call TriggerAddAction( Sells_Unit, function Trig_Sells_Unit_Actions )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Sell_Tower, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Sell_Tower, Condition( function Trig_Sell_Tower_Conditions ) )
    call TriggerAddAction( gg_trg_Sell_Tower, function Trig_Sell_Tower_Actions )
endfunction

When any player sells a tower, teh gold always goes to player red. Since I don't know JASS can anyone fix the code for me so it goes to the right player? Thanks in advance. Sincerely,
Arkidas.
04-01-2005, 12:00 AM#2
johnfn
It looks to me like it already does.

call AdjustPlayerStateBJ( ( -50000 + gold + R2I(I2R(gold) * percent / 100) ), GetOwningPlayer(GetSellingUnit()), PLAYER_STATE_RESOURCE_GOLD )
call AdjustPlayerStateBJ( ( -50000 + lumber + R2I(I2R(lumber) * percent / 100) ), GetOwningPlayer(GetSellingUnit()), PLAYER_STATE_RESOURCE_LUMBER )

GetOwningPlayer should give it to the owner of the sold unit.
04-01-2005, 07:26 AM#3
Guest
It looks like you are cramming 2 tr1gg3rz into one... for what reason though?
For some reason it turns tr1gg3rz into *******s

Try using the regualr easy GUI tr1gg3r if you dont know J455,.. or use a comination of custom script and the GUI tr1gg3r

Wtf is up with WC3 Campaigns? Are they trying to f0rce us into talking 1337?
Nice. even more stuff on the word filter. Wt*?!