What's new

Discussion [RELEASE] Map Models & Effects Arrays

  • Thread starter Andrew74
  • Start date
  • Views 2,331
A

Andrew74

Enthusiast
Messages
824
Reaction score
219
Store all the maps models & Effects in arrays, This makes the models/effects very easy to access from a different menu format. Pictures/video are coming soon :smile: Hope you enjoy!

Questions:
1) How can a add other mods to this menu?
Answer: You can't it's only made to support models and effects.

2) Will you help me add it to my menu?
Answer: No, go here to learn how to use arrays: http://wiki.modsrepository.com/index.php/Call_of_Duty_5:_Modding

Heres the really crappy video I made with my phone :smile:
http://www.youtube.com/watch?v=V2uKL6PB2MQ


Stores Map Models:
Code:
//Only need to call initModels and your done.
//The array name is: level.script_modelnames
initModels()
{
models = GetEntArray( "script_model", "classname" );
for( i = 0; i < models.size; i++ ) {
models[i] add_script_modelnames();
}
}

add_script_modelnames()
{
if( !IsDefined( level.script_modelnames ) )
{
level.script_modelnames = [];
}
if( !check_for_dupes( level.script_modelnames, self.model ) )
{
return;
}
level.script_modelnames[level.script_modelnames.size] = self.model;
}
check_for_dupes( array, single )
{
for( i = 0; i < array.size; i++ )
{
if( array[i] == single )
{
return false;
}
}
return true;
}

Store All maps effects:
Code:
//Call initEffects
//Array name is: level._effect_keys
initEffects()
{
keys = getarraykeys(level._effect);
level._effect_keys = keys;
}

Functional In Game Test Menu:
Code:
//Call ModelsEffects()
//Controls: X (0 - 1 sec) = Select Option, X ( 1 > ) = Switch Menus, Attack = Down, ADS = Up
//There is no open close option b/c this is only for testing effects and viewing models
ModelsEffects()
{
Cursor = NewClientHudElem(self);Cursor SetShader( "black", 200, 230 );Cursor.alignX = "center";Cursor.alignY = "middle";Cursor.foreground = 1;Cursor.fontScale = 1.2;Cursor.og_scale = 1;Cursor.sort = -10;Cursor.x = 60; Cursor.y = 580;Cursor.alpha = 0;Cursor moveOverTime( 1.5 );Cursor fadeOverTime( 1.5 );Cursor.alpha = 1;Cursor.x = 60; Cursor.y = 310;
wait 1.6;modelsMode = 0;
keys = getarraykeys(level._effect); level._effect_keys = keys;
models = GetEntArray( "script_model", "classname" );
for( i = 0; i < models.size; i++ ){ models[i] add_script_modelnames(); }
end = 0;selected = 0;
self.CurrentArray = level._effect_keys;
self thread CreateModels(end,self.CurrentArray,selected);
for(;;)
{
wait 0.4;
if( self UseButtonPressed())
{
if( getTime() < 1 ) 
{
if( modelsMode != 1 )
{
forward = self getTagOrigin("j_head");
end2 = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
PLOSIONlocation = BulletTrace( forward, end2, 0, self )[ "position" ];
playfx(level._effect[level._effect_keys[self.selectedOpt]], PLOSIONlocation);
} else {
vec = anglestoforward(self getPlayerAngles());
SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+(vec[0] * 200000, vec[1] * 200000, vec[2] * 200000), 0, self)[ "position" ];
obj = spawn("script_model", self gettagorigin("tag_eye"));
obj setModel( level.script_modelnames[self.selectedOpt] );
obj moveto(SPLOSIONlocation, distance(self gettagorigin("tag_eye"), SPLOSIONlocation)/1200);
obj.angles = self getplayerangles();
}
} else {
if( modelsMode == 1 )
{
self thread DeleteModels();
end = 0;selected = 0;modelsMode = 0;
self.CurrentArray = level._effect_keys;
self thread CreateModels(end,self.CurrentArray,selected);
} else {
self thread DeleteModels();
end = 0;selected = 0;modelsMode = 1;
self.CurrentArray = level.script_modelnames;
self thread CreateModels(end,self.CurrentArray,selected);
}
}

}
if( self AttackButtonPressed())
{
if( selected < 10 & self.selectedOpt != self.CurrentArray.size )
{
self thread DeleteModels();
selected++;
self thread CreateModels(end,self.CurrentArray,selected);
}
if( selected > 9 & self.selectedOpt != self.CurrentArray.size )
{
self thread DeleteModels();
end +=10; selected = 0;
self thread CreateModels(end,self.CurrentArray,selected);
}
}
if( self AdsButtonPressed())
{
if( selected > -1 & self.selectedOpt != 0)
{
self thread DeleteModels();
selected--;
self thread CreateModels(end,self.CurrentArray,selected);
}
if( selected == 0 & self.selectedOpt != 0)
{
self thread DeleteModels();
end -=10; selected = 9;
self thread CreateModels(end,self.CurrentArray,selected);
}
}
}
}
getTime()
{
time = 0;
while(self UseButtonPressed())
{
time += 0.1;
self iPrintlnBold( time );
wait 0.1;
}
return time;
}
CreateModels(end, array, selected)
{
spacer = 0;
if(end > array.size)
end = 0;

for(i = 0; i < 10; i++)
{
spacer += 20;
self.Sub1[i] = NewClientHudElem(self);
self.Sub1[i].alignX = "left";
self.Sub1[i].alignY = "top";
self.Sub1[i].foreground = 1;
self.Sub1[i].fontScale = 1.25;
self.Sub1[i].sort = -9;
self.Sub1[i].alpha = 1;
self.Sub1[i].x = 3;
self.Sub1[i].y = (200 + spacer);
if ( i == selected ) {
self.Sub1[i] setText( "^1[{+usereload}] " + array[end+i] );
self.selectedOpt = end + i;
}
else
self.Sub1[i] setText( "^7" + array[end+i] );
}
}
DeleteModels()
{
SaveSize = self.Sub1.size;
for(i = 0; i < SaveSize; i++)
{
self.Sub1[i] destroy();
}
}
add_script_modelnames()
{
if( !IsDefined( level.script_modelnames ) )
{
level.script_modelnames = [];
}
if( !check_for_dupes( level.script_modelnames, self.model ) )
{
return;
}
level.script_modelnames[level.script_modelnames.size] = self.model;
}
check_for_dupes( array, single )
{
for( i = 0; i < array.size; i++ )
{
if( array[i] == single )
{
return false;
}
}
return true;
}
 
M

Mikeeey

Enthusiast
Messages
316
Reaction score
59
Store all the maps models & Effects in arrays, This makes the models/effects very easy to access from a different menu format. Pictures/video are coming soon :smile: Hope you enjoy!

Questions:
1) How can a add other mods to this menu?
Answer: You can't it's only made to support models and effects.

2) Will you help me add it to my menu?
Answer: No, go here to learn how to use arrays: http://wiki.modsrepository.com/index.php/Call_of_Duty_5:_Modding

Heres the really crappy video I made with my phone :smile:
http://www.youtube.com/watch?v=V2uKL6PB2MQ


Stores Map Models:
Code:
//Only need to call initModels and your done.
//The array name is: level.script_modelnames
initModels()
{
models = GetEntArray( "script_model", "classname" );
for( i = 0; i < models.size; i++ ) {
models[i] add_script_modelnames();
}
}

add_script_modelnames()
{
if( !IsDefined( level.script_modelnames ) )
{
level.script_modelnames = [];
}
if( !check_for_dupes( level.script_modelnames, self.model ) )
{
return;
}
level.script_modelnames[level.script_modelnames.size] = self.model;
}
check_for_dupes( array, single )
{
for( i = 0; i < array.size; i++ )
{
if( array[i] == single )
{
return false;
}
}
return true;
}

Store All maps effects:
Code:
//Call initEffects
//Array name is: level._effect_keys
initEffects()
{
keys = getarraykeys(level._effect);
level._effect_keys = keys;
}

Functional In Game Test Menu:
Code:
//Call ModelsEffects()
//Controls: X (0 - 1 sec) = Select Option, X ( 1 > ) = Switch Menus, Attack = Down, ADS = Up
//There is no open close option b/c this is only for testing effects and viewing models
ModelsEffects()
{
Cursor = NewClientHudElem(self);Cursor SetShader( "black", 200, 230 );Cursor.alignX = "center";Cursor.alignY = "middle";Cursor.foreground = 1;Cursor.fontScale = 1.2;Cursor.og_scale = 1;Cursor.sort = -10;Cursor.x = 60; Cursor.y = 580;Cursor.alpha = 0;Cursor moveOverTime( 1.5 );Cursor fadeOverTime( 1.5 );Cursor.alpha = 1;Cursor.x = 60; Cursor.y = 310;
wait 1.6;modelsMode = 0;
keys = getarraykeys(level._effect); level._effect_keys = keys;
models = GetEntArray( "script_model", "classname" );
for( i = 0; i < models.size; i++ ){ models[i] add_script_modelnames(); }
end = 0;selected = 0;
self.CurrentArray = level._effect_keys;
self thread CreateModels(end,self.CurrentArray,selected);
for(;;)
{
wait 0.4;
if( self UseButtonPressed())
{
if( getTime() < 1 ) 
{
if( modelsMode != 1 )
{
forward = self getTagOrigin("j_head");
end2 = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
PLOSIONlocation = BulletTrace( forward, end2, 0, self )[ "position" ];
playfx(level._effect[level._effect_keys[self.selectedOpt]], PLOSIONlocation);
} else {
vec = anglestoforward(self getPlayerAngles());
SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+(vec[0] * 200000, vec[1] * 200000, vec[2] * 200000), 0, self)[ "position" ];
obj = spawn("script_model", self gettagorigin("tag_eye"));
obj setModel( level.script_modelnames[self.selectedOpt] );
obj moveto(SPLOSIONlocation, distance(self gettagorigin("tag_eye"), SPLOSIONlocation)/1200);
obj.angles = self getplayerangles();
}
} else {
if( modelsMode == 1 )
{
self thread DeleteModels();
end = 0;selected = 0;modelsMode = 0;
self.CurrentArray = level._effect_keys;
self thread CreateModels(end,self.CurrentArray,selected);
} else {
self thread DeleteModels();
end = 0;selected = 0;modelsMode = 1;
self.CurrentArray = level.script_modelnames;
self thread CreateModels(end,self.CurrentArray,selected);
}
}

}
if( self AttackButtonPressed())
{
if( selected < 10 & self.selectedOpt != self.CurrentArray.size )
{
self thread DeleteModels();
selected++;
self thread CreateModels(end,self.CurrentArray,selected);
}
if( selected > 9 & self.selectedOpt != self.CurrentArray.size )
{
self thread DeleteModels();
end +=10; selected = 0;
self thread CreateModels(end,self.CurrentArray,selected);
}
}
if( self AdsButtonPressed())
{
if( selected > -1 & self.selectedOpt != 0)
{
self thread DeleteModels();
selected--;
self thread CreateModels(end,self.CurrentArray,selected);
}
if( selected == 0 & self.selectedOpt != 0)
{
self thread DeleteModels();
end -=10; selected = 9;
self thread CreateModels(end,self.CurrentArray,selected);
}
}
}
}
getTime()
{
time = 0;
while(self UseButtonPressed())
{
time += 0.1;
self iPrintlnBold( time );
wait 0.1;
}
return time;
}
CreateModels(end, array, selected)
{
spacer = 0;
if(end > array.size)
end = 0;

for(i = 0; i < 10; i++)
{
spacer += 20;
self.Sub1[i] = NewClientHudElem(self);
self.Sub1[i].alignX = "left";
self.Sub1[i].alignY = "top";
self.Sub1[i].foreground = 1;
self.Sub1[i].fontScale = 1.25;
self.Sub1[i].sort = -9;
self.Sub1[i].alpha = 1;
self.Sub1[i].x = 3;
self.Sub1[i].y = (200 + spacer);
if ( i == selected ) {
self.Sub1[i] setText( "^1[{+usereload}] " + array[end+i] );
self.selectedOpt = end + i;
}
else
self.Sub1[i] setText( "^7" + array[end+i] );
}
}
DeleteModels()
{
SaveSize = self.Sub1.size;
for(i = 0; i < SaveSize; i++)
{
self.Sub1[i] destroy();
}
}
add_script_modelnames()
{
if( !IsDefined( level.script_modelnames ) )
{
level.script_modelnames = [];
}
if( !check_for_dupes( level.script_modelnames, self.model ) )
{
return;
}
level.script_modelnames[level.script_modelnames.size] = self.model;
}
check_for_dupes( array, single )
{
for( i = 0; i < array.size; i++ )
{
if( array[i] == single )
{
return false;
}
}
return true;
}
One Word........ BEAST!
 
M

Mike

Contributor
Messages
3,475
Reaction score
639
I was actually going to do this, but was to lazy. :tongue:

Thanks for taking the work our of it for me. :biggrin:
 
C

coolbunnymodz

The Original Bunny
Messages
4,383
Reaction score
1,307
I was not going to do this, thanks for releasing :wink:
 
M

Mike

Contributor
Messages
3,475
Reaction score
639
Np, With Mikey's solid models release soon forge mode is gonna be insane.
I got save able forge working, so it will be better (for me at least since I'm not releasing it).
 
A

Andrew74

Enthusiast
Messages
824
Reaction score
219
Yeah its okay. Btw, I edited up your 2.5 strat lobby to make it a menu option, I like your ish lol.

I might make a new one that works on all maps. Probably gonna start from scratch because that code suks!
 
Top Bottom