| 09-04-2007, 08:18 PM | #1 |
Hello There! I've been trying to find how to make a unit only being able to hold one item of a type. Example: Sword: Damage: 10 Equip: Main Hand How do i make the hero drop a second weapon if he tries to pick one up? ![]() |
| 09-04-2007, 09:34 PM | #2 |
make an array table for each item type as well as a number_in_group then unit acquires item of type for each intiger a from 1-number_in_swrod if unit has item of type sword[loop a] then drop last acquired item |
| 09-04-2007, 09:42 PM | #3 |
| 09-04-2007, 09:52 PM | #4 |
Hi Umi From what I understand, you are looking for a system to keep players from hoarding six double handed sword's in a hero's inventory. What you can do is check if the unit is in a specific unit group (i called this variable Armed), if they are then drop manipulated item, otherwise, add the hero to 'Armed'. Somewhere you would also need to check if the manipulated item is a weapon (and not something like a book or potion). I did this by looping an if/then/else to see if the item is in the array. just in case your face looks like this :Events Unit - A unit Acquires an item Conditions Actions For each (Integer A) from 1 to x, do (Actions) Loop - Actions If/then/else if (Item-type of (item being manipulated)) Equal to weapon[(Integer A)] then if/then/else if ((Hero manipulating item) is in Armed) Equal to False then Unit Group - Add (Hero manipulating item to Armed else Hero - Drop (Item being manipulated) from (Hero manipulating item) where x = number of weapons in your map. You also need to define the items in the item-type array with a one-time trigger. something like 'set weapon[1]= claws of attack +15'. hopefully you don't have dozens of weapons because this part has to be done manually. If you want your heroes to dual weild or be able to use shields then try adding another unit group and stay with this similar idea. Edit: this system is pretty much what botanic suggested |
| 09-05-2007, 03:09 PM | #5 |
Hmmm i c (: didn't quiet get that with the X? but I'll try once again Thanks :) |
| 09-05-2007, 07:26 PM | #6 |
the x would be the total number of items of that type |
