
Kinda noobish question I think... I even searched Nirhis scripts, and all about this in forum but I couldnt reach it...

Code: Select all
{
WALK [walk_s]
WATCH [watch_s]
WRITE [write_s]
IDLE [idle_s]
HEALTHATTRIBUTE [enemy_health]
HEALTH [30]
TC [0]
WEAPON [pistol]
Spawn[()
{
Console(true);
SetFOV(240);
HostilePlayer(true);
HostileSame(false);
HostileDifferent(false);
SetGroup("Enemy");
AttributeOrder(HEALTHATTRIBUTE, HEALTH, "GoShootBlood");
SetWeapon(WEAPON);
NewOrder("LostTarget");
}]
LostTarget[()
{
FindTargetOrder(1500, "EnemySpotted", "health");
AddCollisionOrder("EnemySpotted");
PlayAnimation(WATCH, true, "");
RestartOrder();
}]
Alert[()
{
AnimateStop(WATCH, 0, "");
LowLevel("Attack");
}]
EnemySpotted[()
{
RotateToPlayer(IDLE, 120, false, "");
LowLevel("Attack");
}]
Attack[()
{
self.ThinkTime = 0;
self.yaw_speed = 100;
UpdateTarget();
UpdateEnemyVis();
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw;
ChangeYaw();
if(self.enemy_range>500)
{
SetHoldAtEnd(true);
Animate("walk_s");
self.think ="Walk";
return 0;
}
else
{
TC=self.time;
Animate("watch_s");
self.think ="Stand";
return 0;
}
}
}]
Walk[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("GoShootBlood");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw;
ChangeYaw();
}
else
{
SetHoldAtEnd(false);
HighLevel("LostTarget");
return 0;
}
if(self.animate_at_end=false)
{
if(walkmove(self.ideal_yaw,90)=false)
{
if(random(1,10)>5)
{
ForceLeft(30);
}
else
{
ForceRight(30);
}
}
}
else
{
SetHoldAtEnd(false);
FireProjectile("pistol_shell","joint10",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Stand[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Death");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw;
ChangeYaw();
}
else
{
HighLevel("LostTarget");
return 0;
}
if(self.time>TC+1)
{
FireProjectile("pistol_shell","joint10",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
GoShootBlood[()
{
LowLevel("ShootBlood");
}]
ShootBlood[()
{
SetTargetPoint(0, -100, 0);
FireProjectile("blood1", "joint10", 0, 0, 0, "");
HighLevel("Death");
}]
Death[()
{
DelCollisionOrder();
switch(random(0,4))
{
case 1
{
AnimateStop("die_s_1", 0, "");
}
case 2
{
AnimateStop("die_s_2", 0, "");
}
case 3
{
AnimateStop("die_s_3", 0, "");
}
case 4
{
AnimateStop("die_s_4", 0, "");
}
}
NewOrder("Now");
}]
Now[()
{
AddCollisionOrder("GetWeapon");
}]
GetWeapon[()
{
ModifyAttribute("scattergun", 1, "player");
RemoveWeapon();
NewOrder("Cleanhim");
}]
Cleanhim[()
{
SetNoCollision();
RestartOrder();
}]
}
Sorry, but they're still acting the same way :S,darksmaster923 wrote:For the last order in your death, don't use restartorder()
Thanks, but the problem is still there...You can try removing the Now order, and using self.player_range variable instead.
Code: Select all
Death[()
{
DelCollisionOrder();
switch(random(0,4))
{
case 1
{
AnimateStop("die_s_1", 0, "");
}
case 2
{
AnimateStop("die_s_2", 0, "");
}
case 3
{
AnimateStop("die_s_3", 0, "");
}
case 4
{
AnimateStop("die_s_4", 0, "");
}
}
LowLevel("items");
}]
items[ ()
{
if(GetDistanceTo("Player")<50)
{
ModifyAttribute("scattergun", 1, "player");
HighLevel("delete");
}
} ]
delete[ ()
{
RemoveWeapon();
} ]
Code: Select all
{
Spawn[()
{
Console(true);
AttributeOrder("enemy_health", 30, "Die");
AddCollisionOrder("Foundtarget");
SetFOV(220);
HostileSame(false);
HostileDifferent(false);
HostilePlayer(true);
NewOrder("Idle");
}]
Idle[()
{
FindTargetOrder(600, "Foundtarget", "health");
PlayAnimation("idle_s", true, "");
RestartOrder();
}]
Foundtarget[()
{
SetWeapon("pistol");
RotateToPlayer("stand_alert", 300, false, "");
Delay("stand_shoot_s", 0.7, "");
LowLevel("Come");
}]
Come[()
{
if(self.enemy_vis = true)
{
if(self.player_range < 600)
{
UpdateEnemyVis();
UpdateTarget();
FireProjectile("pistol_shell", "joint20", 0, 0, 0, "health");
HighLevel("Foundtarget");
}
else
{
self.ideal_yaw = self.enemy_yaw;
if(self.animate_at_end)
{
Animate("walk_s");
}
walkmove(ideal_yaw, 150);
if(self.player_range > 1600)
{
HighLevel("Idle");
}
}
}
else
{
HighLevel("Idle");
}
if(self.health = 0)
{
HighLevel("Die");
return 0;
}
}]
Die[()
{
SetNoCollision();
FindTargetOrder(0, "Idle", "");
LowLevel("Blood");
}]
Blood[()
{
SetTargetPoint(0, -90, 0);
switch(random(1,4))
{
case 1
{
FireProjectile("blood1", "joint10", 0, 0, 0, "");
}
case 2
{
FireProjectile("blood2", "joint10", 0, 0, 0, "");
}
case 3
{
FireProjectile("blood3", "joint10", 0, 0, 0, "");
}
case 4
{
FireProjectile("blood4", "joint10", 0, 0, 0, "");
}
}
switch(random(1,4))
{
case 1
{
PlaySound("scientist/die1.wav");
}
case 2
{
PlaySound("scientist/die2.wav");
}
case 3
{
PlaySound("scientist/die3.wav");
}
case 4
{
PlaySound("scientist/die4.wav");
}
}
HighLevel("Animation");
}]
Animation[()
{
switch(random(1,4))
{
case 1
{
AnimateStop("die_s_1", 0, "");
}
case 2
{
AnimateStop("die_s_2", 0, "");
}
case 3
{
AnimateStop("die_s_3", 0, "");
}
case 4
{
AnimateStop("die_s_4", 0, "");
}
}
RemoveWeapon();
SetWeapon("pistol");
LowLevel("Weapon");
}]
Weapon[()
{
if(self.player_range < 60)
{
ModifyAttribute("c8", 1, "player");
PlaySound("takethegun.wav");
HighLevel("Finish");
}
}]
Finish[()
{
RemoveWeapon(true);
}]
}
No problemdarksmaster923 wrote:lol thanks