HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

stacking

08-05-2004, 03:13 PM#1
logik
would anyone be able to make a trigger which checks if the player is picking up a charged item,

then if the player already has that item in their inventory it will add a charge to it and remove the newly aquired item...

i am just wondering if its possible or could someone do it? it would be handy for numerous maps and stuff, atm i cant be bothered coz its late 4 me and i wanna sleep
08-05-2004, 03:37 PM#2
Eeporgorg
Not possible, at least by my knowledge. I busted my brain trying to figure it out :(
08-05-2004, 04:12 PM#3
Aiursrage2k
Oh you can get it, I just cant remember if the event is aqcuires item or loses item. Bah I will firgue it out when I am back home.
08-05-2004, 08:26 PM#4
Raptor--
Quote:
Originally Posted by logik
would anyone be able to make a trigger which checks if the player is picking up a charged item,

then if the player already has that item in their inventory it will add a charge to it and remove the newly aquired item...

i am just wondering if its possible or could someone do it? it would be handy for numerous maps and stuff, atm i cant be bothered coz its late 4 me and i wanna sleep

event - unit acquires item

actions -
for A = 1 to 6
if (item type is the same) and (charge is > 0 on both items) and (item in slot (A) != acquired item) then
add (number of charges on acquired item) to item in slot (A)
remove acquired item
skip remaining actions
end if
end loop
08-06-2004, 01:33 AM#5
Eeporgorg
Quote:
Originally Posted by Raptor--
event - unit acquires item

actions -
for A = 1 to 6
if (item type is the same) and (charge is > 0 on both items) and (item in slot (A) != acquired item) then
add (number of charges on acquired item) to item in slot (A)
remove acquired item
skip remaining actions
end if
end loop
"item type is the same" and "both items" are not possible functions. I wish I lived in your worldeditor :(
08-06-2004, 01:36 AM#6
shiggityshwa
function Trig_ITEMS_Acquisition_Actions takes nothing returns nothing
local boolean check = false
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( (check == false) and ( GetItemCharges(GetManipulatedItem()) > 0 ) and ( GetItemCharges(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) > 0 ) and ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) == GetItemTypeId(GetManipulatedItem()) ) and ( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()) != GetManipulatedItem() ) ) then
call SetItemCharges( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()), ( GetItemCharges(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) + GetItemCharges(GetManipulatedItem()) ) )
call RemoveItem( GetManipulatedItem() )
set check = true
else
call DoNothing( )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction

//===========================================================================
function InitTrig_ITEMS_Acquisition takes nothing returns nothing
set gg_trg_ITEMS_Acquisition = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ITEMS_Acquisition, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_ITEMS_Acquisition, function Trig_ITEMS_Acquisition_Actions )
endfunction





That works i'm using it right now in my map
08-06-2004, 01:57 AM#7
Eeporgorg
Wow! I guess I was sleepy or something, I got it to work in WEU GUI.

Here's the code.

Code:
Melee Initialization
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-class of (Item being manipulated)) Equal to Charged
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item being manipulated)) Equal to (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A)))
                    Then - Actions
                        If ((Item being manipulated) Not equal to (Item carried by (Hero manipulating item) in slot (Integer A))) then do (Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))) else do (Skip remaining actions)
                        Item - Remove (Item being manipulated)
                    Else - Actions
                        Do nothing