HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

only one of item type

12-01-2003, 08:40 AM#1
bile
Forgive my newbieness at this. I'm trying to get an item to drop if there allready is the same type of weapon in the hero's inventory. Only 1 item type at a time for specified items.

The best I can come up with is this:
Events
Unit - A unit Acquires an item
Conditions
Or - Any (Conditions) are true
Conditions
(Item being manipulated) Equal to (Item carried by (Triggering unit) of type *insert item type here*)
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
((Item carried by (Triggering unit) of type *insert item type here*) is Owned) Equal to True
Then - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
Game - Display to (All players matching (((Triggering unit) is A Hero) Equal to True)) the text: You allready have t..
Else - Actions
Do nothing

The item type is the same so it just drops the item on contact. Do I need to add some variables or something? I'm clueless. :(
12-01-2003, 10:57 AM#2
ObsidianTitan
This only works if the player only has 1 hero. how i do it is once a player picks up an item that is limited is

Weapon is a item variable (array if you want it to work for all players)
Actions Only
If Weapon equal to no item equal to true
Then set Weapon to (item being manipulated)
Else drop (item being manipulated)
Game display message whatever

And the other required trigger is
Event- unit drops an item
Condition - triggering item equal to Weapon
Action - set Weapon equal to no item

i use this because you can have multiple items be affected by the same trigger, my faverite ways to determin where an item belongs is its type(charged, perminate, artifact, purchasable, and so forth) and item life.
12-01-2003, 11:56 AM#3
bile
I'll try to use that but it might not work. I had plans to use additional heros. I don't quite understand arrays that well, so it will probably be a while before I get this working to my satisfaction. Thank you for the input, it might work.
12-01-2003, 12:08 PM#4
ObsidianTitan
what i mean by array is everytime you use it set it to Weapon(playernumber(ownerof(triggering unit))). what this will do is allow you to only use 1 variable but have it work for all players.
12-01-2003, 12:49 PM#5
bile
I think I get it now. I'll test it out later.
12-01-2003, 03:15 PM#6
The_Inquisitor3
u can do this (it works for me) just use classification on the items.. Swords = Powerups , Potions = Artifact... then use ur trigger using item class.. so if the hero got 2 artifacts (potions) will drop the item...

(go to the item and look the "Stats -Classification" and change it...)

ok i will make u a example. give me a min to copy it from my map
12-01-2003, 04:08 PM#7
vjeux
I maked you a test map, if the hero get already item of the same type (type = tome of power + 1) then he drop the picked item

There is just a bug, the item move, i don't know why ...



12-01-2003, 04:26 PM#8
The_Inquisitor3
i really dont know what kind of map are u making or how many players are in (thats VERY important) but just make a variable and use the"(playernumber(owner of(triggering unit)))" to take a number... like this

(USE ITEM CLASSIFICATION TO AVOID PROBLEMS PICKING UP OTHER KIND OF ITEMS)

In this case... all my Swords are in "campaign" classification..

-----------------------------------------------------------------------------------
make a variable (integer) for each item classification, and make it array (size 24)
-----------------------------------------------------------------------------------

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Campaign
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
ItemLimitSword[(Player number of (Owner of (Triggering unit)))] Equal to ((Player number of (Owner of (Triggering unit))) + 12)
Then - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
Else - Actions
Set ItemLimitSword[(Player number of (Owner of (Triggering unit)))] = ((Player number of (Owner of (Triggering unit))) + 12)
Else - Actions
Do nothing
----------------------------------------------------------------------------------

ok.. i know that it looks very weird.. but this is how it works..


lets say im the player 1.. and I pickup a sword.. i dont have other swords so the variable "Itemswordlimit" will take a number for me.. as the trigger say "Set ItemLimitSword[(Player number of (Owner of (Triggering unit)))] = ((Player number of (Owner of (Triggering unit))) + 12))" so my number will be (my player number + 12) im the player 1 so it will be 1 + 12 = 13 !

And the next time i pickup a sword the trigger will make me drop it because.. i already have the number 13 like the trigger said " If - Conditions
ItemLimitSword[(Player number of (Owner of (Triggering unit)))] Equal to ((Player number of (Owner of (Triggering unit))) + 12)
Then - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)"


tell me if this works 4 u

now u just have to make another trigger to resotore the variable when the item-class its droped.