• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

request, monster lure spell

Status
Not open for further replies.
Level 4
Joined
Oct 9, 2013
Messages
84
Hello guys, Im making a hunter character in a map and I need a monster lure, I got a ward, but how do I make that ward to attract nearby monsters to attack it to drive away their attention from the hunter?
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,241
I created this really quick. You need JNGP for it to work. It works nicely, however there are two flaws as of now.

1. it orders all units to attack the ward, no mater the owner.
2. the order can be changed. So this wont work properly is the unit is controlled by a player.

JASS:
//! zinc
	library WardTaunt
	{
		private hashtable hash = InitHashtable();
		
		function death()
		{
			unit u = GetEnumUnit();
			integer h = GetHandleId(u);
			FlushChildHashtable(hash, h);
			DestroyTrigger(LoadTriggerHandle(hash, h, 1));
		}
		
		private function actions()
		{
			unit u = GetTriggerUnit();
			unit ward = LoadUnitHandle(hash, GetHandleId(GetTriggeringTrigger()), 1);
			IssueTargetOrder(u, "attack", ward);
		}
		
		public function addWardTaunt(unit u)
		{
			trigger t = CreateTrigger();
			TriggerRegisterUnitInRangeSimple(t, 500, u);
			TriggerAddAction(t, function actions);
			SaveUnitHandle(hash, GetHandleId(t), 1, u);
			SaveTriggerHandle(hash, GetHandleId(u), 1, t);
		}
		
		function onInit()
		{
			trigger t = CreateTrigger();
			TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH);
			TriggerAddAction(t, function death);
		}
	}
//! endzinc
  • demo
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Footman 0001 <gen>
      • Custom script: call addWardTaunt(udg_u)
 

Attachments

  • WardTaunt.w3x
    10.8 KB · Views: 59
Status
Not open for further replies.
Top