| 01-21-2007, 08:24 PM | #1 |
How do I make it so a hero may only carry one type of items? As in, a hero could only carry one weapon in the inventory. Please help me out. Another thing is I am making a hero change based on the Chaos abillity. How do I make a hero keep his stats and level when he changes? For example, hero A is level 11, 4 Strength, 3 Agility, and 2 Intelligence. He has a skill where it would turn him into hero B. Hero B will have the same level and the stats as Hero A. |
| 01-21-2007, 08:26 PM | #2 |
for the first question, you give each item a type.. like weapons - campaign items armor - permanent items shield - miscelanious items.. then you make a trigger that doesnt allow more than one of those types of items in the inventory at a time. ![]() |
| 01-21-2007, 09:04 PM | #3 |
I don't really know anything about triggers so could you just write me the whole trigger things? |
| 01-21-2007, 09:08 PM | #4 |
Hmmm, trigger it (For both) Here one for items http://www.wc3campaigns.net/showthread.php?t=82126. Go to the Hero section in the trigger editor. -Av3n |
| 01-21-2007, 09:59 PM | #5 | |
Quote:
|
| 01-21-2007, 10:26 PM | #6 |
I havn't tested this trigger, but I would assume it works. Miscellanious classification is not unique (use it for misc items such as potions) JASS:function Trig_UniqueClassification_Actions takes nothing returns nothing local item i = GetManipulatedItem() local unit u = GetManipulatingUnit() local itemtype it = GetItemType(i) local integer count = 0 local integer n = 0 loop exitwhen count == 6 if GetItemType(UnitItemInSlot(u, count)) == it then set n = n + 1 endif set count = count + 1 endloop if n >= 2 and GetItemType(i) != ITEM_TYPE_MISCELLANEOUS then call UnitRemoveItem(u, i) endif endfunction function InitTrig_UniqueClassification takes nothing returns nothing set gg_trg_UniqueClassification = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_UniqueClassification, EVENT_PLAYER_UNIT_PICKUP_ITEM ) call TriggerAddAction( gg_trg_UniqueClassification, function Trig_UniqueClassification_Actions ) endfunction edit: I tested it and there was a bug where misc items could not be carried at all. I would take the 3 mins to fix it but I have to go right now. Someone else please correct it. |
| 01-21-2007, 10:42 PM | #7 |
i <3 gui.. heres the way i would do it using different item classes: three triggers. variables: BooleanVariable Trigger: unit has PermanentTrigger: Unit drops permanentTrigger: drop second permanentthis is of course assuming you have a single player rpg here..if not, then youll have to do a bit of editing with arrays and what not. |
| 01-21-2007, 10:49 PM | #8 |
JASS:function Trig_UniqueClassification_Actions takes nothing returns nothing local item i = GetManipulatedItem() local item j local unit u = GetManipulatingUnit() local itemtype it = GetItemType(i) local integer count = 0 local integer n = 0 loop exitwhen count == 6 if GetItemType(UnitItemInSlot(u, count)) == it then if i != UnitItemInSlot(u, count) then set j = UnitItemInSlot(u, count) endif set n = n + 1 endif set count = count + 1 endloop if n >= 2 and GetItemType(i) != ITEM_TYPE_PERMANENT then call UnitRemoveItem(u, j) endif endfunction function InitTrig_UniqueClassification takes nothing returns nothing set gg_trg_UniqueClassification = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_UniqueClassification, EVENT_PLAYER_UNIT_PICKUP_ITEM ) call TriggerAddAction( gg_trg_UniqueClassification, function Trig_UniqueClassification_Actions ) endfunction |
| 01-21-2007, 11:57 PM | #9 |
... I told him alrdy. Help him out with the other problem :P -Av3n |
| 01-23-2007, 12:09 AM | #10 |
Thank you for all the helps! I need an answer for the second question though... Help! |
| 01-23-2007, 12:49 AM | #11 |
heh, for that, just make variables like one for his int one for his agi one for his str one for his level then once he changes, set the new hero's int, str, agi, and level = the variables |
| 01-23-2007, 01:24 AM | #12 |
Oh, and I know NOTHING about JASS so, what am I suppose to replace what with what on the function? I don't understand... - EDIT - How do I also make level requirements or stats requirement to equip items? |
| 01-23-2007, 02:36 AM | #13 |
Your thrid question is the Trigger: Events Unit Maulipulates Item-Av3n |
| 01-23-2007, 04:10 AM | #14 |
You can just copy paste the JASS function right? Or am I wrong? I tried the JASS that Szythe gave me and it didn't work. |
| 01-23-2007, 04:38 AM | #15 | |
Quote:
for level requirements.. Events: unit picks up an item Conditions item being manipulated equal to (your item) Actions if/then/else if level of triggering unit less than (level requirement) then drop item from unit's inventory |
