For the memory i just write down what i have collected so far\tested could be done by server-side without client downloads. Could be useful for map-tests\hotfixes, or something like this...
NOTE!:
This is FORBIDDEN to use on public non-passworded PR servers. Server-side modding is only is only allowed on local\private\passworded servers.
Editing assets to spawn server-side.
With restricted access to server side modding in comparison to bf1942, we can not do so much tricks...
I. Some theory
The spawner system for assets in bf2 consisting from 2 parts - ObjectSpawnerTemplate's and ObjectSpawners itself.
- ObjectSpawnerTemplate is non-existant object in memory and it's a telling us what to spawn and when to spawn, aswell as some other params.
- ObjectSpawners in gpo files is usually invisible non-collision static objects existing in game world, they're calling ObjectSpawnerTemplate to be activated on their position.
II. Some practice.
Lets make a example of server-side training mod for muttrah.
Objectives:
- Move assets.
- Make more assets.
- Make all assets spawn faster.
- Deleting assets.
What we need is to change coordinates in ObjectSpawners(which is calling ObjectSpawnerTemplates). The task is simplified by the fact that we have only one cobra and one huey.
1. Lets move cobra on huey position first. We're starting from finding huey coordinates.
Open mods/pr/levels/muttrah_city_2/server.zip\gamemodes\gpm_cq\64\gameplayobjects.con
Find huey ObjectSpawnerTemplate by finding object template assigned to it, us_ahe_uh1nrockets in our case:
Now we need to find ObjectSpawner object that referring to our ObjectSpawnerTemplate.rem [ObjectSpawnerTemplate: cpname_muttrah_city_2_aas64_carrier_TransHeli2]
ObjectTemplate.create ObjectSpawner cpname_muttrah_city_2_aas64_carrier_TransHeli2
...some stuff...
ObjectTemplate.setObjectTemplate 2 us_ahe_uh1nrockets
...some stuff...
That's position and rotation of our ObjectSpawner. Bf2 uses x/y/z;yaw/pitch/roll position/rotation system relative from 0, center of map.rem [ObjectSpawner: cpname_muttrah_city_2_aas64_carrier_TransHeli2]
Object.create cpname_muttrah_city_2_aas64_carrier_TransHeli2
Object.absolutePosition 763.740/46.992/894.459
Object.rotation -154.341/0.000/0.000
Object.setControlPointId 1
Object.layer 3
Write down those coords somewhere.
Now lets find cobra ObjectSpawnerTemplate:
ObjectSpawnerTemplate - us_ahe_ah1z
ObjectSpawner - cpname_muttrah_city_2_aas64_carrier_AttakHeli
Write those coordinates too, and replace with huey ones.rem [ObjectSpawner: cpname_muttrah_city_2_aas64_carrier_AttakHeli]
Object.create cpname_muttrah_city_2_aas64_carrier_AttakHeli
Object.absolutePosition 839.930/46.992/776.396
Object.rotation -97.848/0.000/0.000
Object.setControlPointId 1
Object.layer 3
Now go into huey ObjectSpawner and replace it's coordinates with cobra ones.
Now we have cobra and huey spawn replaced.
EDIT: thanks to Ason for finding another way to replace vehicles.
This is possible only if we have both object templates and spawner templates loaded into client game memory.When you want to switch position of cobra and huey you can also just change the 'ObjectTemplate.setObjectTemplate 2 us_ahe_uh1nrockets'
to 'ObjectTemplate.setObjectTemplate 2 us_ahe_ah1z'.
The coordinates just means it will spawn an object of for example "cpname_muttrah_city_2_aas64_carrier_TransHeli2" on X,Z,Y. Most of the time you don't need to change the coordinates when you just want to switch two assets position.
2. Now we wanna have more and more mtlbs. There's 2 ways to do it.
First is to multiply ObjectSpawners - then we gonna have multiple spawn positions. So instead of:
We gonna have multiple instances of ObjectSpawners:...some stuff...
rem [ObjectSpawner: cpname_muttrah_city_2_aas64_southcity_apc_0]
Object.create cpname_muttrah_city_2_aas64_southcity_apc_0
Object.absolutePosition 92.706/39.368/-910.191
Object.rotation -20.951/0.000/0.000
Object.setControlPointId 205
Object.layer 3
...some stuff...
Notice the difference in Y - height coordinates, mtlb's gonna spawn 10, 20, 30 meters high that our stock mtlb. This is just for educational purposes, for actual coordinates you either need good imagination for calculating coordinates in your brain, or need to load up in editor, place some gpo's and find their coordinates. Or use python+PIL.rem [ObjectSpawner: cpname_muttrah_city_2_aas64_southcity_apc_0]
Object.create cpname_muttrah_city_2_aas64_southcity_apc_0
Object.absolutePosition 92.706/39.368/-910.191
Object.rotation -20.951/0.000/0.000
Object.setControlPointId 205
Object.layer 3
rem [ObjectSpawner: cpname_muttrah_city_2_aas64_southcity_apc_0]
Object.create cpname_muttrah_city_2_aas64_southcity_apc_0
Object.absolutePosition 92.706/49.368/-910.191
Object.rotation -20.951/0.000/0.000
Object.setControlPointId 205
Object.layer 3
rem [ObjectSpawner: cpname_muttrah_city_2_aas64_southcity_apc_0]
Object.create cpname_muttrah_city_2_aas64_southcity_apc_0
Object.absolutePosition 92.706/59.368/-910.191
Object.rotation -20.951/0.000/0.000
Object.setControlPointId 205
Object.layer 3
rem [ObjectSpawner: cpname_muttrah_city_2_aas64_southcity_apc_0]
Object.create cpname_muttrah_city_2_aas64_southcity_apc_0
Object.absolutePosition 92.706/69.368/-910.191
Object.rotation -20.951/0.000/0.000
Object.setControlPointId 205
Object.layer 3
Second way to spawn more objects in one position is to add multiply parameter into ObjectSpawnerTemplate:
Where 5 is number of objects that will be spawned.ObjectTemplate.maxNrOfObjectSpawned 5
Keep in mind that if this number is greater than 1(or line non-exist like in 98% of spawners in pr), then spawn time is starting ticking right after object has moved from it's spawn position.
So of we gonna have 5 cobras, you will have to move one from spawn place, and wait another 15 minutes.
For example on std muttrah check boats, they have 120 seconds spawntime and 5 objects to spawn.
3. Making assets spawn faster.
In this case we just modifying parameters in ObjectSpawnerTemplate:
When number is representing spawntime in seconds.ObjectTemplate.minSpawnDelay 300
ObjectTemplate.maxSpawnDelay 300
4. Deleting assets.
Lets say we wanna delete cobra.
No need to delete ObjectSpawnerTemplate as it's loaded into memory of both clients and server.
Instead, we're deleting ObjectSpawner, so cobra could be spawned - but we're not telling clients to spawn it.
In gameplayobjects.con file just delete those lines, and meet new gameplay without cas whores.rem [ObjectSpawner: cpname_muttrah_city_2_aas64_carrier_AttakHeli]
Object.create cpname_muttrah_city_2_aas64_carrier_AttakHeli
Object.absolutePosition 839.930/46.992/776.396
Object.rotation -97.848/0.000/0.000
Object.setControlPointId 1
Object.layer 3




