Page 1 of 2
First Pawn
Posted: Sat Mar 15, 2008 1:15 pm
by Sph!nx
Before can start building the game I have in mind I must first learn the 'ins and outs' of Reality Factory, so I've started to work on a learing/experimentation project.
I've mostly got everything covered but I do need a lot of help with scripting because this is totally new for me. I've read many tutorials, the docs and the e-book but still it seems really difficult for me so I've started this thread.
Right, here are my first problems. I've made a little box map, a character with a new skeleton and one very n00bish animation. The character is compiled and everything seems to work fine.
I've also got the model working in the editor and thus as a static mesh in the game. I've written my first script, well stolen from AndyCR's tutorial, and renamed the animation name. Now it should play the animation right? It does not ... It just stands there doing nothing!
Here is the script and the entry in the pawn.ini. Can anyone help me?
Code: Select all
{
Spawn[()
{
PlayAnimation("anim_idle", true, ""); // with the new animation name
RestartOrder();
}]
}
pawn.ini wrote:
[dev_human]
actorname = dev_human.act
actorrotation = 0 180 0
actorscale = 1.4
fillcolor = 255 255 255
ambientcolor = 255 255 255
subjecttogravity = true
boundingboxanimation = idle
Also, I seem to have a problem with my bounding box. Look :
Know how to fix this?
Thanks ahead!
Edit :
I've noticed some define their animation at the beginning at the script. I did it just like that, again no succes.
Code: Select all
{
IDLE [anim_idle] // Defined animation.
Spawn[()
{
Console(true);
PlayAnimation(IDLE, true, ""); // here also pointed to IDLE
RestartOrder();
}]
}
Could it be the model? I've compiled it succesfully and it plays its animation in the modelviewer.
Re: First Pawn
Posted: Sat Mar 15, 2008 5:01 pm
by darksmaster923
you have the console on. what does the text in the left hand corner of the screen say?
Re: First Pawn
Posted: Sat Mar 15, 2008 5:10 pm
by Sph!nx
Tried it again, the console shows nothing. I've tried the same thing with a model that was delivered with RF and it does seem to work with that one.
Is there something I've done wrong with compiling the model? I mean, are there certain animation names to be followed. I've exported everything correctly. Is there perhaps a big difference between looping and non looping animations?
Re: First Pawn
Posted: Sat Mar 15, 2008 5:26 pm
by darksmaster923
Sph!nx wrote:Tried it again, the console shows nothing. I've tried the same thing with a model that was delivered with RF and it does seem to work with that one.
Is there something I've done wrong with compiling the model? I mean, are there certain animation names to be followed. I've exported everything correctly. Is there perhaps a big difference between looping and non looping animations?
if the console doesn't show, then the script isnt running. have you checked your log file or the file animation name is anim_idle?
Re: First Pawn
Posted: Sat Mar 15, 2008 5:36 pm
by bernie
Have you got the pawn entity set up correctly?
ie
Angle: 0 0 0 This may have a bearing on the bounding box
ScriptName: yourscritname.s The dot s is important
SpawnOrder: Spawn
Have you got the animation name exactly as it apears in the drop down list in Actor Viewer ?
Re: First Pawn
Posted: Sat Mar 15, 2008 5:47 pm
by Sph!nx
Checked it again. Everything has been setup correctly.
When compiling models for Half-life, one must first create and edit a .qc file for it in order to compile. I have not noticed a .qc (or the likes) for RF. Again, could it have something to do with the animations?
Re: First Pawn
Posted: Sat Mar 15, 2008 6:12 pm
by bernie
Can I download our model and try for myself? It would make it easier to find the problem.
Re: First Pawn
Posted: Sat Mar 15, 2008 9:13 pm
by Sph!nx
Sure. Dont mind the crappy animation. its just a test. Cant figure out how to slow the animation down too.
Here it is!
http://www.goannasvencoop.com/sphinx/sp ... _human.rar
Re: First Pawn
Posted: Sat Mar 15, 2008 10:08 pm
by bernie
Your model and animation work fine for me.This is what I did.
I put the Actor in the actors folder.
I used your script and named it test.s
I placed the script file in the scripts folder.
I used your pawn.ini and saved it in the install folder.
I set up a pawn entity as follows:
Angle 0 0 0
HideFromRadar false
PawnType dev_human
ScriptName test.s
SpawnOrder Spawn
Everything else as default.
Just as an afterthought ... Make sure you have at least 2 linefeeds in your pawn.ini file after the end of your setup and 2 linefeeds after the closing bracket in your script file.
There is still a problem with the bounding box, probably introduced when you made the actor. What program did you use to make the actor?
Re: First Pawn
Posted: Sat Mar 15, 2008 10:16 pm
by Sph!nx
Thanks bernie! I will try it again with your directions. I have made the model in Milkshape.
Edit :
I tried it exactly the way you did. Even renamed it the way you have. Still it does not work for me ...

Re: First Pawn
Posted: Sat Mar 15, 2008 10:59 pm
by bernie
Add Console(true); to the begining of the script as below and run the level.
{
Spawn[()
{
Console(true);
PlayAnimation("anim_idle", true, ""); // with the new animation name
RestartOrder();
}]
}
You should get information on your screen when you run the level. If you do not, then the script isn't running for some reason. You are putting the test.s in the ScriptName and not ConvScriptName aren't you?
Re: First Pawn
Posted: Sat Mar 15, 2008 11:07 pm
by Sph!nx
Thanks for your help so far Bernie! Much appreciated.
I've been trying a lot of stuff and the whole thing has become one big mess. Trying it all again with a fresh new install. I will also make a new model to experiment with. Something simple, like a robot with simple animations.
When that's done I will try to script this again.
Not sure if you are using MSN but if you don't mind me asking a few questions once and a while you can add my to it if you want.
sphinx019@hotmail.com
Re: First Pawn
Posted: Sat Mar 15, 2008 11:42 pm
by bernie
No I don't use MSN but you can always pm me.
The Model is fine. The bounding box is ok I checked it with lithunwrap. Actually the b/box is always square along the base in rf that's the way rf works, you can alter the height but if you alter the width it also changes the depth. Using pawns and scripting is difficult to start with, but it gets much easier as you go along. There are a lot of pitfalls but you learn to avoid them. Keep at it, you'll get there in the end.
Re: First Pawn
Posted: Sun Mar 16, 2008 12:00 am
by Sph!nx
Thanks, m8! Gonna be busy with the new test model. Gonna make a new one for easier animations for later experimentation. I will PM you when I need your help!

Re: First Pawn
Posted: Sun Mar 16, 2008 3:36 pm
by Sph!nx
It occurred to me that the bounding box for the human character was about the same size of the reference mesh (.bdy) in the actor file instead of the idle animation I asumed from the the entry in the .ini. It also is rotated 90 degrees. It should not do that.
Okay, here's the new model (in progress). Its a droid on wheels so I dont have to make a lot of complicated animations. This is just for the test remember.
Is the bounding box generated from the reference (.bdy) or from an animation (.mot)? Should I modify the body stance in the reference.bdy?
Thanks
EDIT :
Could a moderator move this thread to 'Game Designs', please? I will then rename the thread to 'First Game' 'cause this thread seems to cover more than scripting alone.