PDA

View Full Version : Custom Weapons?


cyked
07-26-2010, 02:01 PM
Did someone ask for fully custom weapons?

They were a pain in the ♥♥♥ to figure out and required the modification of 20+ files. BUT I HAVE DONE IT

Look Here (http://dl.dropbox.com/u/3612697/WELANDEDONTHEMOOOOON.jpg)

Okrag
07-26-2010, 02:10 PM
Good Morning to you too.

TerabyteST
07-26-2010, 02:11 PM
Sexy.

Lockstock
07-26-2010, 02:33 PM
Did someone ask for fully custom weapons?

They were a pain in the ♥♥♥ to figure out and required the modification of 20+ files. BUT I HAVE DONE IT

Look Here (http://dl.dropbox.com/u/3612697/WELANDEDONTHEMOOOOON.jpg)

Seems awesome. Can you post a tutorial how you done it?

dragonx_fire
07-26-2010, 02:38 PM
Seems awesome. Can you post a tutorial how you done it?

Yes please, a tutorial would be much appreciated! :D

DuckSauce01
07-26-2010, 02:50 PM
I'm interested to hear(or read too).

In the meantime, here's how I done it:
1. Extract vpk files from steamapps/common/alien swarm/swarm
2. Grab equipment.res from the resource folder.
3. Put it in your mod's resource folder.
4. Adding it now seems to have no effect, for some reason the game will load the Alien Swarm's equipment.res(that's what happens for me anyway)
to fix: search equipment.res in your mod's solution(if you don't have that or don't know what to do, get a coder or become a coder :P) then rename what's needed to whatever you want, as long as it's not something already used, modname_equipment.res should do. Now rename the actual .res file the same.
5. Edit the .res file to include your weapon, delete existing weapons, or whatever.

-----

To change the text and stuff, have a coded weapon with it's own unique entity name(for example weapon_duckcannon), copy a weapon_xxx.txt from the alien swarm scripts folder(not in the vpk folder, but the steamapps folder), doesn't really matter which, whatever the weapon is close to. Then edit that to your needs and add the weapon(_duckcannon hurr durr) to the equipment.res

Partick Ruprech
07-26-2010, 03:06 PM
Anybody confirm the average poly count of the weapons in this game? The SDK model viewer tells me each weapon is about 5000 polys which blows my mind when they're only about 2% of your screen in game.

cyked
07-26-2010, 04:39 PM
I'm interested to hear(or read too).

In the meantime, here's how I done it:
1. Extract vpk files from steamapps/common/alien swarm/swarm
2. Grab equipment.res from the resource folder.
3. Put it in your mod's resource folder.
4. Adding it now seems to have no effect, for some reason the game will load the Alien Swarm's equipment.res(that's what happens for me anyway)
to fix: search equipment.res in your mod's solution(if you don't have that or don't know what to do, get a coder or become a coder :P) then rename what's needed to whatever you want, as long as it's not something already used, modname_equipment.res should do. Now rename the actual .res file the same.
5. Edit the .res file to include your weapon, delete existing weapons, or whatever.

-----

To change the text and stuff, have a coded weapon with it's own unique entity name(for example weapon_duckcannon), copy a weapon_xxx.txt from the alien swarm scripts folder(not in the vpk folder, but the steamapps folder), doesn't really matter which, whatever the weapon is close to. Then edit that to your needs and add the weapon(_duckcannon hurr durr) to the equipment.res

I am working on writing up a tutorial. It should be done tonight or tomorrow.

Thats an interesting way to go about the equiptment res file. The reason why it loads the ASW base equipment res file is beacuse it is paked in the VPK. to solve this you simply create your own VPK in your mods dir with the name pak01_dir (it has to be that and not pak01) in side the VPK you just need a resource folder with your res file in it.

Also, I am surprised that just adding it to the equipment res file works. I had to edit/add a lot more code to get mine to work

DuckSauce01
07-27-2010, 03:18 AM
The reason why it loads the ASW base equipment res file

Ah figures, now I just need to find out how to do that, it sounds very inconvenient though, why they'd do that is beyond me.

I don't really get how it decides to choose the .vpk anyway, it was after all just set to load from resource/equipment.res, why doesn't it look in standard first is well... also beyond me.

Corrn
07-27-2010, 11:48 AM
You had to change the medic gun right?

YoricksRequiem
07-27-2010, 06:22 PM
Looking forward to that tutorial, Cyked.

TheBogStandardU
07-27-2010, 06:36 PM
i absolutely LOL'D at the description of the gun

Tahknall
07-28-2010, 03:50 PM
I've made a custom mod_equipment.res file, and also changed the file requested in my asw_equipment_list.cpp file, but none of this seems to be helping. My partner and I have spent a good five hours combing through source code and trying every suggestion on the forums (like packing resources\equipment.res as a .vpk) but none of it has worked for us at all.

We're running out of ideas and I know there's people who come to these forums who know exactly what to do, yet so many are holding their tongues :P

What gives!?

dragonx_fire
07-28-2010, 06:42 PM
I've made a custom mod_equipment.res file, and also changed the file requested in my asw_equipment_list.cpp file, but none of this seems to be helping. My partner and I have spent a good five hours combing through source code and trying every suggestion on the forums (like packing resources\equipment.res as a .vpk) but none of it has worked for us at all.

We're running out of ideas and I know there's people who come to these forums who know exactly what to do, yet so many are holding their tongues :P

What gives!?

I know how you feel, I've been waiting on some sort of guide as well after some hours of digging about in the source :o

While we wait at least, out of curiosity what sort of custom weapon(s) are you and your partner trying for? I was hoping to toss together something to the effect of the chemical thrower from BioShock :cool: (perhaps making it a cross between the tesla cannon and the ice sentry since the game only allows for two firing modes)

cyked
07-28-2010, 07:30 PM
Ah figures, now I just need to find out how to do that, it sounds very inconvenient though, why they'd do that is beyond me.
They put all the files that they can in the VPK because it is MUCH faster to traverse through the VPK to look for files that it is to search through the dirs in the gameinfo.txt. This is why the load times are so fast. Without it, loads would take FOREVER

You had to change the medigun right
I did have to. I just did it as a test bc i wasnt sure if i could go over the number of weapons already it the game. turns out it works fine if you just add it as a new line. you just get 2 unlocks at that level.

Kilarai
07-28-2010, 07:35 PM
Anybody confirm the average poly count of the weapons in this game? The SDK model viewer tells me each weapon is about 5000 polys which blows my mind when they're only about 2% of your screen in game.

The character models are 9,000.. So I'm honestly not surprised. Head alone as a freaking sphere is 2,000. lol

shahrdar
07-28-2010, 09:55 PM
I've made a custom mod_equipment.res file, and also changed the file requested in my asw_equipment_list.cpp file, but none of this seems to be helping. What gives!?

Are you sure for this? I did the same things and succeeded in adding blink to my armory.

BugBusterAnon
07-28-2010, 10:57 PM
Can I get an instruction manual or something? Do other players see these custom guns? Does it look like I'm holding nothing? Do they need it to join me/me join them? What if I have it but someone else doesn't and I join them and equip it, will it even work?

I don't understand, could you EXPLAIN how these custom weapons work in game?

Tahknall
07-29-2010, 01:00 AM
Are you sure for this? I did the same things and succeeded in adding blink to my armory.

Are you sure you added blink? That should answer your question.

shahrdar
07-29-2010, 01:29 AM
Are you sure you added blink? That should answer your question.

Screen Shot (http://img641.imageshack.us/img641/2759/asijac1landingbaypract0.jpg)

BugBusterAnon
07-29-2010, 01:59 AM
Would very much like an explanation. Refer to my other post in this thread.

DuckSauce01
07-29-2010, 03:25 AM
Can I get an instruction manual or something? Do other players see these custom guns? Does it look like I'm holding nothing? Do they need it to join me/me join them? What if I have it but someone else doesn't and I join them and equip it, will it even work?

I don't understand, could you EXPLAIN how these custom weapons work in game?

Custom weapons would have to be coded, so you wouldn't be able to even play with anyone who doesn't have the same "mod" as you do because there'd be a mismatch with the client and/or server.dll's. So yes they will need the same client and server.dll's which have the custom weapon, there's no other way to get together at the same place to play, so your other questions are then immediatly answered.

And people, I'm assuming shahrdrar did what I said, so that's proof it works>.> No need to complicate things, as a test, try just removing equipment, instead of trying to add a custom weapon, just to ensure it works.

Tahknall
07-29-2010, 05:27 AM
What is the folder structure for your asw_equipment_list.cpp?

DuckSauce01
07-29-2010, 06:20 AM
What is the folder structure for your asw_equipment_list.cpp?

I didn't change anything except for this line:
if (kv->LoadFromFile(filesystem, "resource/equipment.res"))


to
if (kv->LoadFromFile(filesystem, "resource/byos_equipment.res"))

byos_equipment.res looks like this:

"Equipment"
{
// regulars
"Regular" "weapon_sword"

// extras
"Extra" "asw_weapon_medkit"
"Extra" "asw_weapon_normal_armor"
}


weapon_sword is currently just a renamed copy of asw_weapon_chainsaw.cpp

Tahknall
07-29-2010, 06:39 AM
We know that, but thank you for posting the examples for other people who did not. Where do you store the edited files in your addon folder?

shahrdar
07-29-2010, 09:48 AM
Here is a more detailed tutorial.

0. Do as DuckSauce01 said.

1. Put the renamed and edited equipment.res in yourModFolder/resource/

2. You have to put a weapon script into yourModFolder/scripts/ in case you added new weapons with new entity.

3. You can also edit yourModFolder/resource/yourModName_english.txt to add description to your new weapon.

shahrdar
07-29-2010, 10:03 AM
And here is a very noobish way to modify the flamer so that to have a freezing extinguisher.

1. Change following line in asw_weapon_flamer_shared.cpp

CASW_Extinguisher_Projectile::Extinguisher_Project ile_Create( vecSrc, QAngle(0,0,0),
newVel, rotSpeed, pMarine );


to


CASW_Extinguisher_Projectile *pProjectile = CASW_Extinguisher_Projectile::Extinguisher_Project ile_Create( vecSrc, QAngle(0,0,0),
newVel, rotSpeed, pMarine );

if ( pProjectile )
{
float flFreezeAmount = 1.0f + MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_FREEZE_DURATION);
pProjectile->SetFreezeAmount( flFreezeAmount );
}

Tahknall
07-29-2010, 10:04 AM
Here is a more detailed tutorial.

0. Do as DuckSauce01 said.

1. ...

Been there, way past that.

Besides, those files aren't what we're having issues with. Need to know where to place the asw_equipment_list.cpp file as I said.

I'm pretty sure I've tried every possible folder combination and I'm starting to suspect my file structure is some how different due to acquiring the client the minute it was available, I'm half tempted to uninstall and reinstall the entire thing for this magic fix everyone seems to have.

DuckSauce01
07-29-2010, 10:04 AM
addon

That explains some things. This is the mod forum after all and well I'm working on a mod, not add-on.

You asked folder structure of asw_equipment_list.cpp, but that sentence didn't make sense from my perspective, now I sorta see what you're getting at though, hence my seemingly unhelpfull reply.

Seems like shahrdar explains some missing parts, whether that'll work with add-ons, probably it will, up to you to figure that out.

Tahknall
07-29-2010, 10:11 AM
Yes, sadly I guess we're all still in the dark on how to get weapons and new gear put in through addons until Dalai can shed some light.

shahrdar
07-29-2010, 11:35 AM
Another thing I found useful is that we can spawn any entity using following function.
Don't ask me the difference with "operator new", I just found that they are using this instead of it.

CBaseEntity *CreateEntityByName( const char *className, int iForceEdictIndex = -1, bool bNotify = true );


For example, if we modify following line in asw_weapon_flamer_shared.cpp

if ( pMarine->GetWaterLevel() != 3 )
{
newVel *= FLAMER_PROJECTILE_AIR_VELOCITY;
newVel *= (1.0 + (0.1 * random->RandomFloat(-1,1)));
CASW_Flamer_Projectile::Flamer_Projectile_Create( GetWeaponDamage(), vecSrc, QAngle(0,0,0),
newVel, rotSpeed, pMarine, pMarine, this );

if (ASWGameRules())
ASWGameRules()->m_fLastFireTime = gpGlobals->curtime;

pMarine->OnWeaponFired( this, 1 );
}

to

if ( pMarine->GetWaterLevel() != 3 )
{
newVel *= FLAMER_PROJECTILE_AIR_VELOCITY;
newVel *= (1.0 + (0.1 * random->RandomFloat(-1,1)));
CASW_Flamer_Projectile::Flamer_Projectile_Create( GetWeaponDamage(), vecSrc, QAngle(0,0,0),
newVel, rotSpeed, pMarine, pMarine, this );

if (ASWGameRules())
ASWGameRules()->m_fLastFireTime = gpGlobals->curtime;

pMarine->OnWeaponFired( this, 1 );
}

//added codes
CASW_Weapon_Flamer* pFlamer = (CASW_Weapon_Flamer *)CreateEntityByName( "asw_weapon_flamer" );
pFlamer->SetOwnerEntity(pMarine);//prevents memory leak?
pFlamer->SetAbsOrigin( GetAbsOrigin()+vecAiming*300 );
pFlamer->Spawn();

we can have a flamer that spawns a flamer. This sounds ridiculous but we can create a flamer that makes firewalls in the same way.

Tahknall
07-29-2010, 12:01 PM
we can have a flamer that spawns a flamer. This sounds ridiculous but we can create a flamer that makes firewalls in the same way.
Or a flamer that allows us to spew unlit gasoline onto the ground to be lit on fire later, which is what I had originally expected the alt fire to do (instead of an extinguisher).

DuckSauce01
07-29-2010, 12:10 PM
Another thing I found useful is that we can spawn any entity using following function.
Don't ask me the difference with "operator new", I just found that they are using this instead of it.

CBaseEntity *CreateEntityByName( const char *className, int iForceEdictIndex = -1, bool bNotify = true );



This basically creates the entity in Valve's entity factory thingy, so it will get an index and will probably have a few other things done it, then you also destroy it in a non instant way(like delete would) without needing to create your own functions to do it. Not to mention network stuff to create/destroy can be handled.

I'm no expert on what exactly the benefits are, but Valve has had their reasons for it :P

DuckSauce01
07-29-2010, 02:23 PM
Only noticed this just now...

due to acquiring the client the minute it was available, I'm half tempted to uninstall and reinstall the entire thing for this magic fix everyone seems to have.

Do it.
Posted yesterday by Jonathan(one of the developers):
http://forums.steampowered.com/forums/showpost.php?p=16325335&postcount=16

Applies to mods, not addons, but point is, they've been updating a lot, so worth a shot!

hidesuru
08-04-2010, 06:49 PM
I am working on writing up a tutorial. It should be done tonight or tomorrow.

Thats an interesting way to go about the equiptment res file. The reason why it loads the ASW base equipment res file is beacuse it is paked in the VPK. to solve this you simply create your own VPK in your mods dir with the name pak01_dir (it has to be that and not pak01) in side the VPK you just need a resource folder with your res file in it.

Also, I am surprised that just adding it to the equipment res file works. I had to edit/add a lot more code to get mine to work

Did this tutorial ever get completed? I am looking into adding a few weapons to get started on an idea I have and this would be helpful. Thanks.

churche0
08-04-2010, 07:38 PM
what do u guys mean?

i thought ppl who want to play with u just copy the mod folder in their
C:\Program Files\Steam\steamapps\sourcemods
im prolly wrong though :>

and as Jonathan said u can get the cpp updates with a txt comparison tool

DuckSauce01
08-05-2010, 03:43 AM
i thought ppl who want to play with u just copy the mod folder in their
C:\Program Files\Steam\steamapps\sourcemods

Ofcourse and that will contain the needed .dll files, people can't launch Alien Swarm and play mod XXX if they aren't launching mod XXX though, that's the point.