automated cut scene

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

automated cut scene

Post by scott »

i need some help with scripting, i have never done it before and havnt got a clue so i need easy and simple steps.

i am trying to get a croud of people, (virgil) to move farwards to a point and then stop, and do idel animation, and then random running around.

its for a scene where lots of pople, wich is virgil in different skins walking up to a wall and then set alite and they start running randomly for a few seconds.

i dont know if this is even possible and if not will probably just try and get a cut scene from milkshape to look good.

as i sed im a noob at this so start from the very begining please.
*GD*
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

It is possible to do such a thing, it's quite easy too.

A total noob, eh? Well... I'll try to explain the basics as well as I can.
You should read the Pawn Scripting section of the Online Help. Andy's basic pawn tutorial should help too (http://www.freewebs.com/andycr/pawns.htm). Scripts are made of orders which contain all the commands that control pawns. All the commands are listed in the Online Help.

Ok, so let's start building that script. It always starts with a "{" and ends with a "}". Let's add our first order. The basic order layout is in the Online Manual.
Let's call the first order "Spawn". We get something like this:
{

Spawn[ ()
{


} ]

}
Now the pawn won't do anything, because he doesn't have any commands. So let's add our first command. MoveForward-command sounds useful here. Every line ends with a ";".
{

Spawn[ ()
{

MoveForward("WALK",10,500,"WALKSOUND");

} ]

}
You need to change WALK to your moving animation and WALKSOUND to the sound you want to be played while the pawn is moving(If you don't want any sound to be played, use just ""). 10 indicates the speed at which he is walking and 500 indicates how far away he is going to walk. You can change all of these if you want.

Next thing: the idle animation. There's a command called LoopAnimation, which allows us to make the pawn run his idle animation for a certain amount of time and then continue to next commands.
{

Spawn[ ()
{

MoveForward("WALK",10,500,"WALKSOUND");
LoopAnimation("IDLE",10,"IDLESOUND");

} ]

}
Again you have to change IDLE to whatever your idle animation is called and IDLESOUND to the sound you want to be played.

Now it's time for that crazy running. We'll have to make another order for that. The NewOrder - command allows us to jump between orders. Again, all of these commands are from the Online Help.
{

Spawn[ ()
{

MoveForward("WALK",10,500,"WALKSOUND");
LoopAnimation("IDLE",10,"IDLESOUND");
NewOrder("Run");

} ]

Run[ ()
{

Rotate("ROTATEANIMATION",360,0,random(-180,180),0,"ROTATESOUND"); // random rotation
MoveForward("WALK",10,500,"WALKSOUND"); //run like hell!
RestartOrder(); //turn and run again

} ]

}
Ok, I added the Run-order. First thing to do in that order is to turn around randomly. Once again, change ROTATEANIMATION and ROTATESOUND. 360 is the speed at which the pawn turns around, you may change it. The part "0,random(-180,180),0" indicates the rotating angles, X, Y, Z. We want him to rotate around the Y-axis randomly so we set X and Z to 0 and use the random() -command in Y (yes, you can use commands inside commands). Random(-180,180) returns a value somewhere between -180 and 180 so the pawn can turn to any direction.
Then the pawn runs forward for a while like before. After that comes a command called RestartOrder(). The name pretty much explains it, it restarts the order so the pawn will turn randomly again and run to the new direction.

Oh, and by the way. Symbols "//" make the rest of the line comment. That means that the engine will ignore them.



I really hope this helps even a tiny bit. If you have any troubles understanding what I mean, feel free to ask. :)

Aaaaaaand, I didn't test the script. It may work or it may not work. :D
Pain is only psychological.
User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

Post by scott »

thanx for the help, realy greate, i understood it completely, going to give it a try in a moment, i found programming at college easy just the different code that i neverlernt all of as there was so much, but this dont seem to difficult, mabe i can get into this scripting, i rmember reading a book on scripting as wel as other things in it and it mentiond high and low level scripting, whats the difference?or is that only for genisis or an older version of RF as it was a little out dated.
*GD*
User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

Post by scott »

sorry for the double post but i have one more question left, cos i am using different actors, (the same one but with different skins) so they will have like virgil1 virgil2 virgil3 and so on, how would i tell them what script to run, would i have to make seperate ones or just tell them to use the same one, and where would you tell it what one to use., under the atributes?
*GD*
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

The main difference between high and low level is that highlevel executes its commands one by one, apart from some exeptions there's always only one command to execute. In lowlevel, on the other hand, all commands are executed at the same time. Some commands also require low or high level to work.

You tell pawns what script to use in the level editor. In the pawn entity there are fields "ScriptName" and "SpawnOrder". ScriptName is, surprise surprise, the name of the script file and SpawnOrder is the first order to be executed when the pawn is created. In this case SpawnOrder would be "Spawn".

EDIT:
would i have to make seperate ones or just tell them to use the same one
As long as your Virglis have the same animation names you can use the same script.
Pain is only psychological.
User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

Post by scott »

thank yopu so much for the help and quicknes of your response, i was sort of woried i wouldnt get one in time, its just a qucik cut scene that i have to make for a DVD menue screen for a college work, and as i was making a game i thought about making my project on it, creating an interactive menu, and had to be done by this thursday and was thinking i would have to somehow get it all to work in milkshape, wich wouldnt be easy. so thank you very much and hopefuly now i will be able to do this small bit in time.

ps, i am also using this menu for my website, when i have created my own charactor, as i want the content to be 100% original, i was just using virgil for the project as i needed a quick person to mess around with.
*GD*
Post Reply