I have the following script for my soldier model. However when compile the level, he cannot shoot or move or die. He just stand there and doing nothing. Someone help me, is there a problem in my script?
{
IDLE [idle] // idle animation
WALK [walk] // walk animation
DIE [die] // die animation
SHOOT [shoot] // shoot animation
MISC1 [slump] // misc1 animation
GROUP [soldier]
HOSTILEPLAYER [true] // hostile to player
HOSTILESAME [false] // hostile to same Pawn group
HEALTHATTRIBUTE [enemy_health] // name of pawns health attribute
HEALTH [100] // 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 [160] // field of view
SIGHTDIST [700] // max distance pawn can see at idle
ALERTSIGHTDIST [900] // max distance pawn can see when alert
YAWSPEED [90]
WALKSPEED [50]
SHOOTRANGE [300] // 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 [5] // 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
AS_NONE [0]
AS_SHOOT [2]
AS_STRAIGHT [3]
attack_delay [0]
lost_time [0]
back_up [false]
back_time [0]
left_time [0]
back_flag [false]
fire_delay [0]
skill_time [0]
attack_state [0]
Spawn[ () // spawn actor
{
Console(false); //display console
AttributeOrder(HEALTHATTRIBUTE, HEALTH, "Die"); //Set health attribute, ammount of health, and death seen
FindTargetOrder(200,"Alert","health"); //sets vision distance, section called when target is found
SetFOV(360); //set field of vision
HostilePlayer(HOSTILEPLAYER); //Hostile to player
HostileSame(HOSTILESAME); //Hostile to each other
HostileDifferent(false); //Hostile to other pawns
SetGroup(GROUP); // Enemy Group
}]
Idle[ ()
{
// just look around a bit
Rotate(IDLE, YAWSPEED, 0, 100, 0, "");
Delay(IDLE, random(3,5), "");
Rotate(IDLE, YAWSPEED, 0, -200, 0, "");
Delay(IDLE, random(3,5), "");
Align();
NewOrder("Patrol"); // continue to patrol
} ]
Die[ ()
{
AnimateStop("Die",0,""); //Death Animation
FadeOut(2,0); //Fade out actor
Remove(true); //remove pawn after death
}]
Alert[ () // page 126
{
PlayerDistOrder(-800,"LostTarget"); //Distance at which it can detect a target
AnimateStop(Idle,0,""); //play idle animatino when lost
NewOrder("Attack"); //play attack animation when found
}]
Attack[() // page 128
{
RotateToPlayer(Walk,160,false,""); //page 129
FireProjectile("pistol_shell","BIP01 R FOREARM",0,0,0,"health","");
//Delay("hit",1,"");
if(self.player_range>96)
{
MoveForward(WALK,50,50,"");
}
else
{
Delay("hit",1,"");
}
RestartOrder();
}]
LostTarget[ ()
{
BlendToAnimation(IDLE, 1, false, "");
FindTargetOrder(200,"Alert","health");
}]
Scripting error
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Scripting error
There are quite a few problems with the script that I can see without testing it in game.
First - if you have posted the complete script - you are missing a closing } at the very end of the file.
You've obviously copied the variables at the beginning from an existing script. I would advise to delete those that are not needed. Also check if the initial values for the variables are correct (e.g. the names of the actor's animations - also note that these names are case sensitive!).
If you have problems with a script you should also turn on the console with
to get information about the executed script in game.
In your Idle[] order you use
but you have not defined any Patrol[] order in your script.
When using animation names either use the variables from the top of the script (e.g. IDLE) or the name string enclosed by quotation marks (e.g. "idle"). You've mixed this up in several methods.
P.S.: Please use the code tags when posting your scripts on the forum.
First - if you have posted the complete script - you are missing a closing } at the very end of the file.
You've obviously copied the variables at the beginning from an existing script. I would advise to delete those that are not needed. Also check if the initial values for the variables are correct (e.g. the names of the actor's animations - also note that these names are case sensitive!).
If you have problems with a script you should also turn on the console with
Code: Select all
Console(true);
In your Idle[] order you use
Code: Select all
NewOrder("Patrol");
When using animation names either use the variables from the top of the script (e.g. IDLE) or the name string enclosed by quotation marks (e.g. "idle"). You've mixed this up in several methods.
P.S.: Please use the code tags when posting your scripts on the forum.
Re: Scripting error
Oh, Thanks a lot. I got it. Yet, i have another problem in my game. It is about the armor part. I have the following:
(THE ARMOUR.INI FILE)
(THE PLAYER.INI FILE)
(THE INVENTORY.INI FILE)
HOWEVER, the armor cannot protect me and doesn't receive any damage
Code: Select all
[power_vest armor]
attribute = health
Bolt = 80 5
Explosion = 50 25
Melee = 75 10
JumpOn = 80 5
50mm_shell = 70 18
Code: Select all
[power_vest armor]
initial = 100
low = 0
high = 100
Code: Select all
[power_vest armor]
catagory = use
image = vest.bmp
imagealpha = a_vest.bmp
text = bullet_proof vest
usedecrease = true
HOWEVER, the armor cannot protect me and doesn't receive any damage