Page 1 of 2

[Coding] Opticless kits for custom maps

Posted: 2015-03-24 13:45
by rPoXoTauJIo
Ason wrote:I'm trying to edit the kits on the map to only include the "_alt" versions without scopes.
...
rPoXoTauJIo wrote:...
So sorry Ason, it's not possible in this version. Guess we have to ask dev's to include "iron only" version of factions for a next version.
[R-DEV]Mats391 wrote:Russians. For example the Russians do not use a _ziptie variant yet. For that you just need to create new faction that is called ru_ziptie and create all the kits you want with _ziptie suffix.
Seems like Mats were right with this idea, dunno what i made wrong previous time... :o ops:

=========================================================
Recently during my experiments i found a way to do custom kits on maps with some factions. However, it will require to disable kits customization for spawnscreen, and use only one version there. Kits from apcs\crates\etc still will be different through.
Image

So, the guide:
PR init system for custom factions like paradrop\ziptie\night versions are represented by having "custom" factions for such layouts. As kits on spawnscreen is controlled by kit customization and python, we need to get rid of those.

1)First of all, we need to determine, which "faction variant" we gonna use.
Available variants:

Code: Select all

variantsKits = [
    'nvg',
    'ziptie',
    'md',
    'sp',
    'pickup',
    'night']
To find out what you need, browse into: mods/pr/content/objects_common_server.zip/kits/faction/
Now look which one variant is not in your kits - that one we gonna use.
Example - 'ru' faction dont have '_ziptie' kits, so we gonna use this variant.

2) Now lets create a opticless kits for our new faction.
Create folder kits/ru in your mapfolder, and copy all ru_<kit>_night.con kits here, for example.
Rename all of them to ru_<kit>_ziptie.con
Now open them and, rename kit inside:

Code: Select all

...from
 ObjectTemplate.create Kit ru_aa_night
 ...to...
 ObjectTemplate.create Kit ru_aa_ziptie
And change main weapons in those kits:

Code: Select all

...from
 ObjectTemplate.addTemplate rurif_ak74mscopegl
 ..to
 ObjectTemplate.addTemplate rurif_ak74mgl
And such on. For sure result on ru faction it is best to just copy all content from normal ru_<kit>.con's and their _alt versions, and then just change main weapons.

3) Now put kits into objects_server.zip in your mapfolder.

4) Now lets change init system.
Open mods/pr/content/factions_server.zip and extract spawners folder and faction_init.con into your mapfolder.
Open faction_init.con and "rem" those lines:

Code: Select all

...
 run ../menu/HUD/HudSetup/Customization/HudCustomizationReset.con
 ...
 run ../menu/HUD/HudSetup/Customization/HudCustomization.con v_arg1 v_arg2
 ...
And create "new" faction:

Code: Select all

...
 elseIf v_arg2 == "ru_ziptie"
     gameLogic.setTeamName v_arg1 "RU"
     gameLogic.setTeamLanguage v_arg1 "RU"
     gameLogic.setTeamFlag v_arg1 "flag_ru"
     gameLogic.setKit v_arg1 0 "ru_officer_ziptie" "pr_ru_soldier4"
     gameLogic.setKit v_arg1 1 "ru_assault_ziptie" "pr_ru_soldier1"
     gameLogic.setKit v_arg1 2 "ru_rifleman_ziptie" "pr_ru_soldier3"
     gameLogic.setKit v_arg1 3 "ru_support_ziptie" "pr_ru_soldier3"
     gameLogic.setKit v_arg1 4 "ru_specialist_ziptie" "pr_ru_soldier1"
     gameLogic.setKit v_arg1 5 "ru_medic_ziptie" "pr_ru_soldier2"
     gameLogic.setKit v_arg1 6 "ru_riflemanat_ziptie" "pr_ru_soldier2"
     run spawners/spawners_ru_ziptie.con
 ...
Lets not forget about spawners.
Navigate into spawner folder, and copy spawners_ru_night.con, and rename it to spawners_ru_ziptie.con.
Then just do a mass-replace from _night to _ziptie

5) Now put create factions folder in your mapfolder, and put spawners folder and faction_init.con there, and pack factions folder into your server.zip

6) Now lets fix init.con...:

Code: Select all

...from
 run ../../Factions/faction_init.con 1 "chinsurgent"
 run ../../Factions/faction_init.con 2 "ru"
 to...
 run Factions/faction_init.con 1 "chinsurgent"
 run Factions/faction_init.con 2 "ru_ziptie"
NOTE: Ofc, best "practice" is to create custom content zips for such kind of stuff, but i put factions inside server.zip for education purposes. Anyone who understand what i'm writing in this thread should be able to put Factions into seperate zip.

7) And dont forget about custom content in serverarchives.con

Code: Select all

fileManager.mountArchive Levels/map/objects_server.zip Objects
For ingame testing use:

Code: Select all

 rcon debug
 rcon debug kits
You'll be able to see some debug output, which include information, which kit are you using.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 15:48
by Insanitypays
It may be more realistic for Russia to only be able to spawn with irons and have to use request kits in order to get optics. (Most people prefer irons with the ak74 anyways)

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 15:51
by rPoXoTauJIo
Well, i just used russians as example.
The whole point to this guide is that we can create "factions" with needed kits to those which still have spare variants.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 16:22
by Mats391
Darn it, i actually wanted to do it for Grozny but forgot. Good that you made it :)
Some things tho:
Your new factions.init does need to contain all factions, just the one you want to use. Then you can just init those with

Code: Select all

 run ../../factions/faction_init.con 1 "chinsurgent"
 run factions/faction_init.con 2 "ru_ziptie"
and it will use normal militia (chinsurgent) faction. Just one thing less to worry about.
You really should make a own factions_server.zip and mount that one tho. But then you have to call the file something else or it will override PR ones for this map. So name it something like "factions_init_noscope.con" and pack it into factions_server.zip. Dont forget to mount your factions_server.zip!

Code: Select all

fileManager.mountArchive Levels/map/factions_server.zip Factions
The init paths then change to

Code: Select all

 run ../../factions/faction_init.con 1 "chinsurgent"
 run ../../factions/faction_init_noscope.con 2 "ru_ziptie"
This way you can also make entirely new factions, but you will have to provide updated realityconfig_private.py then. You can also override factions so you wouldnt even have to use the _ziptie approach. Mounting the kits should overwrite those as well.

Also spawn screen customization will work, it is just a pain to do by hand. We generate those with scripts, the rest is just a matter of mounting correct files and changing the paths. With purely ironsight factions you wont have much customization tho.
rPoXoTauJIo wrote:

Code: Select all

variantsKits = [
    'nvg',
    'ziptie',
    'md',
    'sp',
    'pickup',
    'night']
That looks awefully close to the list we have in the compiled python files :p

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 17:00
by rPoXoTauJIo
[R-DEV]Mats391 wrote: That looks awefully close to the list we have in the compiled python files :p
:D
No worries, i'm lurking stuff there only for educational purposes.
[R-DEV]Mats391 wrote: Also spawn screen customization will work, it is just a pain to do by hand. We generate those with scripts, the rest is just a matter of mounting correct files and changing the paths. With purely ironsight factions you wont have much customization tho.
Well, from WOF experience i can tell that BF2 going full retard if it's not first round for a client, and there might be a conflicts with overwriting menu stuff for custom maps.
Another subject to test :)

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 17:19
by Rabbit
tbh I think this would just make a killer gamemode.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 17:34
by rPoXoTauJIo
[R-DEV]Rabbit wrote:tbh I think this would just make a killer gamemode.
You're DEV, suggest _alt factions to DEV's, so DEV's can DEV while DEVing killer gamemodes :D

I also would like to request auto-limiting vehicles variants(i.e. gb_chinook_alt or smth) to limited kits, but this is out of question of this thread :)

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 17:41
by Rabbit
Problem is DEV's are busy DEVing so its hard for DEVs to DEV on other DEV things.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 17:43
by Mineral
shut your DEV-hole rabbit. Go dev a map

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 17:56
by temexter
Wat is all dis DEV sorcery :shock:

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-24 18:25
by Rabbit
I am! I am! I am DEVing right now!

Posted: 2015-03-24 18:34
by Amok@ndy
Stopped DEVing just to read this

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-25 10:36
by mries
There is DEVinitely something going on here...

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-25 11:45
by Arab
Image

Re: [Coding] Opticless kits for custom maps

Posted: 2015-03-25 12:53
by sweedensniiperr
It could really be good to have opticless kits on some maps. Iron ridge and fool's road comes to mind.
mries wrote:There is DEVinitely something going on here...
That was terrible

Posted: 2015-03-29 06:04
by Insanitypays
mries wrote:There is DEVinitely something going on here...
Im upset...

Re: [Coding] Opticless kits for custom maps

Posted: 2015-04-05 00:34
by rPoXoTauJIo
Some update on this. Seems like current method is suffering from the same bug as i had on WOF, bf2 doesn't reload hud after previous round.
NOTICE: this bug is only graphical bug, the soldiers are still spawning with proper kits.
Current situation

However, it is passable by re-loading HUD in our custom map. Currently kits customization is working by putting ALL menu nodes from all factions on spawn screen and moving them around(-100 -100, on screen etc).
So our task would be to still load kits customization, but have it replaced for some(our new faction) kits.

1. Grab hud\hudsetup\customization folder from content/menu_server.zip
2. Put it inside server.zip
3. Fix factions/faction_init.con (un-rem kits customization files)
4. Add new faction in menu files. (ru_ziptie in our case)
5. In hud\hudsetup\customization\kits\ru\ru_ziptie_X.con fix picture in HUD node ru_ziptie_KitX ru_ziptie_KitX_StdImg. Do this for all _ziptie kits.

Result is: http://i.imgur.com/N47pK1X.jpg

As you can see, weapons are now working properly even if it's not first map load for a client, except last kit, i'm currently investigating why this happens.
Still, soldier is spawning with proper kit.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-04-07 11:21
by Arab
This is a great job you are doing! Well done, and interesting to know that you found a way to run maps with no optics, which would really be nice for the hardcore players.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-04-07 12:05
by rPoXoTauJIo
Still fuck that shit, HUD stuff in bf2 is even worse than any server-side modding. Python ftw is a lot more interesting.

Re: [Coding] Opticless kits for custom maps

Posted: 2015-04-07 12:41
by Mats391
Could you send me a map that you set up with all the stuff you did already? Would look into fixing the spawn menu stuff then.