I'm new to this can anyone tell me whats wrong with my script my monster just stands thier and doesn't attack at all and could you also help me get help to do a melee attack.
Spawn[()
{
Console(true);
AttributeOrder("health",20,"Die");
FindTargetOrder(200,"Alert","health");
SetFOV(360);
HostilePlayer(true);
HostileSame(false);
HoostileDifferent(false);
SetGroup("Enemy");
NewOrder("LostTarget");
}]
Alert[()
{
AnimateStop("alert",0,"");
LowLevel("Attack");
}]
LostTarget[()
{
PlayAnimation("idle",false,"");
FindTargetOrder(400,"Alert","health");
}]
Attack[()
{
self.ThinkTime=0.05;
self.yaw_speed=160
UpdateTarget();
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw
ChangeYaw();
if(self.enemy_range>128)
{
SetHoldAtEnd(true);
Animate("attack");
self.think="Walk";
return 0;
}
else
{
TC=self.time;
Animate("attack");
self.think="Stand";
return 0;
}
}
}]
Walk[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Die");
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(sled.ideal_yaw,50)=false)
{
if(random(1,10)>5)
{
ForceLeft(10);
}
else
{
ForceRight(10);
}
}
}
else
{
SetHoldAtEnd(false);
FireProjectile("sword","HandL",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Stand[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Die");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw;
ChangYaw();
}
else
{
HighLevel("LostTarget");
return 0;
}
if(self.time>TC+1)
{
FireProjectile("sword","HandL",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Die[()
{
RestartOrder();
RF scripting problem
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Re: RF scripting problem
hi and welcome to the forums!
one thing wrong is that the die order is not closed
you have
you should have
also since you have console(true); look in the left hand corner of the screen and tell us what it says if the problem persists. if there is no text, then the script is not running and there is a different error. and make sure the entity in the editor is properly set up.
one thing wrong is that the die order is not closed
you have
Code: Select all
Die[()
{
RestartOrder();
Code: Select all
Die[()
{
RestartOrder();
} ]
Herp derp.
Re: RF scripting problem
There should also be a script opening bracket
at the beginning of the script like so:-
{
Spawn[()
{
etc.....
and a script closing bracket at the end + 2 linefeeds (blank lines) after it:-
Die[()
{
RestartOrder();
} ]
}//end script
The two linefeeds go here.
I don't know why you need the linefeeds at the end of the script and most times it will work without but sometimes it won't.
The opening and closing brackets are vital, the script won't run at all without them.
at the beginning of the script like so:-
{
Spawn[()
{
etc.....
and a script closing bracket at the end + 2 linefeeds (blank lines) after it:-
Die[()
{
RestartOrder();
} ]
}//end script
The two linefeeds go here.
I don't know why you need the linefeeds at the end of the script and most times it will work without but sometimes it won't.
The opening and closing brackets are vital, the script won't run at all without them.
Re: RF scripting problem
yah i tried those suggestions and all the monster does is play his idle animation he still just stands thier doing nothing could you help me figure out what the problem is