UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[UGX Tutorial] How to see every script-loaded fx included in your map

broken avatar :(
Created 10 years ago
by treminaor
0 Members and 1 Guest are viewing this topic.
3,869 views
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator 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:

Code Snippet
Plaintext
level._effect["explosion"] = loadFX("explosions/my_explosion");

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:

Code Snippet
Plaintext
	keys = getArrayKeys(level._effect);
origin = getPlayers()[0].origin;
angles = getPlayers()[0] getPlayerAngles();

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.
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator 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.
Anyone tried this yet?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
So is there a way to get ALL fx in a map(loaded, weapons, etc)?

Last Edit: March 22, 2014, 11:07:24 pm by daedra descent
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator 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.
broken avatar :(
×
broken avatar :(
Relentless Mapper
Location: al
Date Registered: 21 August 2011
Last active: 2 weeks ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
Nuclear
My Groups
More
×
KDXDARK's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Nuclear
Nuclear
DARKLEGION's requested title
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
KDXDARK's Contact & Social Links
Well i use this, my map is running ugx mod, it show the FX number 132 and the game crash, but there is a lot of FX that are not played.
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator 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.
but there is a lot of FX that are not played.
Like what?
broken avatar :(
×
broken avatar :(
Relentless Mapper
Location: al
Date Registered: 21 August 2011
Last active: 2 weeks ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
Nuclear
My Groups
More
×
KDXDARK's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Nuclear
Nuclear
DARKLEGION's requested title
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
KDXDARK's Contact & Social Links
Like what?
every number means a FX? from 132 only 40(or lower) has played
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 8 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator 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.
every number means a FX? from 132 only 40(or lower) has played
Read the rest of the first post.

 
Loading ...