Cob tutorial 6
This tutorial is very simple with very few new commands. Here you’ll learn to make a toy doll who will make a sound when she is pushed, make the Norn say “Dolly!” and change positions when she is put down and picked up. Most of the commands used in this tutorial you will have come across before. I’m assuming you’ve read my other tutorials so I’ll only explain the new commands.
inst new: simp hdly 2 0 3500 0 setv cls2 2 13 31523 setv attr 199 bhvr 1 1 slim edit endm
Nothing new all all here. Just the average looking installation script. Almost exactly the same as the toy car and the fireworks, except for the species number
scrp 2 13 31523 1 snde hdly stim writ from 10 255 0 0 40 150 41 150 46 150 45 150 setv actv 0 endm
Nothing new here either. Don’t worry. The new stuff IS coming. We’re learning about two entirely new scripts in this tutorial.
scrp 2 13 31523 5 pose 1 endm
scrp 2 13 31523 5
We’ve always used script number 6 (collision script) up until now to make the dropping sound. Script number five is actually the drop script itself and will occur when the object is dropped, not when it collides with the floor, and not when it colides with a wall or something else.
This command changes the picture to one of the dolly sitting down (the second in the sprite file). I know this isn’t new, but it is the guts of this particular drop script.
scrp 2 13 31523 6 snde drop endm
scrp 2 13 31523 4 pose 0 endm
scrp 2 13 31523 4
This is script number four and is executed when either the hand or the norn picks the object up.
The dolly is now standing up again (the first picture in the sprite file). If you do not put this script in the doll will remain sitting down forever after the drop script is run for the first time. (Poor dolly, that’d get very uncomfortable).
scrp 2 13 31523 17 drop impt 3 aim: 0 appr touc wait 5 mesg writ _it_ 4 say$ [Dolly!] wait 10 pose 73 mesg writ _it_ 1 done endm
scrp 2 13 31523 17
Another new type of script! This is the extra activate script (number 17) and gives extra information to the push script. The extra activate script is run when a norn pushes the object. It is not run when the hand pushes the object. In this script the target is the norn. The target is the focus of the script. It is the object that creatures is communicating with. In most scripts the default target is the object, but in the extra activate script the default target is the norn.
Tells the norn to drop whatever it is carrying.
Tells the norn that this action is given an importance of three. The lowest importance you can give an object is 0 and it is not suggested you give an object an importance any higher than 9. Three is the most commonly used value.
Tells the Creature that this is a push script and tells it where to push. Since this is a simple object, there is only one place it can push. This command is still important though as it tells the norn that this object is being pushed.
Tells the norn to approach the object.
Tells the norn to touch the object
Tells the game to wait 5 ticks until it continues with the script.
mesg writ _it_ 4
Activates the get script (number four) and forces Norn to pick up the object
Makes the norn produce a speech bubble with the word “Dolly!” in it, like it actually is saying dolly. Does not produce any sound. Be very careful when using this command. It may have undesirable and nasty effects when not used properly.
wait 10 pose 73
Tells the Norn to assume pose 73. I’m not sure exactly what pose this is, but it makes the norn look like it is pushing the object. Yes! I bet you didn’t realise you can play with the poses of norns as well as other objects. Norn poses aren’t simple sprite file positions as are the other poses. There are a set of norn poses (which you can see in the genetics kit and GEL) which are number 1 to 255. You can tell the norn activating the object to assume that pose and thus make it look like the norn is eating, dancing, kicking or whatever is suitable for that particular object.
mesg writ _it_ 1
Activates the push script. I know it’s a bit weird calling the push script since this script is activated by the creature pushing the object. This just tells the game where the push script should come in the sequence of events.
All over! All over! Thank heavens! Tells creatures the activate script is over.
inst enum 2 13 31523 kill targ next scrx 2 13 31523 1 scrx 2 13 31523 17 scrx 2 13 31523 5 scrx 2 13 31523 6 scrx 2 13 31523 4 endm
Well we did learn a fair bit in this tutorial. :) Tricked you didn’t I! The extra activate and the drop and get scripts are really very handy as they make your object and the norns’ interaction with it seem more real. :) I think that’s some of the hardest (and most useful) stuff for simple now over and done with in this tutorial and the last two.