• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Is this possible/can someone to do this?

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,614
Hey.

I was wondering if this kind of trigger is possible to create. I tried myself but I couldn't do it so I'm here to ask from professionals.

Player takes an item in his inventory with X amount of charged items and moves it to another free slot the item will separate to two items. Both items have then charged amount/2. However, if this slot is already taken nothing will happen: the item and the charges remains, the item will only be moved(just like normally).

This will make possible for player to separate charged items. For example if player have 100 amount of Potions player can divide the potions to two and then give 50 Potions to another character.

I have a test map created by my friend who made a Item Stack System recently, but he doesn't have anymore time to help me with this case so I came here. Can you do the trigger into that map if it's possible to make...

Well, is this possible to create? Perhaps you could do this for me? Rep, credits and thanks will be given! I really need this for TCO campaign. It will be VERY, VERY, VERY USEFUL for any player who playes the campaign.
 

Attachments

  • Item Stack System.w3x
    19.8 KB · Views: 38
Level 6
Joined
Jul 17, 2008
Messages
185
or it can be done like this:

if a player writes -split 1 it will remove 1 charge from last picked item and add 1 new item with 1 charge... dont know if thats possible but it would be much better than split it in half for the reason Baassee mentioned
 
Level 37
Joined
Aug 14, 2006
Messages
7,614
or it can be done like this:

if a player writes -split 1 it will remove 1 charge from last picked item and add 1 new item with 1 charge... dont know if thats possible but it would be much better than split it in half for the reason Baassee mentioned

Okay, you can use a dummy ability for this if necessary. There are still some place in Spell Book.

Is here anyone who can do this...?
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
1. text commands should only be used for interface settings
2. using dummy ability is unnecessary, you can use this simple trigger:
  • Melee Initialization
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: set udg_slotID = GetIssuedOrderId() - 852001
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • slotID Less than 1
              • slotID Greater than 6
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- split --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by (Triggering unit) in slot slotID) Equal to No item
        • Then - Actions
          • Set charges = (Charges remaining in (Target item of issued order))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (charges / 2) Greater than 0
            • Then - Actions
              • Hero - Create (Item-type of (Target item of issued order)) and give it to (Triggering unit)
              • Item - Set charges remaining in (Last created item) to (charges / 2)
              • Item - Set charges remaining in (Target item of issued order) to ((charges + 1) / 2)
              • Trigger - Turn off (This trigger)
              • Custom script: call IssueTargetOrderById( GetTriggerUnit(), GetIssuedOrderId(), GetLastCreatedItem() )
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
          • -------- join --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot slotID)) Equal to (Item-type of (Target item of issued order))
            • Then - Actions
              • Set charges = ((Charges remaining in (Target item of issued order)) + (Charges remaining in (Item carried by (Triggering unit) in slot slotID)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • charges Greater than 0
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by (Triggering unit) in slot slotID) to charges
                  • Item - Remove (Target item of issued order)
                • Else - Actions
            • Else - Actions
split and join "system" (it took like 10 minutes to create). If you move charged item to empty slot, it will split, if you put two same items onto each other, they will stack
EDIT: I uploaded the map, so you won't have to retype this in WE
 

Attachments

  • itemSystem.w3x
    17.3 KB · Views: 44
Level 37
Joined
Aug 14, 2006
Messages
7,614
Okay, wow you did increadible job. But it bugs with the Item Stack System. When I take an item with 6 charges and put it to unused slot half of the charge dissapears. Can you look at the map in this post and fix the problem? Then the whole system is ready to be added to the campaign. Thank you very much!
 

Attachments

  • Item Stack System v1.0.w3x
    21.5 KB · Views: 35
Level 13
Joined
Apr 15, 2008
Messages
1,063
modify my Split item trigger, where you add the item:
  • Hero - Create (Item-type of (Target item of issued order)) and give it to (Triggering unit)
turn the "Stack" trigger off, so
  • Trigger - Turn off Stack <gen>
  • Hero - Create (Item-type of (Target item of issued order)) and give it to (Triggering unit)
  • Trigger - Turn on Stack <gen>
 
Level 37
Joined
Aug 14, 2006
Messages
7,614
Another bug. When I was playing with the items: 1) I had 6 potions I splitted them to all slots, suddenly one item was lost. Look pictures.
 

Attachments

  • 111.jpg
    111.jpg
    594 KB · Views: 91
  • 222.jpg
    222.jpg
    593.9 KB · Views: 68
  • 333.jpg
    333.jpg
    593.1 KB · Views: 72
Level 13
Joined
Apr 15, 2008
Messages
1,063
My bad, the "Inventory full" should be disabled around this line:
  • Custom script: call IssueTargetOrderById( GetTriggerUnit(), GetIssuedOrderId(), GetLastCreatedItem() )
, then it works

Shiroaisu: there are six orders for moving items between inventory slots, 852002-852007 (they don't have any string equivalent, you need to use their numbers). The order 852002 is moving the item in first slot, 852003 to second slot and so on.. So if I simply substract 852001 from the order ID, I get the ID of the slot, which the item is moved into.
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
What I meant is that you need to disable "full inventory" trigger for this action (so that the trigger won't get triggered)
  • Trigger - Turn off Full Inventory <gen>
  • Custom script: call IssueTargetOrderById( GetTriggerUnit(), GetIssuedOrderId(), GetLastCreatedItem() )
  • Trigger - Turn on Full Inventory <gen>
(This action is in the "split" part of the trigger.)

So the trigger will look like this:
  • Split Item
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: set udg_slotID = GetIssuedOrderId() - 852001
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • slotID Less than 1
              • slotID Greater than 6
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- split --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by (Triggering unit) in slot slotID) Equal to No item
        • Then - Actions
          • Set charges = (Charges remaining in (Target item of issued order))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (charges / 2) Greater than 0
            • Then - Actions
              • Trigger - Turn off Stack <gen>
              • Hero - Create (Item-type of (Target item of issued order)) and give it to (Triggering unit)
              • Trigger - Turn on Stack <gen>
              • Item - Set charges remaining in (Last created item) to (charges / 2)
              • Item - Set charges remaining in (Target item of issued order) to ((charges + 1) / 2)
              • Trigger - Turn off (This trigger)
              • Trigger - Turn off Inventory Full <gen>
              • Custom script: call IssueTargetOrderById( GetTriggerUnit(), GetIssuedOrderId(), GetLastCreatedItem() )
              • Trigger - Turn on Inventory Full <gen>
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
          • -------- join --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot slotID)) Equal to (Item-type of (Target item of issued order))
            • Then - Actions
              • Set charges = ((Charges remaining in (Target item of issued order)) + (Charges remaining in (Item carried by (Triggering unit) in slot slotID)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • charges Greater than 0
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by (Triggering unit) in slot slotID) to charges
                  • Item - Remove (Target item of issued order)
                • Else - Actions
            • Else - Actions
 
Level 37
Joined
Aug 14, 2006
Messages
7,614
Ok, here's the currect trigger. I played with the potions for 5 min. Suddenly I lost potions 2 potion of 6 to nowhere. This means there's still something wrong...

  • Split Item
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: set udg_slotID = GetIssuedOrderId() - 852001
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • slotID Less than 1
              • slotID Greater than 6
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- split --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by (Triggering unit) in slot slotID) Equal to No item
        • Then - Actions
          • Set charges = (Charges remaining in (Target item of issued order))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (charges / 2) Greater than 0
            • Then - Actions
              • Trigger - Turn off Stack <gen>
              • Hero - Create (Item-type of (Target item of issued order)) and give it to (Triggering unit)
              • Trigger - Turn on Stack <gen>
              • Item - Set charges remaining in (Last created item) to (charges / 2)
              • Item - Set charges remaining in (Target item of issued order) to ((charges + 1) / 2)
              • Trigger - Turn off (This trigger)
              • Trigger - Turn off Inventory Full <gen>
              • Custom script: call IssueTargetOrderById( GetTriggerUnit(), GetIssuedOrderId(), GetLastCreatedItem() )
              • Trigger - Turn on Inventory Full <gen>
              • Trigger - Turn on (This trigger)
            • Else - Actions
        • Else - Actions
          • -------- join --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot slotID)) Equal to (Item-type of (Target item of issued order))
            • Then - Actions
              • Set charges = ((Charges remaining in (Target item of issued order)) + (Charges remaining in (Item carried by (Triggering unit) in slot slotID)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • charges Greater than 0
                • Then - Actions
                  • Item - Set charges remaining in (Item carried by (Triggering unit) in slot slotID) to charges
                  • Item - Remove (Target item of issued order)
                • Else - Actions
            • Else - Actions
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
My trigger is correct, the "Inventory Full" trigger is bugged. It should have condition String(Issued Order) equals to "smart". It should obviously trigger when hero attempts to pick up item, but since it doesn't have this condition, it triggers when you move items in inventory, and it sometimes delete the item, when moving items in full inventory. (The same error appeared even with my system turned off)
 
Status
Not open for further replies.
Top