• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Pet commands that do not interrupt actions (proof included!) +Rest idea

Status
Not open for further replies.
Level 7
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.

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

  • CommandConcept.w3x
    8.3 KB · Views: 75
  • PetCommand.w3x
    9.4 KB · Views: 112
Last edited:
Level 10
Joined
Nov 20, 2005
Messages
800
Oh how I could have used pet management and healing simultaneously in the past haha

And I don't mind the rest button, but zwiebel why do you taunt us with zero mana on revive when we die!? Haha
 
Level 7
Joined
Aug 23, 2014
Messages
208
Oh how I could have used pet management and healing simultaneously in the past haha
Because healing spells are instant or channeling without CD, so you can command your pets without wasting cooldowns?

This solution is more useful for Mystic classes, because she have abilities with long cooldowns and long casting times: Twisting Metal, Blade Storm, Petrify, Enslave, (Psionic Blade?).
Some old abilities will benefit from it too: Recovery, Crucify, summoning spells.
Even white attacks will benefit from it, because hero will continue attacking current target, without chance of switching to another.

And I don't mind the rest button, but zwiebel why do you taunt us with zero mana on revive when we die!? Haha
Zero mana after revive is a good thing - forces player to drink mana pot or use manareg ability in the battle.
Zero mana after reincarnation in the town will be solved with suggested rest system, because MP will regenerate during 20 seconds of roaming there: selling stuff, buying pots, etc.
 
I know about the reveal ability... however, I do think that the ability being ground-only cast is no option. It just wouldn't feel intuitive to me.

I actually had a different idea in mind... which is abusing the rally point system of WC3.
I don't have a practical implementation for this yet and can't tell if that would work, but rally points would offer a huge number of advantages over any "real" abilities:
-> I can actually "permanently" mark the target of pets, so for example, the retreat command would cause pets to ignore enemies permanently until you put it back on an enemy... which elegantly removes the need for several other mechanics in the game
-> It can be used on the ground, on units and on the player
-> It doesn't cancel orders
-> It comes with a neat editable marker model

Feel free to run some tests on this idea Alex! Especially on how to get the rally point ability into a spellbook. There might be a way to do that.


About auto-resting:
I'm ... actually ... uhh ...
I want to be honest with you: I wanted to hate this idea. I really did. But after thinking about it, I found absolutely no reason at all why I should be against it.
In fact... it's actually quite a genius idea to simply allow players to recover mana and life as soon as they leave battle unconditionally.
It removes an ability. It removes the necessity to close the spellbook. And it isn't really fun to be pinned to the ground, waiting 15 seconds to recover anyway.

I'll get rid of rest. I agree that it serves no real purpose (other than being a pointless annoyance).
As soon as players leave combat, they will simply recover mana and health at the speed of the current resting until fully healed/recovered.

I wonder why I haven't thought of that yet. Like, seriously, all the debate about putting abilities on the main command card and I always tried to somehow fit rest in when it was never actually a good mechanic to have that as an active ability anyway. :/
 
Level 7
Joined
Aug 23, 2014
Messages
208
Feel free to run some tests on this idea Alex! Especially on how to get the rally point ability into a spellbook. There might be a way to do that.
I guess it's a dead end here:
- Rally is something between standart command card buttons and abilities, so spellbooks do not display it.
- Added rally converts all 'smart' orders into 'setrally', so you can not control your hero.
- Added, but hidden, rally doesn't work: rally point mark doesn't appear, even if you add it with triggers.
- 'setrally' actually interrupts other orders.

Implemention of this feature heavily depends on internal game functions, and I guess there is no abilities that can be used on a target without cancelling orders (human reveal looks more like bug that turns into a feature).

I know about the reveal ability... however, I do think that the ability being ground-only cast is no option. It just wouldn't feel intuitive to me.
Well, just nice to know that there is alternative, because earlier it looked as technically impossible thing. :)

I wonder why I haven't thought of that yet. Like, seriously, all the debate about putting abilities on the main command card and I always tried to somehow fit rest in when it was never actually a good mechanic to have that as an active ability anyway. :/
I guess it's because old MMORPG-s placed such stamp in our experience. Lineage, Vanilla/BC WoW, Perfect World, Ultime Online, etc... - everywhere you need to sit down/eat and drink/meditate after some time.
And nice old RPG-s rely on resting: Neverwinter Nights, Baldur's Gate, TES: Morrowind :). But in singleplayer resting doesn't take long time, just short waiting and hero is ready for action.
 
Status
Not open for further replies.
Top