HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Request for help on importing an item system

07-23-2008, 05:34 PM#1
Alex15_2005USA
I visited the hiveworkshop and recently ran across this:
http://www.hiveworkshop.com/resources_new/spells/577/

It seemed like a nice system, so I decided to attempt to add specifically, the item stack system to my map. I copied the triggers, and created the items and abilities needed and used by the system myself. And then I set the constants for the items to point to the correct items I made for it.

I fired up my map, got in game, I purchased a few items, and they didn't stack, I've been at it for days now, and quite frankly don't know what else to try. I've tried copying in the triggers one by one, then closing and saving my map, and it still failed to work.

On copying the RCCS v W trigger, it ran up some errors (such as function h2i was already declared, so I commented it out, and it compiled fine.) My knowledge of JASS is very limited, and meager at best, any help would be appreciated.

I am using newgen 5a, world editor 1.21b, and warcraft 3 1.22. I realize that this system I'm trying to add is 3 years old, but I've tested out the demo, and it seemed really nice, so I figured it was worth a shot.

Thanks in advance.
07-24-2008, 09:48 PM#2
Alex15_2005USA
this is a bump since no one seems to want to help me
07-24-2008, 10:11 PM#3
moyack
As far as I know, weaddar has improved this version here, I don't remember where, but I saw a thread similar to this system.

EDIT: found it: http://www.wc3campaigns.net/showthre...highlight=item

Try this one...
07-25-2008, 05:32 PM#4
Alex15_2005USA
Thanks, I'll try it later when I get home.
07-26-2008, 05:00 PM#5
Alex15_2005USA
I've just tested the map, and it wasn't what I was quite looking for. I am looking for in particular the item stack system such as the one by weaddar, that charged items could automatically be stacked into one item slot, and the items could be split by moving the item to a different slot, and a menu would pop up.
07-27-2008, 05:06 PM#6
Alex15_2005USA
Is anyone willing/able to help me? I'd much appreciate it. Thanks.
07-31-2008, 07:41 PM#7
Alex15_2005USA
If anyone could help, I'd much appreciate it, thanks.
08-12-2008, 04:55 PM#8
Alex15_2005USA
if anyone could help, i'd appreciate it.

thanks
08-12-2008, 05:12 PM#9
moyack
tru this one by Shadow1500: http://www.wc3campaigns.net/showthread.php?t=87309

It seems it works in the way you want.
08-14-2008, 02:02 AM#10
Alex15_2005USA
Thank you for your response, but this is not what i am looking for. I am looking for in particular the item stack system (example: buying potions, and it will automatically add up the charges) and the split item menu system, like moving the charges to a different slot will activate a menu that will let you choose how many you would like to split, into two different stacks (example, for selling just one or two, and not the whole thing, giving to teammate, one or two, and not the whole, etc.) as shown in the test map I linked in my first post.
08-15-2008, 03:42 PM#11
Alex15_2005USA
if anyone could help, i'd appreciate it.
08-15-2008, 03:53 PM#12
ragingspeedhorn
For people to be able to help they'd probably need to see how you've implemented the system to see what you've done wrong (or so I think, it's worth a try atleast). Paste the triggers in here using the jass tag and explain your problem, what you did and so on more throughly, what seems clear to you might not appear clear to others. That might also be the reason as to why no one has looked at the thread.
08-15-2008, 04:36 PM#13
Themerion
This trigger will merge charged items upon pick-up.

Trigger:
Stack Charged Items
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Charges remaining in (Item being manipulated)) Greater than 0
Collapse Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Set ItemVariable = (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
ItemVariable Not equal to No item
Collapse Then - Actions
Item - Set charges remaining in ItemVariable to ((Charges remaining in ItemVariable) + (Charges remaining in (Item being manipulated)))
Item - Remove (Item being manipulated)
Collapse Else - Actions
Trigger - Turn off (This trigger)
Hero - Give (Item being manipulated) to (Hero manipulating item)
Trigger - Turn on (This trigger)

Or, an optimized JASS-version:
(the only requirement is that you place the code inside a trigger called Stack Charged Items)

How to turn a trigger into code?

  • Select the trigger
  • Click Edit in the menu bar at the top of the trigger editor window.
  • Chose Convert to Custom Text.



Collapse JASS:
// Put this code, and only this code, inside a trigger called:
// Stack Charged Items

function Trig_Stack_Charged_Items_Actions takes nothing returns boolean
    local item i=GetManipulatedItem()
    local unit u=GetManipulatingUnit()
    local item i2
    
    local integer charges=GetItemCharges(i)
    local integer itype=GetItemTypeId(i)
    local integer j=0
    
    if charges>0 then
      loop
        set i2=UnitItemInSlot(u,j)
        
        if i2!=i and GetItemTypeId(i2)==itype then
            call SetItemCharges(i2, (GetItemCharges(i2) + GetItemCharges(i)))        
            call RemoveItem(i)
            exitwhen true
        endif
        
        set j=j+1
        exitwhen j>=6
      endloop
    endif
    
    set u=null
    set i=null
    set i2=null
    
    return false
endfunction

//===========================================================================
function InitTrig_Stack_Charged_Items takes nothing returns nothing
    set gg_trg_Stack_Charged_Items = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Stack_Charged_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Stack_Charged_Items, Condition( function Trig_Stack_Charged_Items_Actions ) )
endfunction
08-15-2008, 09:25 PM#14
rulerofiron99
Maybe try to study the triggers a little more thoroughly?

By your posts it seems like you want others to do it for you.

You are the inventor of the pentuple post, so something like this shouldn't be a problem.