@@ -662,4 +662,377 @@ Displays "[ALLIES] Gather for **ItemName** here."
662662
663663---
664664
665- That's it for all the Item-related key values. In next post we'll review different examples.
665+ ## Examples
666+
667+ 1 . [ Basic Item Skeleton] ( #basic )
668+ 2 . [ Adding More Stats] ( #stats )
669+ 3 . [ Charged Consumables] ( #charged )
670+ - Tome of Stats
671+ - Potion of Health
672+ - Summons
673+ 4 . [ Upgradeable Items and Recipes] ( #recipes )
674+ 5 . [ Passives] ( #passives )
675+ - Auras
676+ - Damage over time
677+ - Cleave
678+ - Crit
679+ - Lifesteal Orb
680+ - Block
681+
682+ <a name =" basic " ></a >
683+
684+ ## Basic Item Skeleton
685+
686+ Copy this to start an item
687+
688+ ```
689+ "item_custom"
690+ {
691+ "ID" "1100"
692+ "BaseClass" "item_datadriven"
693+ "AbilityTextureName" "item_rapier"
694+ "Model" "models/props_gameplay/recipe.vmdl"
695+ "Effect" "particles/generic_gameplay/dropped_item.vpcf"
696+ "ItemQuality" "artifact"
697+
698+ "ItemCost" "322"
699+ "ItemKillable" "0"
700+ "ItemSellable" "1"
701+ "ItemPurchasable" "1"
702+ "ItemDroppable" "1"
703+ "ItemShareability" "ITEM_NOT_SHAREABLE"
704+
705+ "SideShop" "1"
706+ "SecretShop" "0"
707+
708+ "ItemStackable" "1"
709+ "ItemPermanent" "1"
710+ "ItemDisassembleRule" "DOTA_ITEM_DISASSEMBLE_ALWAYS"
711+
712+ "AbilitySpecial"
713+ {
714+ "01"
715+ {
716+ "var_type" "FIELD_INTEGER"
717+ "bonus_stat" "100"
718+ }
719+ }
720+
721+ "Modifiers"
722+ {
723+ "modifier_item_custom"
724+ {
725+ "Passive" "1"
726+ "IsHidden" "1"
727+ "Attributes" "MODIFIER_ATTRIBUTE_MULTIPLE"
728+ "Properties"
729+ {
730+ "MODIFIER_PROPERTY_STATS_STRENGTH_BONUS" "%bonus_stat"
731+ }
732+ }
733+ }
734+ }
735+ ```
736+
737+ Those are the most important values. For Charges, Upgrades, Sounds, Aliases & Declarations add the lines explained before, I kept them out of the basic layout because they aren't needed for most items.
738+
739+ I also added a very basic passive Modifier which takes the _ bonus_stat_ from ` AbilitySpecial ` to give 1 Strength bonus. Using ` AbilitySpecial ` makes it easier to make tooltips and adjust item values later without having to change said tooltips.
740+
741+ ---
742+
743+ <a name =" stats " ></a >
744+
745+ ## Adding More Stats
746+
747+ Every value from [ Modifier Constants] ( https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Constants#Modifier_Properties ) can be added to the ` "Properties" ` block, some very common examples are:
748+
749+ ```
750+ "Properties"
751+ {
752+ "MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "%bonus_attackspeed"
753+ "MODIFIER_PROPERTY_STATS_STRENGTH_BONUS" "%bonus_str"
754+ "MODIFIER_PROPERTY_STATS_AGILITY_BONUS" "%bonus_agi"
755+ "MODIFIER_PROPERTY_STATS_INTELLECT_BONUS" "%bonus_int"
756+ "MODIFIER_PROPERTY_HEALTH_BONUS" "%bonus_hp"
757+ "MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT" "%bonus_health_regen"
758+ "MODIFIER_PROPERTY_MANA_BONUS" "%bonus_hp"
759+ "MODIFIER_PROPERTY_MANA_REGEN_PERCENTAGE" "%bonus_mana_regen"
760+ "MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE" "%bonus_damage_percent"
761+ }
762+ ```
763+
764+ ---
765+
766+ <a name =" charged " ></a >
767+
768+ ## Charged Consumables
769+
770+ ### Tome of Stats
771+
772+ [ item_tome_of_knowledge] ( https://github.com/MNoya/Warchasers/blob/master/scripts/npc/npc_items_custom.txt#L1475 )
773+
774+ ### Potion of Health
775+
776+ [ item_potion_of_healing] ( https://github.com/MNoya/Warchasers/blob/master/scripts/npc/npc_items_custom.txt#L1844 )
777+
778+ ### Summons
779+
780+ [ item_demonic_figurine] ( https://github.com/MNoya/Warchasers/blob/master/scripts/npc/npc_items_custom.txt#L2967 )
781+
782+ <a name =" recipes " ></a >
783+
784+ ## Upgradeable Items and Recipes
785+
786+ - See [ Reflex] ( https://github.com/bmddota/reflexdota/blob/source2/game/dota_addons/reflex/scripts/npc/npc_items_custom.txt )
787+
788+ ---
789+
790+ Apart from these values, item code uses the same datadriven values as abilities. See the [ DataDriven Ability Breakdown] ( ability-keyvalues ) .
791+
792+ <a name =" passives " ></a >
793+
794+ ## Passives
795+
796+ ### Auras
797+
798+ ` "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_AURA | DOTA_ABILITY_BEHAVIOR_PASSIVE" `
799+
800+ In a modifier block:
801+
802+ ```
803+ "Aura" "custom_aura"
804+ "Aura_Teams" "DOTA_UNIT_TARGET_TEAM_FRIENDLY"
805+ "Aura_Radius" "%radius"
806+ "Aura_Types" "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC"
807+ "Aura_Flags" "DOTA_UNIT_TARGET_FLAG_RANGED_ONLY"
808+ ```
809+
810+ Then have a new modifier block with the Aura name with the desired effects.
811+
812+ ### Damage over time
813+
814+ Inside a modifier, use ` "ThinkInterval" "1" ` and have a ` "OnIntervalThink" ` block in which you do damage.
815+
816+ ```
817+ "ThinkInterval" "1"
818+ "OnIntervalThink"
819+ {
820+ "Damage"
821+ {
822+ "Target"
823+ {
824+ "Center" "CASTER"
825+ "Radius" "%radius"
826+ "Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY"
827+ "Types" "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC"
828+ }
829+ "Type" "DAMAGE_TYPE_MAGICAL"
830+ "Damage" "%damage_per_second"
831+ }
832+ }
833+ ```
834+
835+ ### Cleave
836+
837+ Inside a modifier. Keep in mind this will work on ranged, so you need to restrict it when applying this modifier if you need.
838+
839+ ```
840+ "OnAttackLanded"
841+ {
842+ "CleaveAttack"
843+ {
844+ "CleavePercent" "10"
845+ "CleaveRadius" "140"
846+ "CleaveEffect" "particles/units/heroes/hero_sven/sven_spell_great_cleave.vpcf"
847+ }
848+ }
849+ ```
850+
851+ ### Crit
852+
853+ There is a ` MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE ` Property but this doesn't include a chance, so you need to use a DataDriven ` Random ` when starting the attack, and applying a modifier that has the crit, removing it later ` OnAttackLanded ` .
854+
855+ The first ` RemoveModifier ` is added to disable people from canceling attacks to get a guaranteed crit.
856+
857+ ```
858+ "modifier_crit"
859+ {
860+ "Passive" "1"
861+ "IsHidden" "1"
862+ "OnAttackStart"
863+ {
864+ "RemoveModifier"
865+ {
866+ "ModifierName" "crit"
867+ "Target" "CASTER"
868+ }
869+ "Random"
870+ {
871+ "Chance" "%crit_chance"
872+ "OnSuccess"
873+ {
874+ "ApplyModifier"
875+ {
876+ "ModifierName" "crit"
877+ "Target" "CASTER"
878+ }
879+ }
880+ }
881+ }
882+ }
883+
884+ "crit"
885+ {
886+ "IsHidden" "1"
887+ "Properties"
888+ {
889+ "MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE" "%crit_bonus"
890+ }
891+
892+ "OnAttackLanded"
893+ {
894+ "RemoveModifier"
895+ {
896+ "ModifierName" "crit"
897+ "Target" "CASTER"
898+ }
899+
900+ // Basic blood particle effect
901+ "FireEffect"
902+ {
903+ "EffectName" "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf"
904+ "EffectAttachType" "follow_origin"
905+ "Target" "TARGET"
906+ }
907+ }
908+ }
909+ ```
910+
911+ ### Orb: Slow and Lifesteal with custom projectile
912+
913+ ```
914+ "modifier_orb_of_frost"
915+ {
916+ "Passive" "1"
917+ "IsHidden" "1"
918+ "Attributes" "MODIFIER_ATTRIBUTE_MULTIPLE"
919+ "Properties"
920+ {
921+ "MODIFIER_PROPERTY_BASEATTACK_BONUSDAMAGE" "6"
922+ }
923+
924+ "Orb"
925+ {
926+ "Priority" "DOTA_ORB_PRIORITY_ABILITY"
927+ "ProjectileName" "particles\items2_fx\skadi_projectile.vpcf"
928+ }
929+
930+ "OnOrbImpact"
931+ {
932+ "Lifesteal"
933+ {
934+ "Target" "ATTACKER"
935+ "LifestealPercent" "%bonus_lifesteal"
936+ }
937+
938+ "ApplyModifier"
939+ {
940+ "Target" "TARGET"
941+ "ModifierName" "modifier_orb_of_frost_slow"
942+ "Duration" "%slow_duration"
943+ }
944+ }
945+ }
946+
947+ "modifier_orb_of_frost_slow"
948+ {
949+ "IsDebuff" "1"
950+ "Duration" "3"
951+ "Properties"
952+ {
953+ "MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE" "%move_speed_slow"
954+ "MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "%attack_speed_slow"
955+ }
956+ "EffectName" "particles/generic_gameplay/generic_slowed_cold.vpcf"
957+ "EffectAttachType" "attach_hitloc"
958+ "Target" "TARGET"
959+ }
960+ ```
961+
962+ Note: DataDriven Lifesteal might steal from things you don't want to steal from, it's better done through [ lua] ( https://github.com/MNoya/Warchasers/blob/master/scripts/npc/npc_abilities_custom.txt#L7041 ) .
963+
964+ ### Block
965+
966+ This is a tricky one. Note that there are 2 modifiers again.
967+
968+ The first one has ` OnAttacked ` which randoms a block chance, ` OnSuccess ` it applies the block modifier, ` OnFailure ` it removes it. Inside the block_modifier, ` OnAttacked ` removes itself.
969+
970+ The ` OnCreated ` is just so it's possible to block the 1st hit after equiping the shield.
971+
972+ ```
973+ "shield_modifier"
974+ {
975+ "Passive" "1"
976+ "IsHidden" "1"
977+ "Properties"
978+ {
979+ "MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS" "%magic_resistance"
980+ }
981+ "OnCreated"
982+ {
983+ "Random"
984+ {
985+ "Chance" "%block_chance"
986+ "OnSuccess"
987+ {
988+ "ApplyModifier"
989+ {
990+ "Target" "CASTER"
991+ "ModifierName" "block_modifier"
992+ }
993+ }
994+ }
995+ }
996+ "OnAttacked"
997+ {
998+ "Random"
999+ {
1000+ "Chance" "%block_chance"
1001+ "OnSuccess"
1002+ {
1003+ "ApplyModifier"
1004+ {
1005+ "Target" "CASTER"
1006+ "ModifierName" "block_modifier"
1007+ }
1008+ }
1009+ "OnFailure"
1010+ {
1011+ "RemoveModifier"
1012+ {
1013+ "Target" "CASTER"
1014+ "ModifierName" "block_modifier"
1015+ }
1016+ }
1017+ }
1018+ }
1019+ }
1020+
1021+ "block_modifier"
1022+ {
1023+ "IsBuff" "1"
1024+ "IsHidden" "1"
1025+ "Properties"
1026+ {
1027+ "MODIFIER_PROPERTY_PHYSICAL_CONSTANT_BLOCK" "%damage_blocked"
1028+ }
1029+ "OnAttacked"
1030+ {
1031+ "RemoveModifier"
1032+ {
1033+ "Target" "CASTER"
1034+ "ModifierName" "block_modifier"
1035+ }
1036+ }
1037+ }
1038+ ```
0 commit comments