[Trigger] Keep an item in the same slot

Level 7
Joined
Aug 3, 2008
Messages
257
  • Swords
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Crystal Sword
          • (Item-type of (Item being manipulated)) Equal to Diamond Sword
          • (Item-type of (Item being manipulated)) Equal to |c00e3be79Excalibur|r
          • (Item-type of (Item being manipulated)) Equal to Ice Sword
          • (Item-type of (Item being manipulated)) Equal to Mithril Sword
          • (Item-type of (Item being manipulated)) Equal to |c00e3be79Ragnarok|r
          • (Item-type of (Item being manipulated)) Equal to |c0000ff00Short Sword|r
          • (Item-type of (Item being manipulated)) Equal to |c00e3be79Nagrarok|r
          • (Item-type of (Item being manipulated)) Equal to Chirijiraden
          • (Item-type of (Item being manipulated)) Equal to Buster Sword
          • (Item-type of (Item being manipulated)) Equal to Gale Sword
          • (Item-type of (Item being manipulated)) Equal to Silver Sword
          • (Item-type of (Item being manipulated)) Equal to |c00e3be79Eclipse|r
          • (Item-type of (Item being manipulated)) Equal to |c00e3be79Excalibur2|r
          • (Item-type of (Item being manipulated)) Equal to |c00804000K|r|c00aa7f00i|r|c00d4be00kuichimonji|r
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Name of (Hero manipulating item)) Equal to |c000000FFWarrior|r
              • (Name of (Hero manipulating item)) Equal to |c000000FFChaos Knight|r
              • (Name of (Hero manipulating item)) Equal to |c000000FFRogue|r
        • Then - Actions
          • Unit - Order (Triggering unit) to move (Item being manipulated) to inventory slot 4
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
i have it so the item is in slot 4, when i pick up another item of the same i have it so it drops the item, so u can only have 1 of the item and when that happens the item is moved to slot 6, how can i keep it so the item is in slot 4 forever and no one can move it out of that, but still be able drop it?
 
Level 3
Joined
Dec 6, 2005
Messages
67
personally i'd just set a variable... make an array
'has_weapon' size # of players
then when they pick up a sword
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • the long list u had
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • has_weapon[player#] Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Name of (Hero manipulating item)) Equal to |c000000FFWarrior|r
              • (Name of (Hero manipulating item)) Equal to |c000000FFChaos Knight|r
              • (Name of (Hero manipulating item)) Equal to |c000000FFRogue|r
      • Then - Actions
        • Set has_weapon[player#] = true
      • Else - Actions
        • Hero - Drop (Item being manipulated) from (Hero manipulating item)
you also need a
  • Unit - A unit Loses an item
with an action to set the variable back to false if they drop or lose the weapon
 
Level 3
Joined
Dec 6, 2005
Messages
67
i don't think u can force the item to stay in slot 4 while still making it dropable, if u do it my way you could have the item in any of the six slots, won't matter which, but it'll still only let them have one weapon at a time which is what i assume you are trying to accomplish
 
Level 3
Joined
Dec 6, 2005
Messages
67
i see your reason for wanting to keep the items in the right slots then, i'll play with the editor a little and see if i can work out a more fitting solution for ya
 
Level 3
Joined
Dec 6, 2005
Messages
67
Hmm got something
  • Startup
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Unit Group - Add Blademaster 0023 <gen> to heroes
      • Unit Group - Add Far Seer 0025 <gen> to heroes
      • Trigger - Turn on Slot Control <gen>
  • Slot Control
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in heroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Item carried by (Picked unit) in slot 1)) Equal to Artifact
            • Then - Actions
              • Unit - Order (Picked unit) to move (Item carried by (Picked unit) in slot 1) to inventory slot 4
              • Game - Display to (All players) the text: Weapons can't be pu...
            • Else - Actions
thats the basic idea anyway, i'd suggest setting each slot with an item class to keep things easy on yourself... say make all weapons artifacts, all off-hand weapons/shields powerups, etc
 
Level 3
Joined
Dec 6, 2005
Messages
67
well right now it just makes sure that no artifact is in slot 1, and if it is it moves it to slot 4, u'll have to add similar triggers for each slot and each item type... if u want a copy of the test map i can upload it
 
Level 3
Joined
Dec 6, 2005
Messages
67
i don't think so, i'm not that experienced at map making so i'm not sure. It doesn't have any of the location leaks or anything though, and since it only runs through a unit group with the players heroes in it, instead of constantly grabbing ALL units and then matching them to conditions, it should run pretty fast
 
Level 7
Joined
Aug 3, 2008
Messages
257
well i've tried this...
  • Startup
    • Events
      • Unit - A unit enters Enter the World <gen>
    • Conditions
      • ((Entering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Entering unit) to Heroes
      • Trigger - Turn on Start All Slots <gen>
  • Start All Slots
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn on Slot Control 1 <gen>
  • Slot Control 1
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Heroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Picked unit) in slot 1)) Equal to |c0000ff00Short Sword|r
            • Then - Actions
              • Unit - Order (Picked unit) to move (Item carried by (Picked unit) in slot 1) to inventory slot 3
              • Game - Display to (All players matching ((Picked player) Equal to (Owner of (Entering unit)))) the text: The item can't be p...
            • Else - Actions
will this work?
 
Level 3
Joined
Dec 6, 2005
Messages
67
looks like that should move the short sword to slot 3 if it is in slot 1, attached is a working setup, hopefully you can figure out how to integrate the code into your map :)
 

Attachments

  • item_restriction.w3x
    10.8 KB · Views: 57
Last edited:
Level 7
Joined
Aug 3, 2008
Messages
257
Im still having trouble

  • Slot Control 1
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Heroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Picked unit) in slot 1)) Equal to |c0000ff00Short Sword|r
            • Then - Actions
              • Unit - Order (Picked unit) to move (Item carried by (Picked unit) in slot 1) to inventory slot 3
              • Game - Display to (All players) the text: The item can't be p...
            • Else - Actions
This works, but i need to have it detect if theres an item in slot 3, if there is i need it to then instead put the item in slot 4, anyone know how to do that?
 
Level 3
Joined
Dec 6, 2005
Messages
67
  • (Item carried by (Picked unit) in slot 3 Not equal to No item
?

Also i'd suggest taking a look at the map i attached in my last post, you can run it in game if you like and see how it acts in game and then look at the triggers
 
Level 3
Joined
Dec 6, 2005
Messages
67
the additional changes you requested in a working sample
 

Attachments

  • item_restriction.w3x
    11.5 KB · Views: 37
Last edited:
Top