Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Hey guys - a while ago I noticed from an engine error message that PlayFX() and PlayFXOnTag() take an int as their first parameter - which is the parameter you would normally put your level._effect["name"] variable in. So this means that when you declare your fx like this:
the loadFX() function assigns an integer ID for that fx to the level._effect["explosion"] variable. Obviously you don't need to store your fx in the level._effect[] array, but that is common practice.
Once I realized this, it occurred to me that I could loop through every script FX by using their integer ID.
If you place this script somewhere (i.e. in your mapname.gsc) after maps\_zombiemode::main() is called, you will see all FX which have been loaded by script in your map:
Code Snippet
Plaintext
origin = getPlayers()[0].origin; angles = getPlayers()[0] getPlayerAngles(); for(i=0;i<400;i++) { fx = spawn("script_model", origin + (0,0,70)); fx.angles = angles; fx SetModel("tag_origin"); fx moveZ(75, 3); //this will show trail fx working iPrintLn("Playing index " + i); PlayFxOnTag(i, fx, "tag_origin"); wait 2; //how long you want each preview to last before moving to the next one fx delete(); }
This script has one shortcoming (which may only be due to me running in developer_script mode, haven't tested), is that once the for() loop reaches the end of the script-loaded FX allocation, the game will crash because you can't play the FX loaded by weaponFiles for some reason. And once you get past that chunk of the effect index array (for me this was around ID 250), you will just get "effect ID xxx is invalid" - I don't know what this means but if I had to guess I would say it means there is no effect at that index. Which leads to the question - where the hell are the other 150 fx allocated from?
I made another quick script which just prints the fx loaded into the level._effect[] array. Any FX which where loaded into a different array or variable will not be found using this method, but Treyarch always used this array so you will find anything that you didn't personally assign to a different array or variable:
for(i=0;i<keys.size;i++) { fx = spawn("script_model", origin + (0,0,70)); fx.angles = angles; fx SetModel("tag_origin"); fx moveZ(75, 3); //this will show trail fx working iPrintLn("Playing " + keys[i] + " from index " + i + " | Total: " + keys.size); PlayFxOnTag(level._effect[keys[i]], fx, "tag_origin"); wait 3; fx delete(); }
And lastly if you just want a list of the script names of the effects loaded into the level._effects array without any previews, run this code:
Code Snippet
Plaintext
keys = getArrayKeys(level._effect);
for(i=48;i<keys.size;i++) iPrintLn("FX: " + keys[i] + " at index " + i + " | Total: " + keys.size);
You can open your console output to see the full list since it will scroll by faster than you can read it.
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
So is there a way to get ALL fx in a map(loaded, weapons, etc)?
Not that I have found. Of course you could purposely cause the 400fx error by adding more and more fx and then copying the console output of all 400 through.
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.