Name | Type | is_array | initial_value |
AttributeAGI | abilcode | No | |
AttributeINT | abilcode | No | |
AttributeSTR | abilcode | No | |
GameAttackBonus | real | No | |
GetHeroPrimary | unit | No | |
GetHeroUnit | unit | No | |
GetPrimaryAttribute | integer | No | |
GetPrimaryString | string | No | |
GetPrimaryValueExc | integer | No | |
GetPrimaryValueInc | integer | No | |
PrimaryAGI | integer | No | |
PrimaryGroupAGI | group | No | |
PrimaryGroupINT | group | No | |
PrimaryGroupSTR | group | No | |
PrimaryINT | integer | No | |
PrimaryStatEnd | trigger | No | |
PrimarySTR | integer | No |
//==============================================================================================//
// GetPrimaryAttribute v2.1 by El Saif //
// //
// Lets you to check primary attribute of hero. //
// //
// This is a very simple system //
// Actually, you just can use the hidden natives declared below //
// But, considering that natives is only available if you declare it to JASS, I made - //
// - this system to make GUI users even easier to use it, instead they should declared - //
// - it in Custom Script everytime they want to. //
// //
// *NOTE : You can use the same method to check Armor and Movement type of unit. //
// It is very simple, because there is another natives available. //
// But i will not do it here (yet). //
// //
// How to IMPORT //
// //
// 1. Delete all of the previous version of system/snippet triggers from your map, - //
// then copy 'PrimaryStat Config' and 'PrimaryStat' triggers to your map. //
// //
// 2. OR IF you have the v2.0++ of this snippet, just replace the JASS scripts with - //
// the new one. //
// //
// How to USE //
// //
// 1. Use the trigger like this : //
// //
// - GetHeroUnit = (your unit) //
// - Run - PrimaryStat <gen> (Checking conditions) //
// - //YOUR ACTIONS //
// - Run - PrimaryStatEnd //
// //
// 2. To check its string/name of the primary attribute, use : "GetPrimaryString" //
// //
// 3. List of attribute variables : //
// //
// * PrimarySTR : Strength //
// * PrimaryINT : Intelligence //
// * PrimaryAGI : Agility //
// //
// When you want to use a condition, do it like this, example : //
// //
// - GetPrimaryAttribute equal to PrimarySTR //
// //
// 4. To get the values, use "GetPrimaryValueInc" to get it with bonuses, - //
// "GetPrimaryValueExc" to get it without bonuses. //
// //
// By the way, thanks to 'TriggerHappy' ! //
// //
//==============================================================================================//
// HIDDEN NATIVES //
native BlzGetHeroPrimaryStat takes unit whichHero returns integer
native BlzGetHeroStat takes unit whichHero, integer whichStat, boolean includeBonuses returns integer
// ============== //
function PrimaryStatCondition takes nothing returns boolean
return IsUnitType(udg_GetHeroUnit, UNIT_TYPE_HERO)
endfunction
function GetPrimaryValue takes nothing returns nothing
local string array stats
set stats[1] = "Strength"
set stats[2] = "Intelligence"
set stats[3] = "Agility"
set udg_GetHeroPrimary = udg_GetHeroUnit
set udg_GetPrimaryString = stats[BlzGetHeroPrimaryStat(udg_GetHeroPrimary)]
set udg_GetPrimaryValueInc = BlzGetHeroStat(udg_GetHeroPrimary, BlzGetHeroPrimaryStat(udg_GetHeroPrimary), true)
set udg_GetPrimaryValueExc = BlzGetHeroStat(udg_GetHeroPrimary, BlzGetHeroPrimaryStat(udg_GetHeroPrimary), false)
set udg_GetPrimaryAttribute = BlzGetHeroPrimaryStat(udg_GetHeroPrimary)
endfunction
function ResetActions takes nothing returns nothing
set udg_GetHeroPrimary = null
set udg_GetPrimaryString = ""
set udg_GetPrimaryValueInc = 0
set udg_GetPrimaryValueExc = 0
endfunction
function CreatePrimaryStatEnd takes nothing returns nothing
set udg_PrimaryStatEnd = CreateTrigger()
call TriggerAddAction( udg_PrimaryStatEnd, function ResetActions )
endfunction
//===========================================================================
function InitTrig_PrimaryStat takes nothing returns nothing
set gg_trg_PrimaryStat = CreateTrigger()
call TriggerAddCondition ( gg_trg_PrimaryStat, Condition( function PrimaryStatCondition ) )
call TriggerAddAction( gg_trg_PrimaryStat, function GetPrimaryValue )
call CreatePrimaryStatEnd()
endfunction