HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Item limitations

10-04-2004, 10:20 PM#1
High Loremaster
Once again, I am having trouble with creating triggers that disallow players to have more than one sword/piece of armor/shield at a time. I have tried many suggestions by other members, but can't seem to get them to work. This is the trigger I have right now:

EVENTS
A unit is issued an order targetting an object

CONDITIONS
((Ordered unit) is a hero) equal to true
Item class of (target item of issued order) equal to miscellaneous
Or: Any conditions are true
Item class of (item carried by ((ordered unit) in slot 1)) equal to miscellaneous
Item class of (item carried by ((ordered unit) in slot 2)) equal to miscellaneous
Item class of (item carried by ((ordered unit) in slot 3)) equal to miscellaneous
Item class of (item carried by ((ordered unit) in slot 4)) equal to miscellaneous
Item class of (item carried by ((ordered unit) in slot 5)) equal to miscellaneous
Item class of (item carried by ((ordered unit) in slot 6)) equal to miscellaneous

ACTIONS
Order (ordered unit) to stop
10-04-2004, 10:22 PM#2
Mech-AG05
maybe instead of a stop order, use specific item types, it would make trigger longer and more complex (alot more complex) but it might work... and make the action "drop item" instead of stop? idk i dont trigger much but thats just my thought?
10-04-2004, 10:48 PM#3
MiGiLiCuDDiE
Event:
Unit aquires item.

Condition:
n/a

Action:
Turn off this trigger
Drop item being minipulated.
If/Then/Multiple Functions:
If: If hero minipulating item has item type of item being minipulated.
Then: Say to player of owner of hero minipulating item " you cant hold more than 2 of the same item"
Turn this trigger on.
Else: Give item being minipulated to hero minipulating item.
Turn this trigger on.
10-05-2004, 08:20 PM#4
High Loremaster
I can't seem to find the condition If hero minipulating item has item type of item being minipulated. anywhere.
10-05-2004, 08:46 PM#5
Anitarf
Boolean - hero has item of type; of course, that only disallows two items of the same type, not of the same class. There is no condition that would check if a hero has item of class, so to get this effect, you need to loop through all six items in his inventory and check each item's classificiation. If any one of the items has that classification then you do the "you cant hold more than 2 of the same item" thing and "skip remaining actions". At the end of the trigger you put "Give item being minipulated to hero minipulating item." ; this will onyl occur if no item is found previously that would share the class with the manipulated item, because in such a case, this last action that returns the item to the hero gets skipped.
10-05-2004, 08:55 PM#6
High Loremaster
Er... could you put it into trigger form? I still can't seem to get it to work, sorry.
10-05-2004, 09:47 PM#7
Gandalf2349
You should try to figure things out yourself instead of have people make maps for you. This isn't trigger exactly, but close enough

variable ItemClass as boolean
Code:
Events
 -Unit acquires item
Conditions
Actions
 -turn this trigger off
 -Item Class = False
 make (hero manipulating item) drop (Manipulated item)
 -For each int a from 1 to 6
  if
   -(Acquired item) class is = to (Itemclass of item in hero slot (hero manipulating item) (int a)) 
  then
   -Game (Display Message to owner of (Hero Manipulating Item) "You can only hold one item of each class"
   set itemclass = true
   skip remaining actions
  Else
End Loop
 if itemclass = false then
  -Give (Hero manipulating item) (manipulated item)
-turn this trigger on
10-05-2004, 10:18 PM#8
High Loremaster
Sorry about having someone else give me the whole trigger, but I have been working on the system for a long while now, and have never had it work, and it was starting to really frustrate me. But, the trigger you gave me seems to be working (well it is only working once then it stops working but I'm sure I can fix that), so THANK YOU for ending abut 2 months of torture for me.
10-06-2004, 06:39 AM#9
Anitarf
Quote:
Originally Posted by Gandalf2349
You should try to figure things out yourself instead of have people make maps for you. This isn't trigger exactly, but close enough

variable ItemClass as boolean
Code:
Events
 -Unit acquires item
Conditions
Actions
 -turn this trigger off
 -Item Class = False
 make (hero manipulating item) drop (Manipulated item)
 -For each int a from 1 to 6
  if
   -(Acquired item) class is = to (Itemclass of item in hero slot (hero manipulating item) (int a)) 
  then
   -Game (Display Message to owner of (Hero Manipulating Item) "You can only hold one item of each class"
   set itemclass = true
   skip remaining actions
  Else
End Loop
 if itemclass = false then
  -Give (Hero manipulating item) (manipulated item)
-turn this trigger on
One thing, all the lines that involve the itemclass variable are redundant. You don't need to check if the variable is false at the end of the trigger, because if it's true, the trigger doesn't get that far anyway (because of "skip remaining actions"). So, itemclass variable can be completely left out of this trigger.