HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Mobs that only attack if attacked

01-12-2005, 09:22 AM#1
Venturai
Ok, it's really very simple.

I'm hoping to be able to get in my next RPG map a creature that will only attack the player if attacked. And if possible, I'd like to be able to attack them with the attack UI disabled. That is, right click or hostile spell cast only.

For a start, no amount of me setting alliances and/or aspects of alliances on map init has done me any good. I'd have thought I could just make neutral passive an enemy of the player but turn non-aggression on. In theory thats what I'm after, right? Unfortunately he ends up either hostile or won't attack if attacked.

Obviously a simple trigger to tell neutral passive units to attack heroes that are attacking them wouldn't work too well because in the event that multiple heroes are beating down on them, they wouldn't really know who to attack.

At this point I started thinking about setting unit custom numbers to 1 if they've been attacked, so you'd know when it's already been engaged, but in practice this sort of thing would likely be more trouble than its worth when trying to factor in things like taunt and the switching of targets.

Unfortunately I may have to settle for switching the alliance to enemy until the unit dies or the hero leaves the area, but that's the sort of hefty compromise that makes me want to just trash the concept and stick with neutral hostiles.

And yes, if I can get this working, I'd like to be able to attack those creatures by just being able to right click them. So far I've had less than stellar results trying to get this happening with mobs that are not hostile.

This trigger, for instance:

Right clicking on passive
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Owner of (Target unit of issued order)) Equal to Neutral Passive
Actions
Unit - Order (Ordered unit) to Hold Position
Unit - Order (Ordered unit) to Attack (Target unit of issued order)

...crashes Warcraft 3 to desktop, and I'll be damned if I can figure out why. Strangely enough, when I first coded this trigger I had it back to front and was telling the target unit to attack the ordered unit, and that actually worked fine. Sometimes the WE can be a right pain in the arse ;)

Anyway, any help anyone can give me about this would be appreciated. There must be those out there who are far better at this than I am...
01-12-2005, 10:15 AM#2
Ant
Why not just change the ownership of the unit to neutral hostile when it's attacked?

Then you would have to force attack which makes it easier to not accidentally attack too.
01-12-2005, 10:50 AM#3
Venturai
Quote:
Originally Posted by Ant
Why not just change the ownership of the unit to neutral hostile when it's attacked?

Then you would have to force attack which makes it easier to not accidentally attack too.


That ain't a bad idea actually. Honestly never occured to me. I'm gonna have to try this out and see how it goes.

The reason I want to disable the attack UI is to rule out any PvP'ing going on in my RPG. It's gotta be purely PvE with me :)
01-12-2005, 05:19 PM#4
Milkman
The first trigger you posted seems very odd to me, and i can't se that it would do anything but first make the hero hold position and the attack his previous target.
01-12-2005, 09:44 PM#5
Venturai
Quote:
Originally Posted by Milkman
The first trigger you posted seems very odd to me, and i can't se that it would do anything but first make the hero hold position and the attack his previous target.

With or without the hold position action, Warcraft 3 crashes to desktop. I added it in there hoping it might fix the problem after reading a similar thread here about this kinda thing, but alas.

In any case, Ant's suggestion to shift the unit's owner to neutral hostile has proved very effective. Still don't know why I didn't think of it, but I'm happy enough with how it works :)