Wednesday 4 April 2018

How to make a simple remover COB for a Creatures 2 official object

Download Slink's Creatures 2 scriptorium and unzip it.  

Then open the "c2scrp.htm" file in your web browser and you'll get a list that looks a little like this: with sprite files, names, class numbers.


The Scriptorium browser that's available with the Creatures 2 CAOS Tool is more comprehensive, as it comes directly from your copy of the game, particularly for more complex objects, like the Vibraphone, but for a quick reference to sprites and class numbers, Slink's Creatures 2 Scriptorium is where it's at.





Open up Bobcob and choose the autoscript function:


Choose preferences

Tick Source type: Creatures 2, and output of Remover.  Then use the C2 Scriptorium list from before to choose the correct class number, then click Build:


It will then create a new script for you.

inst
enum 2 13 12
kill targ
next
scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6
endm

Note that this script will remove all the purple balls from the world:

inst
enum 2 13 12
kill targ
next

and all the associated scripts:

scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6

before quitting:

endm

To have a script that simply removes the balls while leaving their scripts intact, you would use the code:

inst
enum 2 13 12
kill targ
next
endm

Move the script from the "Remover Script" section to the "Install Scripts" section, and remove the script from the remover section.

This will allow you to inject it as if it was any other COB.

Final touches


In the Picture tab, use Slink's C2 Scriptorium to find the correct sprite file name from your game and import the image - this can help prevent crashes.  The sprite for the purple ball is dbal.s16.


Now, the little * in the name of the COB means that the file needs to be saved, so I'll go ahead and do that.  The amount being -1 means there are infinite amounts of purple ball remover.  

Download

If you just want to get rid of those purple balls right this second, download the fruits of this tutorial.

Moving on

It's possible to stack remover scripts together in one script so that you can remove more things at once, for example to write a script removing the purple ball (2 13 12) and the green tennis ball (2 13 5) AND all their scripts, you would use the following:

inst
enum 2 13 12
kill targ
next
enum 2 13 5
kill targ
next
scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6
scrx 2 13 5 1
scrx 2 13 5 2
scrx 2 13 5 3
scrx 2 13 5 4
scrx 2 13 5 5
scrx 2 13 5 6
endm

Note that the green tennis ball has more scripts associated with it than the purple one does.  I would not recommend creating a 'Remove All' remover COB like this because the inst command makes things happen in 1/10th of a second - so putting too many things in one remove script might make the game crash.

Another use for a simple remover script like this:

inst
enum 2 13 12
kill targ
next
scrx 2 13 12 1
scrx 2 13 12 4
scrx 2 13 12 5
scrx 2 13 12 6
endm

would be to put it in an installation script for a new object using the same class number - so that the purple ball is removed before a new object is created.  

No comments:

Post a Comment