Yes a bit of searching would have prevented you from having to post this. However since I'm here and am well versed in
AP mines, I currently use a new simpler method for getting them to work and unlike the previous method, this shouldn't require nearly a page worth of text to explain it. In simple terms, you addTemplate a objectspawner directly to the soldier object and using the HoldObject command on the spawner, it holds an invisible dummy PCO that follows the soldier whereever he goes. This invisible PCO is what sets off the
mines!
Claymore projectile as I currently have it coded:
Code: Select all
ObjectTemplate.create Projectile NewClaymoreProjectile
ObjectTemplate.networkableInfo ProjectileInfo
ObjectTemplate.geometry claymore_PRJ_m1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.invisibleAtEndEffect 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 1
ObjectTemplate.maxHitPoints 1
ObjectTemplate.explosionDamage 0
ObjectTemplate.timeToLive CRD_NONE/560/0/0
ObjectTemplate.dieAfterColl 0
ObjectTemplate.radius 6
ObjectTemplate.ForceOnExplosion 7
ObjectTemplate.explodeNearEnemyDistance 4
ObjectTemplate.proximityFusePrimer 5
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.useMMOnEndEffect 1
ObjectTemplate.mass 20
ObjectTemplate.material 70
ObjectTemplate.material2 855
ObjectTemplate.damageType 4
ObjectTemplate.endEffectTemplate e_ExplGranade
ObjectTemplate.noFFSound 1
ObjectTemplate.projectileType 1
ObjectTemplate.addToProjectileList 1
Make sure the projectile has a mass lower then your target PCO. If it's higher, then it won't go off. (this is why vehicle landmines shouldn't go off with this system as they have a mass value higher then the dummy PCO I've created)
Coding for invisible PCO. Does not need a mesh tied to it. However do make sure it has mobile physics and collision physics enabled or else
mines will ignore it:
Code: Select all
NetworkableInfo.createNewInfo MineTriggerInfo
NetworkableInfo.setPredictionMode PMLinear
NetworkableInfo.createNewInfo DummyEngineInfo
NetworkableInfo.setPredictionMode PMLinear
rem *** Needed for HoldObject command to work. ***
ObjectTemplate.create Engine DummyEngine
ObjectTemplate.setNetworkableInfo DummyEngineInfo
ObjectTemplate.setAttachToListener 1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/-100
ObjectTemplate.setMaxRotation 0/0/100
ObjectTemplate.setMaxSpeed 0/0/100
ObjectTemplate.setAcceleration 0/0/1000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETCar
ObjectTemplate.setTorque 0
ObjectTemplate.setDifferential 0
ObjectTemplate.setNumberOfGears 1
ObjectTemplate.create ObjectSpawner SoldierMineTrigger
ObjectTemplate.setObjectTemplate 0 SoldierMineTriggerPCO
ObjectTemplate.minSpawnDelay 3
ObjectTemplate.maxSpawnDelay 3
ObjectTemplate.timeToLive 5
ObjectTemplate.distance 10
ObjectTemplate.setTeam 0
ObjectTemplate.damageWhenLost 0
ObjectTemplate.maxNrOfObjectSpawned 1
ObjectTemplate.resetWhenRemoved 1
ObjectTemplate.holdObject 1
ObjectTemplate.create PlayerControlObject SoldierMineTriggerPCO
ObjectTemplate.setNetworkableInfo MineTriggerInfo
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.explosionForceMod 0
ObjectTemplate.drag 0
ObjectTemplate.mass 30
ObjectTemplate.explosionRadius 0
ObjectTemplate.explosionDamage 0
ObjectTemplate.hasArmor 1
ObjectTemplate.hitpoints 2
ObjectTemplate.maxhitpoints 2
ObjectTemplate.criticalDamage 1
ObjectTemplate.hpLostWhileCriticalDamage 1
ObjectTemplate.hpLostWhileUpSideDown 0
ObjectTemplate.hpLostWhileDamageFromWater 1
ObjectTemplate.fadeAtTimeToLiveAfterDeath 0
ObjectTemplate.damageFromWater 1
ObjectTemplate.material 0
ObjectTemplate.timeToLiveAfterDeath 0.1
ObjectTemplate.setMinimapIcon "Empty.dds"
ObjectTemplate.addToCollisionGroup c_CGProjectiles
ObjectTemplate.addToCollisionGroup c_CGLandScape
ObjectTemplate.addToCollisionGroup c_CGStaticObjects
rem -------------------------------------
ObjectTemplate.addTemplate DummyEngine
Then addTemplate the spawner for this PCO to the soldier object. There's two ways of doing this. Via the active command or directly to the soldier in the objects.rfa folder. If you do it directly make sure that it's the LAST addTemplate entry. DON'T place it in the commonsoldierdata.inc file! It won't be in the right place. The order of the child objects for soldiers is special. If you don't make this the last child object you will have issues with the spawner only working in 3p mode or 1p mode and not both, which would not be good. If using the active command, you don't need to worry about this. Just note that the active command must be executed from somehwere in staticobjects.con or one of the game mode con files as that's the only place active commands work in a map side mod. I'll show you the active command method of adding the spawner. FYI, DesertCombat still have the
AP mine handweapon, they just removed it from the kits after the 1.4/1.5 game update that prevented from
mines going off on soldiers a while back. So you can look at that for reference if you need to. After using this special PCO, the DC handweapon should operate without any modification needed so long as the mass of the dummy pco is higher then the mine.
Code: Select all
ObjectTemplate.active USSoldier
if v_arg1 == host
ObjectTemplate.addTemplate SoldierMineTrigger
ObjectTemplate.setPosition 0/2/0
else
endIf
I usually use the if v_arg1 stuff when adding spawners to things. I find it the most stable way of adding spawners that will be stable in multiplayer.
The dummy PCO works best when the spawner is added 2 meters high.
The mine will then go off on soldiers as if they were a vehicle. Since this system I created no longer makes use of PCOs and death bubbles, explosion effects work in multiplayer and you get 100% kill credit with the kill weapon specified in the kill message. You can even "sneak" past enemy
mines by crouching/walking slow or proning past the
mines, since they will only go off if you run while in their detection radius.
Hopefully this should help you with this.