Custom Weapon

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
darkpheonixz4x
CJ Newbie
CJ Newbie
Posts: 51
Joined: July 2nd, 2012, 11:15 am

Custom Weapon

Post by darkpheonixz4x » November 5th, 2012, 4:28 pm

Hello,

I wanted to use a custom weapon in my map and i need help.

I downloaded a BlackOps weapon from www.cfgfactory.com
This was a .rar, which included all the rawfiles (xmodel,materials,images,WEAPONFILE etc.)

So this was what i did.

1) Merged the raw files with my raw folder.
2) Since the weapon files were given in the folder WEAPONFILE, i took them and put them in raw/weapons/mp/
3) Added all the given images file into my map's .iwd
4) Updated my .csv (There was a .txt file that had everything that was needed to be added)
5) Finally, i made a trigger use in map with the following script.

Code: Select all

main()
{
 PreCacheItem("_bo_l96_vz_mp");
 thread test1();
}

test1()
{
 trig = getent("test1_trig","targetname")
{
 trig waittill ("trigger");
 PreCacheItem("_bo_l96_vz_mp");
 self SwitchToWeapon("_bo_l96_vz_mp");
 self GiveWeapon("_bo_l96_vz_mp");
}
}
After testing, I got the following error:
"Could not open weapon file "_bo_l96_vz_mp"!"

So i have some questions.

a) I didn't really follow any tuts, so is my process in using a custom weapon for my map right?
b) What did i do wrong, and how do i fix the error?

If you would like to see anything, please feel free to ask.
Any sort of help is appreciated.

Thanking you in advanced,
darkpheoniz4x.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Custom Weapon

Post by Drofder2004 » November 5th, 2012, 4:58 pm

Put all relevant files inside your maps IWD file.

Also, all "preCache" events must take palce at the start of your script, your trigger should target the person who triggered it and you must give the player the weapon before you switch to it.

Code: Select all

main()
{
   precacheItem("_bo_l96_vz_mp");
   thread test1();
}
 
test1()
{
   trig = getent("test1_trig","targetname")
   trig waittill ("trigger", user);
   user GiveWeapon("_bo_l96_vz_mp");
   user SwitchToWeapon("_bo_l96_vz_mp");
}
Also, your CSV must contain the "weapon, mp/_bo_l96_vz_mp"
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

darkpheonixz4x
CJ Newbie
CJ Newbie
Posts: 51
Joined: July 2nd, 2012, 11:15 am

Re: Custom Weapon

Post by darkpheonixz4x » November 5th, 2012, 5:28 pm

Thanks for your fast reply.

I did what you said and the map loaded successfully.

But the problem now is that my gun switches to the "default weapon".

So any ideas what i should do? Would you like to see/know anything?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Custom Weapon

Post by Drofder2004 » November 5th, 2012, 8:04 pm

I honestly do not know much about custom weapons.

My only suggestion is to do "/developer 1" in console before loading the map and then open the full console and check for any errors (most likely in Red or Yellow).
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests