dantedevil said:
I really appreciate all your help. But is there any manual that indicates step by step how to do this?
Script is like a digital set of Lego blocks. There will never be a comprehensive "step-by-step" manual on how to do specific tasks with script, because that's the whole point - you custom build them to suit your needs. What we can do is provide manuals on how script works in general (of which there are many), and help you with tasks like this when they arise.
Now on to getting this done. I just assumed you did have a death script because your module is pretty complex, but it's no big deal if you don't. Let's get one made.
1. Create a blank text file with whatever name will help keep you organized, and rename the extension to ".c". Now you have a blank script.
2. Copy this into the script file:
Code:
// This function runs when a script is first loaded. It's good for initializing things that
// only need to be done one time, like pre-loading a sound or image file.
void oncreate()
{
log("\n\n Created.");
}
// This function runs when a script is unloaded. It's good for cleaning stuff up.
void ondestroy()
{
log("\n\n Destroyed.");
}
// This is the main function. This is what runs each time the script executes. It is required
// for all scripts except "animation" (because animation inserts a main() automatically). If
// you forget to add it, the engine will shut down and log an error.
void main()
{
log("\n\n Main.");
}
3. Add this script to your model by putting its path in the
ondeathscript header.
Now fire up your module, and if everything loads up OK, check the log. When an entity with this script spawns into play, you should see
"Created" in the log. KO the entity, and you should then see
"Main". When the entity is unloaded and removed from play, then
"Destroyed". should appear. Now we know there's a working
ondeathscript, and can move to the next portion. Let me know when you're done.
Protip: Open the log in your browser instead of Notepad - then you can just hit refresh to see any changes as you test.
DC