linamus
I r bak!
- Reaction score
- 57
In this tutorial I'm going to represent you how to do equipable items in GUI.
This is easy to make and use system alowing hero to equip items from inventory to virtual backpack
Why this is usefull?
1) It saves inventory slots
2) You can make as many equipable items as you want
3) Usually only 5 item stats allowed in abilities list. Here it's unlimited
We gonna need:
1) Channel based ability called "Equip"
2) Backpack called "Unequip" (if you are planning more than 11 equipable items, make more backpacks)
3) Several "Unequip" channel-based abilities, number depends on how many equipable items you will have
Example: In Unequip spellbook lies four channel-based abilities: Unequip Weapon ; Unequip Shield ; Unequip Chest ; Unequip Head
Variables:
For each equipable item type we will use two variables
We have equipable Weapon:
EquipWeaponCheck [boolean array]
EquipWeaponItem [item-type array]
We have equipable Shield:
EquipShieldCheck [boolean array]
EquipShieldItem [item-type array]
And so on depending how much equipable items you will make...
Here we will only learn how to equip/unequip weapon. For other items just copy paste and change variables.
This is all, depending on map you're creating depends and items number. In Equip trigger there's easy to classify when adding custom text like "-----weapons-----" after weapon IfThenElse actions have ended, and starts Shields IfThenElse's.
Ty for reading
___________________________
Best Ideas Comes When You're Not Thinking
-> The Land Of Wonders
-> Simple Equipment System TuT
-> Enhance Your Terraining
Introducion
This is easy to make and use system alowing hero to equip items from inventory to virtual backpack
Why this is usefull?
1) It saves inventory slots
2) You can make as many equipable items as you want
3) Usually only 5 item stats allowed in abilities list. Here it's unlimited
Starting
We gonna need:
1) Channel based ability called "Equip"
2) Backpack called "Unequip" (if you are planning more than 11 equipable items, make more backpacks)
3) Several "Unequip" channel-based abilities, number depends on how many equipable items you will have
Example: In Unequip spellbook lies four channel-based abilities: Unequip Weapon ; Unequip Shield ; Unequip Chest ; Unequip Head
Variables:
For each equipable item type we will use two variables
We have equipable Weapon:
EquipWeaponCheck [boolean array]
EquipWeaponItem [item-type array]
We have equipable Shield:
EquipShieldCheck [boolean array]
EquipShieldItem [item-type array]
And so on depending how much equipable items you will make...
Triggers
Here we will only learn how to equip/unequip weapon. For other items just copy paste and change variables.
Code:
Equip
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Q Equip Item
Actions
-------- Weapons --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Target item of ability being cast)) Equal to Sharpened Sword [COLOR="DarkGreen"]---Here we check which item was targeted[/COLOR]
EquipWeaponCheck[(Player number of (Owner of (Casting unit)))] Not equal to True [COLOR="DarkGreen"]---Here we check if equiping unit don't alredy have any weapon equiped[/COLOR]
(Hero level of (Casting unit)) Greater than or equal to 2 [COLOR="DarkGreen"]---It's a condition, Sharpened Sword requires level two to be equiped[/COLOR]
Then - Actions
Hero - Drop (Target item of ability being cast) from (Random unit from (Units owned by (Owner of (Casting unit)) matching (((Matching unit) is A Hero) Equal to True)))
Item - Remove (Last dropped item)
Set EquipWeaponCheck[(Player number of (Owner of (Casting unit)))] = True [COLOR="DarkGreen"]---Here we set that equiping unit now has some weapon[/COLOR]
Set EquipWeaponItem[(Player number of (Owner of (Casting unit)))] = Target item of ability beeing cast [COLOR="DarkGreen"]---And here which weapon type has been equiped[/COLOR]
Unit - Add Item Damage Bonus (+2) to (Casting unit) [COLOR="DarkGreen"]---And here we add stats that item has (ensure that you're making separate abilities for each item, couse two Inteligence +2 won't stack[/COLOR]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions) [COLOR="DarkGreen"]---Add another weapon or shield with different variables[/COLOR]
Code:
Unequip Weapon [COLOR="DarkGreen"]---For each Shield/Chest/Head/So on, make DIFFERENT TRIGGERS[/COLOR]
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Q Unequip Weapon
EquipWeaponCheck[(Player number of (Owner of (Casting unit)))] Equal to True [COLOR="DarkGreen"]---Check if unequiping unit really has something to unequip[/COLOR]
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
EquipWeaponItem[(Player number of (Owner of (Casting unit)))] Equal to Sharpened Sword [COLOR="DarkGreen"]---In each IfThenElse action we're checking item type[/COLOR]
Then - Actions
Unit - Remove Item Damage Bonus (+2) from (Casting unit) [COLOR="DarkGreen"]---Removing ability[/COLOR]
Set EquipWeaponCheck[(Player number of (Owner of (Casting unit)))] = False [COLOR="DarkGreen"]---Setting that unit's weapon slot is free again[/COLOR]
Hero - Create EquipWeaponSlot2[(Player number of (Owner of (Casting unit)))] and give it to (Casting unit) [COLOR="DarkGreen"]---Giving back unequiped item[/COLOR]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions) [COLOR="DarkGreen"]---Another IfThenElse with other weapon[/COLOR]
This is all, depending on map you're creating depends and items number. In Equip trigger there's easy to classify when adding custom text like "-----weapons-----" after weapon IfThenElse actions have ended, and starts Shields IfThenElse's.
Ty for reading
___________________________
Best Ideas Comes When You're Not Thinking
-> The Land Of Wonders
-> Simple Equipment System TuT
-> Enhance Your Terraining