1
2
3
4
5
6
2
3
4
5
6
on:hit {
	$health=health("self");
	if($health<=25) {
		ai_mode currentid(), "flee", "unit", 1;
	}
}
Scripts
Scripting Questionson:hit {
	$health=health("self");
	if($health<=25) {
		ai_mode currentid(), "flee", "unit", 1;
	}
}
on:hit {
	$health=health("self");
	if($health<=25) {
		[b]$tmp=random(1,4);
		if($tmp > 2) {[/b]
			ai_mode currentid(), "flee", "unit", 1;
		[b]}[/b]
	}
}
on:hit {
	$health=health("self");
	$tmp=random(1,4);
	if($health<=15) {
		if($tmp > 1) {
			ai_mode currentid(), "flee", "unit", 1;
		}
	}
	elseif($health<=20) {
		if($tmp > 2) {
			ai_mode currentid(), "flee", "unit", 1;
		}
	}
	elseif($health<=25) {
		if($tmp > 3) {
			ai_mode currentid(), "flee", "unit", 1;
		}
	}
}
### Grenade
id=127
name=Grenade
group=weapon
icon=gfx\grenade.bmp
model=gfx\clod.b3d
color=0,1000,0
behavior=killthrow
mat=metal
weight=50
info=an explosive grenade
healthchange=0
damage=120
script=start
on:attack1 { 5 second timer script goes here
on:timerend { explosion script goes here
script=end