im not entirely sure i know how to make mission events talk to scripts. im wondering if somone could break down how fred and scripts interact. let it be known that im really bad at fredding, as my scannin crates mission can attest.
the other day i wrote this nifty little script
to cloak your ship roughly 10 seconds into the game, assuming the proper bitmaps were available. now i didnt mean to get overly involved with designing a cloaking system, i just wanted to show other modders that scripting could probibly do what they wanted. but i was impressed by the effect and thought it feasable to write a script that any modder/fredder could use to cloak and decloak ships using fred's event system.
my script is simple and you have no control over when you cloak, it just cloaks, end of story. it mainly uses texture replacement changing out the ship texures with others of varying transparency. i wrote a function that automatically loads cloakmaps starting with texturename-c## into an array so they can be cycled through rather easily. i also have a function to unload the textures. and im working on a 3rd function to toggle cloak states.
i need to be able to make 3 function calls from fred. the first to specify a ship handel (or something i can derive the handel from like a name or ship index) for the ship which will be cloaking, this tells my script what ship will be cloaking and also loads the textures for that ship on mission start. the next function is for toggeling cloak on and off, giving it the ship thats cloaking and returning wether its cloaked or not. and the 3rd thats used to unload the textures at the end of the mission, so they dont sit in memory and degrade performance (a 16 texture cloak effect on a 512^2 map can take up to 6 megs, and that only multiplies for each texture that the ship has).
anyway i want to make it so all the fredder has to do is (other than making cloak maps) put in 3 events, to init cloaking for a ship, to toggle the cloak, and to unload the textures at mission end. the fredder should be able to make advanced cloaking behavior, such as locking guns, throught the events system. i want to use the events system because of the white-elephant nature fo the effect, and its rather ineffietient use of texture memory forbids using it on every single ship, making it excelent for mission speciffic use.