====== Spawn And Effect ====== This script uses particle effects. See [[particleffects|here]] for a list. #!/bin/sq /* The above line identifies this script as a 'Squirrel' script. * When you first create a script, the server needs to know if it is * a Squirrel script, or a 'TSL' script (Taiga Script Language xD). * If this was a TSL script, it would say #!/bin/tsl. This naming * convenention comes from Unix shell scripts. */ // Constants, for things you might want to tune over the life of the // script, but are generally static const BOX_PROP_ID=1127466; const LIGHT_PROP_ID=1127467; // You need to declare any variables you might use spawnCID <- 0; steamParticle <-0; /* After declaring constants and variables, declare all of the * functions a script might use. These are not executed * immediately (unless explicitly called), but as the result of events */ ////////////////////////////////////////////////////// function queued_event() { /* Functions called as the result of an 'event' can themselves * fire more events. A common technique for this would be to * continuously call a function at an interval. This example * does nothing exception print a message in the server log every 10 * seconds */ print("The script is still running (Spawn CID=" + spawnCID + " Effect=" + steamParticle + ")"); inst.queue(queued_event, 5000); } /* * The on_finish function is called when the script exits. Do NOT * queue any more events here, they will not be called. Use * this function to clear up and return the instance to it's * previous state if applicable */ function on_finish() { inst.broadcast("The script has finished!"); } /* * The onKill function is called when a creature in this instance * dies. You will be supplied the creature instance ID (CID), and * the creature definition ID (if any). You can also write functions * named 'on_kill_[CDefID]' and those will be called too. */ function on_kill(cdefId, cid) { // Send a broadcast message inst.broadcast("I killed something!"); /* * Change the light from red to green */ inst.asset(LIGHT_PROP_ID, "Light-Intense?Group=1&COLOR=00FF00", 1); /* * Spawn the box prop. The spawn function takes 3 arguments,the * last 2 of which are optional. The first is the prop ID to * spawn and is required. The 2nd argument can be used to force * a different creature ID to that which is defined in the prop, * and the final argument is the 'flag' which determines if * the creature is friendly, neutral etc. * * The function will return the unique 'CID' which can then be * used in other functions to despawn or otherwise manipulate the * spawned prop. */ spawnCID = inst.spawn(BOX_PROP_ID, 0, 0); /* * Attach a steam particle to the spawned box. You must provide the * prop ID, the effect name, the scale of the effect, and an x,y * and z offset of the effect. */ steamParticle = inst.effect(BOX_PROP_ID,"Par-Steam",5,0,10,0); // Stop the script in 20 seconds. This will clean everything up inst.queue(inst.halt, 20000); } /* Any script declared outside of the functions is run once when the * script is loaded. Use this to set up any variables, or queue your * first event (if you script is continously doing something and not * just reacting to built in events such as on_kill). */ inst.queue(queued_event, 5000);