Author |
Topic: Script to allow Weapons... |
LiQ.HeaDShOt |
|
General Member Since: Jun 1, 2010 Posts: 51 Last: Feb 21, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Sunday, Aug. 1, 2010 10:02 am |
|
DemonSeed writes...Quote: Its simple - if you use ANY weapon which isn't a stock weapon, you have to compile the new weapon into the mod.ff file otherwise the game will not recognise it.
Add this to your mod.csv file:
Quote: weapons,mp/nameofweapon_mp
Once you've compiled the weapon, place a copy of the weapon file in your mod IWD file, in the weapons/mp folder.
Having done that, at the CallBack_StartGametype() function, precache your weapon:
Quote: precacheItem( "nameofweapon_mp" );
What is confusing about your explanation of the problem is that on the one hand you say its a "super" weapon which isnt given, then on the other you say its an m40a3_mp - which isnt a super weapon, its stock.
Understood.
The weap is a M40A3 Modified :P
One last thing..: Plz give me the directories and the lines of the files and everything so i don't mess up with it xD |
|
|
|
DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
|
|
LiQ.HeaDShOt |
|
General Member Since: Jun 1, 2010 Posts: 51 Last: Feb 21, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Sunday, Aug. 1, 2010 10:31 am |
|
DemonSeed writes...Quote: If its an existing weapon, you dont need to compile the weapon or precache it, but you do have to have it in the IWD file.
That's the problem!
I have it in my IWD file but no weap is given when a player reaches the ks.
The name of the weap is: xsniper_mp
Idk what to do..
As I said a guy told me that there was a script.. (It seems he had the same prob). |
|
|
|
DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
|
Category: CoD4 Scripting Posted: Sunday, Aug. 1, 2010 11:21 am |
|
No, you are getting confused - if the weapon is named xsniper_mp you have changed the name of the weapon - hence it isnt m403a_mp anymore. As such, xsniper_mp is a "new" weapon and wont be recognised by the game unless you tell it otherwise.
The game compiles all weapons from a CSV file (statstable.csv) when the game loads. If xsniper_mp isnt in it (and of course it isnt), then you need to compile the "new" weapon into your mod.ff file and precache it.
Add the weapon to your mod.csv file like I told you above.
You can precache your weapon in _weapons.gsc at the init() function:
Code: init()
{
// assigns weapons with stat numbers from 0-149
// attachments are now shown here, they are per weapon settings instead
// generating weaponIDs array
level.weaponIDs = [];
max_weapon_num = 149;
attachment_num = 150;
for( i = 0; i <= max_weapon_num; i++ )
{
weapon_name = tablelookup( "mp/statstable.csv", 0, i, 4 );
if( !isdefined( weapon_name ) || weapon_name == "" )
{
level.weaponIDs[i] = "";
continue;
}
level.weaponIDs[i] = weapon_name + "_mp";
// generating attachment combinations
attachment = tablelookup( "mp/statstable.csv", 0, i, 8 );
if( !isdefined( attachment ) || attachment == "" )
continue;
attachment_tokens = strtok( attachment, " " );
if( !isdefined( attachment_tokens ) )
continue;
if( attachment_tokens.size == 0 )
{
level.weaponIDs[attachment_num] = weapon_name + "_" + attachment + "_mp";
attachment_num++;
}
else
{
for( k = 0; k < attachment_tokens.size; k++ )
{
level.weaponIDs[attachment_num] = weapon_name + "_" + attachment_tokens[k] + "_mp";
attachment_num++;
}
}
}
// generating weaponNames array
level.weaponNames = [];
for ( index = 0; index < max_weapon_num; index++ )
{
if ( !isdefined( level.weaponIDs[index] ) || level.weaponIDs[index] == "" )
continue;
level.weaponNames[level.weaponIDs[index]] = index;
}
// generating weaponlist array
level.weaponlist = [];
assertex( isdefined( level.weaponIDs.size ), "level.weaponIDs is corrupted" );
for( i = 0; i < level.weaponIDs.size; i++ )
{
if( !isdefined( level.weaponIDs[i] ) || level.weaponIDs[i] == "" )
continue;
level.weaponlist[level.weaponlist.size] = level.weaponIDs[i];
}
// based on weaponList array, precache weapons in list
for ( index = 0; index < level.weaponList.size; index++ )
{
precacheItem( level.weaponList[index] );
println( "Precached weapon: " + level.weaponList[index] );
}
preacacheItem( "xsniper_mp" );
precacheItem( "frag_grenade_short_mp" );
precacheItem( "destructible_car" );
precacheModel( "weapon_rpg7_stow" );
precacheShellShock( "default" );
precacheShellShock( "concussion_grenade_mp" );
// thread maps\mp\_pipebomb::main();
// thread maps\mp\_ied::main();
thread maps\mp\_flashgrenades::main();
// thread maps\mp\_teargrenades::main();
thread maps\mp\_entityheadicons::init();
claymoreDetectionConeAngle = 70;
level.claymoreDetectionDot = cos( claymoreDetectionConeAngle );
level.claymoreDetectionMinDist = 20;
level.claymoreDetectionGracePeriod = .75;
level.claymoreDetonateRadius = 192;
level.C4FXid = loadfx( "misc/light_c4_blink" );
level.claymoreFXid = loadfx( "misc/claymore_laser" );
level thread onPlayerConnect();
level.c4explodethisframe = false;
}
Add _weapons.gsc to your mod.csv file as well:
Quote: rawfile,maps\mp\gametypes\_weapons.gsc
edited on Aug. 1, 2010 07:22 am by DemonSeed |
|
|
|
LiQ.HeaDShOt |
|
General Member Since: Jun 1, 2010 Posts: 51 Last: Feb 21, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Sunday, Aug. 1, 2010 11:36 am |
|
DemonSeed writes...Quote: No, you are getting confused - if the weapon is named xsniper_mp you have changed the name of the weapon - hence it isnt m403a_mp anymore. As such, xsniper_mp is a "new" weapon and wont be recognised by the game unless you tell it otherwise.
The game compiles all weapons from a CSV file (statstable.csv) when the game loads. If xsniper_mp isnt in it (and of course it isnt), then you need to compile the "new" weapon into your mod.ff file and precache it.
Add the weapon to your mod.csv file like I told you above.
You can precache your weapon in _weapons.gsc at the init() function:
Code: init()
{
// assigns weapons with stat numbers from 0-149
// attachments are now shown here, they are per weapon settings instead
// generating weaponIDs array
level.weaponIDs = [];
max_weapon_num = 149;
attachment_num = 150;
for( i = 0; i <= max_weapon_num; i++ )
{
weapon_name = tablelookup( "mp/statstable.csv", 0, i, 4 );
if( !isdefined( weapon_name ) || weapon_name == "" )
{
level.weaponIDs[i] = "";
continue;
}
level.weaponIDs[i] = weapon_name + "_mp";
// generating attachment combinations
attachment = tablelookup( "mp/statstable.csv", 0, i, 8 );
if( !isdefined( attachment ) || attachment == "" )
continue;
attachment_tokens = strtok( attachment, " " );
if( !isdefined( attachment_tokens ) )
continue;
if( attachment_tokens.size == 0 )
{
level.weaponIDs[attachment_num] = weapon_name + "_" + attachment + "_mp";
attachment_num++;
}
else
{
for( k = 0; k < attachment_tokens.size; k++ )
{
level.weaponIDs[attachment_num] = weapon_name + "_" + attachment_tokens[k] + "_mp";
attachment_num++;
}
}
}
// generating weaponNames array
level.weaponNames = [];
for ( index = 0; index < max_weapon_num; index++ )
{
if ( !isdefined( level.weaponIDs[index] ) || level.weaponIDs[index] == "" )
continue;
level.weaponNames[level.weaponIDs[index]] = index;
}
// generating weaponlist array
level.weaponlist = [];
assertex( isdefined( level.weaponIDs.size ), "level.weaponIDs is corrupted" );
for( i = 0; i < level.weaponIDs.size; i++ )
{
if( !isdefined( level.weaponIDs[i] ) || level.weaponIDs[i] == "" )
continue;
level.weaponlist[level.weaponlist.size] = level.weaponIDs[i];
}
// based on weaponList array, precache weapons in list
for ( index = 0; index < level.weaponList.size; index++ )
{
precacheItem( level.weaponList[index] );
println( "Precached weapon: " + level.weaponList[index] );
}
preacacheItem( "xsniper_mp" );
precacheItem( "frag_grenade_short_mp" );
precacheItem( "destructible_car" );
precacheModel( "weapon_rpg7_stow" );
precacheShellShock( "default" );
precacheShellShock( "concussion_grenade_mp" );
// thread maps\mp\_pipebomb::main();
// thread maps\mp\_ied::main();
thread maps\mp\_flashgrenades::main();
// thread maps\mp\_teargrenades::main();
thread maps\mp\_entityheadicons::init();
claymoreDetectionConeAngle = 70;
level.claymoreDetectionDot = cos( claymoreDetectionConeAngle );
level.claymoreDetectionMinDist = 20;
level.claymoreDetectionGracePeriod = .75;
level.claymoreDetonateRadius = 192;
level.C4FXid = loadfx( "misc/light_c4_blink" );
level.claymoreFXid = loadfx( "misc/claymore_laser" );
level thread onPlayerConnect();
level.c4explodethisframe = false;
}
Add _weapons.gsc to your mod.csv file as well:
Quote: rawfile,maps\mp\gametypes\_weapons.gsc
edited on Aug. 1, 2010 07:22 am by DemonSeed
Ok thx.
BTW, should I run the "makeMod" (batch file) to compile the mod.ff and create a new iwd file?
edited on Aug. 1, 2010 07:36 am by LiQ.HeaDShOt
I'm going out on holidays for 2 weeks so, if you have, please give me your xfire.
(my xfire: callofduty4hunter)
Thank you :D
|
|
|
|
DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
|
|
LiQ.HeaDShOt |
|
General Member Since: Jun 1, 2010 Posts: 51 Last: Feb 21, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Sunday, Aug. 1, 2010 02:57 pm |
|
DemonSeed writes...Quote: I think if you've never made a mod.ff file, you might as well use another way around the problem - simply re-name xsniper_mp to one of the assult rifles. As you dont use any of them, you might as well take advantage of them being in game memory anyway.
So, for example, rename the xsniper_mp weapon file to m4_mp.
Also, change the code to match.
THX! IT WORKED ;D ;D
I LOVE YOU ^^ |
|
|
|