Pawn
Pawn
Hi, I'm new to RF and I created a level with a basic pawn. It just stands there and I can't kill it. Can anyone help me with scripting? The only script I have is the very basic one from the manual. I don't really understand the advanced part. Call me stupid if you want.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawn
I see that you have read the manual,that's good.You are using the robot right?Well your Pawn entity should look like this:
PawnType robot <---I assume you've already done this
ScriptName robot.s <---this is the script for the robot
SpawnOrder Spawn <---well,this is very important,because this line defines what command from the script should the pawn execute.If you open the robot.s script you'll see that in there the first oreder is called Spawn.
If theese three lines are correct your pawn should work
PawnType robot <---I assume you've already done this
ScriptName robot.s <---this is the script for the robot
SpawnOrder Spawn <---well,this is very important,because this line defines what command from the script should the pawn execute.If you open the robot.s script you'll see that in there the first oreder is called Spawn.
If theese three lines are correct your pawn should work
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawn
well,tell me more about the problem,what have you done so far,did you used the right script or I don't know,give me a screenshot of your pawn entity,I want to see where could the problem be
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawn
I wrote Spawn not spawn,but have forgoten to tell about the big 'S'SpawnOrder Spawn <---well,this is very important,because this line defines what command from the script should the pawn execute.If you open the robot.s script you'll see that in there the first oreder is called Spawn
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Pawn
Just using a different script won't teach jon980 how to use the scripting feature of RF.
as the first method in the SpawnOrder. This will show you if the script gets executed without errors in-game.
If you want the pawn to get killed by the player you have to:
a) give the pawn some health
b) tell the pawn what to do when the health value reaches zero
This can be done by using the script method AttributeOrder(string AttributeName, int Amount, string Order);
This will give the pawn an attribute called AttributeName and will initialize it to Amount.
Order is the script order that gets executed when the attribute value reaches zero.
The default player weapons are affecting the attribute enemy_health. So you need to give your pawn this attribute as its health attribute.
We need to add a new order called Death to the script now, eg
This will turn off collision detection for the pawn,
play a dying animation, wait 15 seconds,
fade out the actor within 10 seconds,
remove the pawn's actor from the level and stop the execution of the script.
The complete script would be
Note that I moved the PlayAnimation and RestartOrder methods to a separate order as we want to call the Console and AttributeOrder methods only once.
That's fine, the basic script in the manual isn't supposed to do more than play the idle animation of the pawn's actor.Hi, I'm new to RF and I created a level with a basic pawn. It just stands there and I can't kill it.
First, if you start to write a new script it's always good to addCan anyone help me with scripting? The only script I have is the very basic one from the manual. I don't really understand the advanced part. Call me stupid if you want.
Code: Select all
Console(true);
If you want the pawn to get killed by the player you have to:
a) give the pawn some health
b) tell the pawn what to do when the health value reaches zero
This can be done by using the script method AttributeOrder(string AttributeName, int Amount, string Order);
This will give the pawn an attribute called AttributeName and will initialize it to Amount.
Order is the script order that gets executed when the attribute value reaches zero.
The default player weapons are affecting the attribute enemy_health. So you need to give your pawn this attribute as its health attribute.
Code: Select all
AttributeOrder("enemy_health", 100, "Death");
Code: Select all
Death[()
{
SetNoCollision(); // remove bounding box so there are no collisions with corpse
AnimateStop("Die", 15, "");
FadeOut(10, 0); // fade out corpse
Remove(true); // remove actor
}]
play a dying animation, wait 15 seconds,
fade out the actor within 10 seconds,
remove the pawn's actor from the level and stop the execution of the script.
The complete script would be
Code: Select all
{
Spawn[()
{
Console(true);
AttributeOrder("enemy_health", 100, "Death");
NewOrder("Idle");
}]
Idle[()
{
PlayAnimation("Idle", true, "");
RestartOrder();
}]
Death[()
{
SetNoCollision(); // remove bounding box so there are no collisions with corpse
AnimateStop("Die", 15, "");
FadeOut(10, 0); // fade out corpse
Remove(true); // remove actor
}
}
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Pawn
More info about scripting:
E-Book: Making 3D Games with Reality Factory (on the downloads page)
The RF Manual: Component Reference -> Scripting
Sample scripts in your RF installation
Simkin documentation: http://www.simkin.co.uk/Docs/cpp/index.html
E-Book: Making 3D Games with Reality Factory (on the downloads page)
The RF Manual: Component Reference -> Scripting
Sample scripts in your RF installation
Simkin documentation: http://www.simkin.co.uk/Docs/cpp/index.html
Re: Pawn
Thanks everyone, it really helped. Only one problem, I was editing things like the heath, shoot range, and sight, but than they stopped attacking me in the game and they never even noticed me. Can someone help? Here's the robot.s part of the script that I changed, the rest is the same as it came with when I downloaded RF:
{
IDLE [idle] // idle animation
WALK [walk] // walk animation
DIE [die] // die animation
SHOOT [shoot] // shoot animation
MISC1 [slump] // misc1 animation
GROUP [robot]
HOSTILEPLAYER [true] // hostile to player
HOSTILESAME [false] // hostile to same Pawn group
HEALTHATTRIBUTE [enemy_health] // name of pawns health attribute
HEALTH [300] // initial pawn health
DAMAGEATTRIBUTE [health] // attribute damaged by attack
ALERTTRIGGER [AlertG] // name of alert trigger
DIEHOLD [15] // time corpse still appears
DIEFADE [10] // fadeout time of corpse
FOV [1000] // field of view
SIGHTDIST [1400] // max distance pawn can see at idle
ALERTSIGHTDIST [1800] // max distance pawn can see when alert
YAWSPEED [110]
WALKSPEED [70]
SHOOTRANGE [700] // max distance to start missile attack
PROJECTILE [10mm_shell] // projectile name
FIREBONE [Joint15] // projectile launch bone
OFFSETX [0] // launch offsets
OFFSETY [0]
OFFSETZ [25]
ATTACKDELAY [0.5] // time between shots
FIREDELAY [0.1] // delay after animation starts before projectile launch
SKILL [7] // skill level 1 to 10
LOSTTIME [15] // time to search for enemy before giving up
POINTRADIUS [20] // radius from point when considered there
RUNFUNC [run_start] // monster run to attack function
SHOOTFUNC [shoot_start] // monster missile function
LOSTFUNC [lost_target_start] // monster lost target function
{
IDLE [idle] // idle animation
WALK [walk] // walk animation
DIE [die] // die animation
SHOOT [shoot] // shoot animation
MISC1 [slump] // misc1 animation
GROUP [robot]
HOSTILEPLAYER [true] // hostile to player
HOSTILESAME [false] // hostile to same Pawn group
HEALTHATTRIBUTE [enemy_health] // name of pawns health attribute
HEALTH [300] // initial pawn health
DAMAGEATTRIBUTE [health] // attribute damaged by attack
ALERTTRIGGER [AlertG] // name of alert trigger
DIEHOLD [15] // time corpse still appears
DIEFADE [10] // fadeout time of corpse
FOV [1000] // field of view
SIGHTDIST [1400] // max distance pawn can see at idle
ALERTSIGHTDIST [1800] // max distance pawn can see when alert
YAWSPEED [110]
WALKSPEED [70]
SHOOTRANGE [700] // max distance to start missile attack
PROJECTILE [10mm_shell] // projectile name
FIREBONE [Joint15] // projectile launch bone
OFFSETX [0] // launch offsets
OFFSETY [0]
OFFSETZ [25]
ATTACKDELAY [0.5] // time between shots
FIREDELAY [0.1] // delay after animation starts before projectile launch
SKILL [7] // skill level 1 to 10
LOSTTIME [15] // time to search for enemy before giving up
POINTRADIUS [20] // radius from point when considered there
RUNFUNC [run_start] // monster run to attack function
SHOOTFUNC [shoot_start] // monster missile function
LOSTFUNC [lost_target_start] // monster lost target function
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawn
no idea...everything looks fine...
Re: Pawn
FOV:
Max Degrees would be 360. Maybe that 1000 is throwing things off?SetFOV(float Angle );
Set the field of view of the Pawn to be Angle degrees. This is the total number of
degrees from left to right that the Pawn can see. The center of the FOV is the
direction the Pawn is facing.
Steve Dilworth - Resisting change since 1965!
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawn
Oh,haven't see that,yes if you want your pawn to see everything arround it,set the FOV to 360