HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making units flee

02-08-2004, 09:40 AM#1
Toth
Making units flee
I want to a ability to trigger units in the region around the triggering unit to run away. Now that is vague... at best I want them to run away from the region at random, but at worst I want them to just stop fighting and move somewhat.

Probably the best I can get is giving them the peasent condition where they run if they are attacked, but I can't seem to figure out how. I can make the desired ethereal which makes them stop fighting but it doesn't really make them run. Any other ideas?
02-08-2004, 11:41 AM#2
johnfn
well, heres my idea. i just woke up, so it probably wont be perfect or any..zzzzzzzz..err...thing, but here goes, in pseudo-code:

when a unit is attacked

unit type of unit equal to the type of unit to flee

region - move var_region_unit to position of attacked unit
region - move var_region_flee to position of var_reigion_unit offset by random number between -255 and 255, random random number between -255 and 255
Order attacked unit - move to var_reigion_flee

so what it does is it picks a random spot up to 255 units away, then runs there. The only problem with this is it might pick a spot to close, then be attacked again.


just a random idea from me :ggani:
02-08-2004, 11:45 AM#3
Spinally
Hmmm, I'm not really that sure if that will work because move commands and the like are easily interrupted, there must be a better way. If only I knew JASS :).
02-08-2004, 12:12 PM#4
Shark
for peasant thingy : Unit Editor - Combat Can Flee
for the run-away thingy : i think its kinda .... i dunno, it will look crappy, and i mean the whole "run away" idea (not the triggers)
02-08-2004, 01:44 PM#5
Maegus
john's triggers would work, but i think you could do them in an easier way... you don't need to have one region variable and then move it around. Also, you can change the unit to Neutral Passive, Neutral Extra, or Neutral Victim to keep the player from ordering it around while it's fleeing, just make sure you don't change color.

this works better i think:


EVENT
A unit is Attacked

CONDITION
<Whatever condition the unit is supposed to have to flee>

ACTIONS:
Set Custom Value of (Attacked Unit) to (Player Number of (Owner of (Attacked Unit))

Change owner of Attacked Unit to (Neutral Passive) and Retain Color

Order (Attacked Unit) to move to (Random Point in (Region Centered at Position of (Attacked Unit) with size 999, 999))

Wait (<Seconds you want Flee to last>) game-time seconds.

Change owner of Attacked Unit to (Player[(Custom Value of (Attacked Unit)]) and Retain Color



See? Easy! =D
02-11-2004, 10:22 PM#6
cangrejo
Code:
e: unit is attacked 
c: it's the unit of type or whatever unit u want
a: issue order targeting a point (point with polar offset) location of attacked unit offset by (angle between attacking unit and attacked unit) distance 500 (or how far u want it to run).

could it be easier?