[CSM]Basic Rallye Point System

Lots of cool and useful tips to mod either serverside or clientside
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

[CSM]Basic Rallye Point System

Post by Senshi »

I recently had the idea to try and implement a rallye point system as found in the BF2 mod Project Reality. Of course, it's not possible to do this squadwise (as BF42 has no squads), but teamwise.

Okay, basic aim:
Having a kit that can build a rallye point which then serves as a spawnpoint for the team and is destroyed after 60 seconds.
To make it a realistic asset, it will be implemented as pickup kit ONLY, the officer can only place one rally point total (Reloading not possible, magsize of 1). These limitations are necessary as a well placed spawnpoint behind enemy lines can be a devastating advantage: A single soldier can creep behind the enemy lines, set up this rally point, let dozens of others respawn and stage a large surprise attack on rear flags.

For this to work, you need to create a kit, a new handweapon, a new PCO, a new ObjectSpawnerTemplate and a Global Spawn Group. Yeah, sucks, but not that bad if you know what to do. I'll put the complete code up here, the important lines are commented with "<---"

First, the kit, probably the most easiest of all. Please don't be alarmed, I did this for Battlegroup42, but it works for every other mod or Vanilla too, obviously. (Objects\Items\GerKit\Offizier_Spawn\Objects.con)

Code: Select all

ObjectTemplate.create Kit Germanearly_Offizier_Spawn
ObjectTemplate.setType Assault
ObjectTemplate.setKitTeam 1
ObjectTemplate.geometry offizierkit
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.networkableInfo KitInfo
ObjectTemplate.addTemplate German_Helmet
ObjectTemplate.addTemplate German_hippack

ObjectTemplate.setHealthBarIcon "Ingame/Healthbar_empty_at_64x64.tga"
ObjectTemplate.setHealthBarFullIcon "Ingame/Healthbar_full_at_64x64.tga"
ObjectTemplate.addWeaponIcon "Weapon/icon_eliteknife.tga"
ObjectTemplate.addWeaponIcon "Weapon/icon_walterpp.tga"
ObjectTemplate.addWeaponIcon "Weapon/icon_empty.tga"
ObjectTemplate.addWeaponIcon "Weapon/icon_empty.tga"
ObjectTemplate.addWeaponIcon "Weapon/icon_nbhgr39.tga" <-- placeholder tga for the Spawner. can be replaced with whatever you want.
ObjectTemplate.addWeaponIcon "Weapon/icon_binoculars.tga"

ObjectTemplate.setKitIcon 2 "kits/offizier.dds"
ObjectTemplate.setKitName 2 "Offizier"
ObjectTemplate.setKitActiveName 2 "RESPAWN_ACTIVE_AT"

ObjectTemplate.addTemplate WalterPP
ObjectTemplate.addTemplate EliteKnife
ObjectTemplate.addTemplate Binoculars
ObjectTemplate.addTemplate Spawndrop1 <-- Just add our new handweapon here. My Rallypoint occupies weapon slot "5" so it's put here.

ObjectTemplate.aiTemplate Assault
2) Create the handweapon, now things are getting busy:
Basically, for the handweapon to work as intended, you need the weapon to shoot a projectile, the projectile (basically a mine) has an addtemplated objectspawnertemplate that will spawn your PCO that has the spawnpoint attached to it. Yes, that's quite a workaround ;) .
As I'm super lazy I just put step 2-5 in the same object.con (Objects\Items\Handweapons\Spawndrop\objects.con)

Code: Select all

ObjectTemplate.create HandFireArms Spawndrop1
ObjectTemplate.itemIndex 5
ObjectTemplate.networkableInfo HandFireArmsInfo
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.projectileTemplate SpawnDropProj
ObjectTemplate.magSize 1
ObjectTemplate.numOfMag 1 <--- Only one rallye point can be placed, everything else would be too imba
ObjectTemplate.magType 0
ObjectTemplate.reloadtime 10
ObjectTemplate.roundOfFire 1
ObjectTemplate.fireOnce 1
ObjectTemplate.AmmoType 6 <--- You can't "reload", once again to nerf this weapon.


ObjectTemplate.GUIIndex 13
ObjectTemplate.setHudAmmoType ATIconAndStrengthBar
ObjectTemplate.setAmmoIcon "Ammo/icon_gebladung.tga" <---Again, Placeholder, as I used the geballte Ladung as "base" for my spawner object.
ObjectTemplate.setCrossHairType CHTIcon

ObjectTemplate.setHasMag 0
ObjectTemplate.rotationalSpeed 2/0/0
ObjectTemplate.velocity 2
ObjectTemplate.fireInCameraDof 1
ObjectTemplate.hideDuringFireTime 3 <---- weapon will be "hidden" after being fired, denying use of another weapon after the rallye point has been placed
ObjectTemplate.fireDelay 5 <--- After you press Fire to deploy the rally point, it takes 5 seconds before the rallye point actually is placed 
ObjectTemplate.soldierCameraPosition 0/-0.03/0.2
ObjectTemplate.cantSelectWhenNoAmmo 1
ObjectTemplate.changeWeaponWhenNoAmmo 1

ObjectTemplate.createSkeleton animations/geballteLadung.ske <--- Again, this is placeholder stuff, the soldier is displayed carrying the geballte Ladung currently...put here whatever you want to use
ObjectTemplate.useSkeletonPartAsMain base
ObjectTemplate.addTemplate SpawnDropLod

ObjectTemplate.loadSoundScript Sounds/Spawndrop.ssc

ObjectTemplate.create AnimatedBundle SpawnDropComplex
ObjectTemplate.createSkeleton animations/geballteLadung.ske
ObjectTemplate.geometry geballteLadung

ObjectTemplate.create SimpleObject SpawnDropSimple
ObjectTemplate.geometry geballteLadung

ObjectTemplate.create LodObject SpawnDropLod
ObjectTemplate.lodselector HandWeaponLodSelector
ObjectTemplate.addTemplate SpawnDropComplex
ObjectTemplate.addTemplate SpawnDropSimple
3) The Projectile

Code: Select all

rem Shoot Projectile
ObjectTemplate.create Projectile SpawnDropProj
ObjectTemplate.createNotInGrid 1
ObjectTemplate.geometry Landmine
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.addTemplate Spawner_1Spawner <--- Important: Here we add the ObjectSpawnerTemplate to the Projectile.
ObjectTemplate.setPosition 0/-0.225/0
ObjectTemplate.setRotation 180/0/0
ObjectTemplate.timeToLive CRD_NONE/5.5/0/0 <--- This says the projectile will disappear after 5.5 seconds. The addtemplated spawner above has a spawndelay of 5 seconds, so it will spawn ONCE before the projectile dies, and with it the objectspawner. So only one rallye point will appear, after a 5 second delay
ObjectTemplate.gravityModifier 1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.invisible 1 <--- Making the projectile invisible, no one has too see that...
ObjectTemplate.material 230
ObjectTemplate.dieAfterColl 0
ObjectTemplate.drag 1.5
ObjectTemplate.mass 2000
4) The Spawnpoint Setup

Code: Select all

ObjectTemplate.create SpawnPoint SpawnDrop_1Spawner
ObjectTemplate.setSpawnRotation 0/0/0
ObjectTemplate.setSpawnPositionOffset 0/0/0
ObjectTemplate.setSpawnPreventionDelay 0
ObjectTemplate.setSpawnId 85 <---Choose a spawnID that 100% is NOT used by any regular spawns on the map (they usually count from 0-x, and few maps have over 85 spawnpoints ;) )
ObjectTemplate.setGroup 70 <---Choose a Spawngroup that 100% is NOT used by any other globalspawngroup!
ObjectTemplate.setEnterOnSpawn 0
ObjectTemplate.setAIEnterOnSpawn 0
ObjectTemplate.setSpawnAsParaTroper 0

rem *** SpawnGroup ***
SpawnPointManager.group 70
SpawnPointManager.groupteam 1
SpawnPointManager.groupIcon test2.tga
5) The Object Spawner Template

Code: Select all

ObjectTemplate.create ObjectSpawner Spawner_1Spawner
ObjectTemplate.setObjectTemplate 1 Spawner_1
ObjectTemplate.setObjectTemplate 2 Spawner_1
ObjectTemplate.holdObject 0
ObjectTemplate.SpawnDelayAtStart 1
ObjectTemplate.minSpawnDelay 5 <---Here you see, the spawndelay is set to "5". Combined with the "5.5" TimeTolive of the projectile -> One spawn.
ObjectTemplate.maxSpawnDelay 5
ObjectTemplate.timeToLive 0
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0.2/0 <--To make sure the spawner spawns above ground if the rally point is placed in tricky places.
ObjectTemplate.team 1
ObjectTemplate.MaxNrOfObjectSpawned 1
ObjectTemplate.damageWhenLost 0
6) The Rallye Point PCO

Code: Select all

ObjectTemplate.create PlayerControlObject Spawner_1
ObjectTemplate.setNetworkableInfo ProjectileInfo
ObjectTemplate.geometry rallye_m1 <--Choose whatever geometry you want to display the rally point. Project Reality uses a pile of backpacks, I used a Gulaschkanone ;) 
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 60 <-- Easy way to make sure the spawner is killed after 60 seconds. Give it 60 HP, set criticaldamage to 60 and make it lose 1 HP per second...I also chose this way to make it possible to destroy the rallye point by use of explosives. So no exploiting the spawnpoint by placing it in the middle of a firefight and happily spawning there all the time ;) .
ObjectTemplate.maxHitPoints 60
ObjectTemplate.criticalDamage 60
ObjectTemplate.hpLostWhileCriticalDamage 1
ObjectTemplate.addArmorEffect 30 e_PanzDamage 0/0.5/0 <---Cosmetics
ObjectTemplate.addArmorEffect 5 e_PanzFire 0/0.5/0
ObjectTemplate.mass 1000 <--- As I used a formerly static object, I had to give it some mass so it would properly sit on ground and it even can be pushed around by other vehicles properly.
ObjectTemplate.Material 45 <--- Regular light tank material to interact with terrain and other objects on collision
ObjectTemplate.GUIIndex 80
ObjectTemplate.setMinimapIcon "Minimap/minimap_icon_stationary_16x16.tga"
ObjectTemplate.setMinimapIconsize 0 <--- Rallye point is invisible on minimap :)
rem -----------------------------------------------
ObjectTemplate.addTemplate SpawnDrop_1Spawner <--Just adding 4 Spawners, so you spawn randomly around the rallyepoint. Good if multiple people are spawning at the same time. Add as many as you want...
ObjectTemplate.setPosition 0.5/0.2/0.5
ObjectTemplate.addTemplate SpawnDrop_1Spawner
ObjectTemplate.setPosition -0.5/0.2/-0.5
ObjectTemplate.addTemplate SpawnDrop_1Spawner
ObjectTemplate.setPosition 0.5/0.2/-0.5
ObjectTemplate.addTemplate SpawnDrop_1Spawner
ObjectTemplate.setPosition -0.5/0.2/0.5
ObjectTemplate.addTemplate SpawndropDamper <--- Had to add these as I used a formerly static object. These Dampers are basic springs defined in the physics.con to stop the object from "jiggling" around when placed and behaving more correctly
ObjectTemplate.setPosition 0.5/0.2/0.5
ObjectTemplate.addTemplate SpawndropDamper
ObjectTemplate.setPosition -0.5/0.2/-0.5
ObjectTemplate.addTemplate SpawndropDamper
ObjectTemplate.setPosition 0.5/0.2/-0.5
ObjectTemplate.addTemplate SpawndropDamper
ObjectTemplate.setPosition -0.5/0.2/0.5
rem -----------------------------------------------
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.timeToLive CRD_NONE/60/0/0
ObjectTemplate.explosionForceMod 2
ObjectTemplate.explosionRadius 0 <--- doesn't hurt anyone if it gets destroyed :) 
ObjectTemplate.explosionDamage 0
7) The Dampers I used to stabilize the rally point. very simple, actually. (Objects\Items\Handweapons\Spawndrop\Physics.con)

Code: Select all

ObjectTemplate.create Spring SpawndropDamper
ObjectTemplate.setNetworkableInfo SpringInfo
ObjectTemplate.geometry Harley_wheel <- unimportant, as next line states it is invisible anyway.
ObjectTemplate.createInvisible 1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Grip c_PGFRollGrip
ObjectTemplate.setStrength 25
ObjectTemplate.setDamping 7
If any questions remain or anyone tried this out successfully too, I'd be very happy to get feedback :) .
tanelorn
Posts: 42
Joined: Thu Oct 14, 2010 6:19 pm

Re: [CSM]Basic Rallye Point System

Post by tanelorn »

I use a similar concept to create a DPICM artillery strike. Only I attached an ammodump to the soldier kit that will reload the artillery call firearm a few seconds after the strike occurs. Sometimes it works, sometimes the game refuses to reload the weapon.
Tanelorn-Desert Combat Realism mod lead
DCR Website: http://www.tanelorn.us/dcr/pages/index.htm
DCR AI development: http://www.battlefieldsingleplayer.com/ ... opic=15529
DCR new features: http://bfmods.com/viewtopic.php?f=6&t=727
User avatar
Jimi Hendrix
Posts: 11
Joined: Sun Sep 12, 2010 4:53 am

Re: [CSM]Basic Rallye Point System

Post by Jimi Hendrix »

I'd like to give this a try.

Do you have this working on a map yet? Link please.

If you use a mine as a projectile, will this affect the Engineer Kit?



JH
8-)
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: [CSM]Basic Rallye Point System

Post by Senshi »

I have a working version for a battlegroup42 map in a small patchfile (no ssm, obviously). So it works, yes. And it's working in MP as well, no networkable errors.

It will only affect the engineer kit if you use the engineer mine. I only used the mine geometry.
tanelorn
Posts: 42
Joined: Thu Oct 14, 2010 6:19 pm

Re: [CSM]Basic Rallye Point System

Post by tanelorn »

Is there any reason why you couldn't give the weapon a long recharge time, equal to the life of the deployable spawn, so that you could repeatably use it? (similar to the BF2142 drop zone signal)?

Perhaps by using my technique of adding an ammo regenerator to my soldier kit. That is, if you can get around my hangup of the ammo restocking being unreliable...
Tanelorn-Desert Combat Realism mod lead
DCR Website: http://www.tanelorn.us/dcr/pages/index.htm
DCR AI development: http://www.battlefieldsingleplayer.com/ ... opic=15529
DCR new features: http://bfmods.com/viewtopic.php?f=6&t=727
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: [CSM]Basic Rallye Point System

Post by Senshi »

Of course you can use more ammo. I stated in the comments I made it only drop one so it isn't overpowered.

Another downside of multiple spawners: If you drop more than one spawnpoint simultanously, you still can only select one of them, as they share the same spawnpoingroup. This means you would be randomly spawned at one or the other of the rallyepoints.
You could prevent this by using a longer recharge time than the rallye point lives. So e.g. in my example where the rallye has a lifetime of 60 sec, use a recharge time of ~70.

Just increase the "magsize" and change the rateoffire.
tanelorn
Posts: 42
Joined: Thu Oct 14, 2010 6:19 pm

Re: [CSM]Basic Rallye Point System

Post by tanelorn »

Wouldnt there be an issue, though, of being stuck in the weapons reload anim if the round of fire is too long? I think there's some sort of downside if you have 60 second delay between shots...
Tanelorn-Desert Combat Realism mod lead
DCR Website: http://www.tanelorn.us/dcr/pages/index.htm
DCR AI development: http://www.battlefieldsingleplayer.com/ ... opic=15529
DCR new features: http://bfmods.com/viewtopic.php?f=6&t=727
User avatar
Jimi Hendrix
Posts: 11
Joined: Sun Sep 12, 2010 4:53 am

Re: [CSM]Basic Rallye Point System

Post by Jimi Hendrix »

I tested this on a custom BF1942 map.

Kit did not show up.

I added run items/items to the object.con in the objects folder.

Now this is a spawnable kit that you would pick up correct?

If so, how would i set up the ObjectSpawns/ObjectSpawnTemplates?

Also, ObjectTemplate.setKitIcon 2 "kits/offizier.dds" If i dont have this .dds file it wont work.

If i could look at a working version in a map & unpack it, i could figure it out.




:?:
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: [CSM]Basic Rallye Point System

Post by Senshi »

As said in the beginning, I did this for the BG42 mod...so of course you don't have all the geometry and texture files used in the code...

You don't have to use it as a spawnable kit. You can also place it in the init.con as a selectable kit for testing purposes.
User avatar
Jimi Hendrix
Posts: 11
Joined: Sun Sep 12, 2010 4:53 am

Re: [CSM]Basic Rallye Point System

Post by Jimi Hendrix »

Thanks for replying. Ill test it out and report back.



;)
Post Reply