- Joined
- Aug 23, 2014
- Messages
- 208
Just found that ability AHta (Reveal) doesn't cancel unit's orders, so it can be used as a base for pet commands: View attachment PetCommand2.w3x
Pros:
- You can cast/run/attack and command your pets at the same time!
- +1 slot for abilities, if you will make smart command button (based on target: enemy -> attack, friend -> guard, ground -> move).
Cons:
- Can be used only on the ground, so for flying enemies you need to click on the shadow.
And small Rest idea: if new players do not get how to use it, maybe just remove this button?
Restore 5% MP per second out of combat instead.
And if player doesn't move/cast/damaged for 3 seconds and doesn't have full HP: apply Rest buff (with Z z z animation) and restore 15% HP per second until full HP.
Buff and animation removed with full HP and doesn't appear again. Tooltip about resting can be added to the Stop button. (and even Stop icon can be changed to Rest icon)
Pros:
- +1 free button slot.
- Prevents Rest exploiting to avoid DoT damage.
- More active gameplay (especially if you have a healer).
- Intuitive behavior.
Cons:
- Ppl can say this is too casual.
Update: better Pet Command example uploaded, old map now in attachments.
Update2: logic changed to ignore dead units, command now based on priority: enemies > friends > ground. (if friend standing in hostile net unit, issued order will be "attack the net", not "follow the friend")
Pros:
- You can cast/run/attack and command your pets at the same time!
- +1 slot for abilities, if you will make smart command button (based on target: enemy -> attack, friend -> guard, ground -> move).
Cons:
- Can be used only on the ground, so for flying enemies you need to click on the shadow.
JASS:
function FindDistance takes unit t, location l returns real
local real dx = GetUnitX(t) - GetLocationX(l)
local real dy = GetUnitY(t) - GetLocationY(l)
return dx * dx + dy * dy
endfunction
function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Actions takes nothing returns nothing
local location spellLoc = GetSpellTargetLoc()
local player unitOwner = GetTriggerPlayer()
local group petsGroup = GetUnitsOfPlayerAll(Player(11))
local group abilGroup = GetUnitsInRangeOfLocAll(100.00, spellLoc)
local unit abilUnit = null
local unit closestEnemy = null
local unit closestFriend = null
local real minEnemyDistance = 9999.00
local real minFriendDistance = 9999.00
local real currentDistance
local effect abilEffect
loop
set abilUnit = FirstOfGroup(abilGroup)
exitwhen abilUnit == null
if GetUnitState(abilUnit, UNIT_STATE_LIFE) > 0 then
set currentDistance = FindDistance(abilUnit, spellLoc)
if IsUnitEnemy(abilUnit, unitOwner) then
if currentDistance < minEnemyDistance then
set closestEnemy = abilUnit
set minEnemyDistance = currentDistance
endif
else
if currentDistance < minFriendDistance then
set closestFriend = abilUnit
set minFriendDistance = currentDistance
endif
endif
endif
call GroupRemoveUnit(abilGroup, abilUnit)
endloop
if closestEnemy == null then
if closestFriend == null then
call GroupPointOrderLoc(petsGroup, "move", spellLoc)
set abilEffect = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl", spellLoc)
else
call GroupTargetOrder(petsGroup, "patrol", closestFriend)
set abilEffect = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl", closestFriend, "overhead")
endif
else
call GroupTargetOrder(petsGroup, "attack", closestEnemy)
set abilEffect = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl", closestEnemy, "overhead")
endif
call RemoveLocation(spellLoc)
set unitOwner = null
call DestroyGroup(petsGroup)
call DestroyGroup(abilGroup)
set abilUnit = null
set closestEnemy = null
set closestFriend = null
call TriggerSleepAction(1.00)
call DestroyEffect(abilEffect)
endfunction
//===========================================================================
function InitTrig_PetCommand takes nothing returns nothing
local trigger gg_trg_PetCommand = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_PetCommand, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(gg_trg_PetCommand, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_PetCommand, function Actions )
endfunction
And small Rest idea: if new players do not get how to use it, maybe just remove this button?
Restore 5% MP per second out of combat instead.
And if player doesn't move/cast/damaged for 3 seconds and doesn't have full HP: apply Rest buff (with Z z z animation) and restore 15% HP per second until full HP.
Buff and animation removed with full HP and doesn't appear again. Tooltip about resting can be added to the Stop button. (and even Stop icon can be changed to Rest icon)
Pros:
- +1 free button slot.
- Prevents Rest exploiting to avoid DoT damage.
- More active gameplay (especially if you have a healer).
- Intuitive behavior.
Cons:
- Ppl can say this is too casual.
Update: better Pet Command example uploaded, old map now in attachments.
Update2: logic changed to ignore dead units, command now based on priority: enemies > friends > ground. (if friend standing in hostile net unit, issued order will be "attack the net", not "follow the friend")
Attachments
Last edited: