Ok so I'm creating an gladiator arena map, and in it your weapons will be attatched to your unit so each item represents each weapon. Now of course this means that you can't run around with two weapons in the same hand etc, that's why I need some sort of item handling system that makes you only able to have one weapon of it's own kind.
I have splited up the item weapons in campaign, permanent, purchasable and miscellaneous:
Permanent = Two handed melee weapons.
Purchasable = Bows.
Campaign = Left handed weapons or shields.
Miscellaneous = Right handed weapons or shields.
I have tried to create triggers that makes you drop all items your not supposed to be able to carry when you pick up a new item, but it doesn't work to 100%, the loop drops one unallowed item and then skips the rest.
I even tried to code the loop manually, step by step, but I got the same result. (Meaning the loop actually works but that something else is wrong.)
Here is the trigger used for Bows:
And here is one for Left Hand: (Two hand and right hand looks exactly the same.)
The 0.01 wait actions were to prevent bugging, but it didn't work. Same result without them.
Does anyone here know what's wrong in the coding?
Help would be most appreciated. =)
I have splited up the item weapons in campaign, permanent, purchasable and miscellaneous:
Permanent = Two handed melee weapons.
Purchasable = Bows.
Campaign = Left handed weapons or shields.
Miscellaneous = Right handed weapons or shields.
I have tried to create triggers that makes you drop all items your not supposed to be able to carry when you pick up a new item, but it doesn't work to 100%, the loop drops one unallowed item and then skips the rest.
I even tried to code the loop manually, step by step, but I got the same result. (Meaning the loop actually works but that something else is wrong.)
Here is the trigger used for Bows:
Trigger:
- Pickup Bow
- Events
- Unit - A unit Acquires an item
- Conditions
- And - All (Conditions) are true
- Conditions
- (Item-class of (Item being manipulated)) Equal to Purchasable
- ((Triggering unit) is in PlayerHeroes) Equal to True
- Conditions
- And - All (Conditions) are true
- Actions
- Game - Display to (All players) the text: 1
- 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
- Or - Any (Conditions) are true
- Conditions
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Permanent
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Campaign
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Miscellaneous
- Conditions
- Or - Any (Conditions) are true
- Then - Actions
- Hero - Drop the item from slot (Integer A) of (Triggering unit)
- Wait 0.01 seconds
- Game - Display to (All players) the text: 1.5
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Game - Display to (All players) the text: 2
- For each (Integer B) from 1 to 6, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- And - All (Conditions) are true
- Conditions
- (Item-class of (Item carried by (Triggering unit) in slot (Integer B))) Equal to Purchasable
- (Item carried by (Triggering unit) in slot (Integer B)) Equal to (Item being manipulated)
- Conditions
- And - All (Conditions) are true
- Then - Actions
- Game - Display to (All players) the text: 2.5
- Unit Group - Remove (Triggering unit) from PlayerHeroes
- Wait 0.10 seconds
- Unit - Replace (Triggering unit) with a Gladiator Ranged using The old unit's relative life and mana
- Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
- Set PlayerHero[(Player number of (Player((Player number of (Owner of (Triggering unit))))))] = (Last replaced unit)
- Wait 0.10 seconds
- Unit Group - Add PlayerHero[(Player number of (Owner of (Triggering unit)))] to PlayerHeroes
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- And - All (Conditions) are true
- Conditions
- (Item-class of (Item carried by (Triggering unit) in slot (Integer B))) Equal to Purchasable
- (Item carried by (Triggering unit) in slot (Integer B)) Not equal to (Item being manipulated)
- Conditions
- And - All (Conditions) are true
- Then - Actions
- Game - Display to (All players) the text: 2.5
- Hero - Drop the item from slot (Integer B) of (Triggering unit)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Game - Display to (All players) the text: 3
- Events
And here is one for Left Hand: (Two hand and right hand looks exactly the same.)
Trigger:
- Pickup Left Hand
- Events
- Unit - A unit Acquires an item
- Conditions
- (Item-class of (Item being manipulated)) Equal to Campaign
- 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
- Or - Any (Conditions) are true
- Conditions
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Purchasable
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Permanent
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Miscellaneous
- And - All (Conditions) are true
- Conditions
- (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Campaign
- (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
- Conditions
- Conditions
- Or - Any (Conditions) are true
- Then - Actions
- Hero - Drop the item from slot (Integer A) of (Triggering unit)
- Wait 0.01 seconds
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer A) from 1 to 6, do (Actions)
- Events
The 0.01 wait actions were to prevent bugging, but it didn't work. Same result without them.
Does anyone here know what's wrong in the coding?
Help would be most appreciated. =)