Need help with custom objects in map

Give a clear description of what you need and maybe Santa will deliver
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Post by freddy »

perhaps this this can help

Code: Select all

ObjectTemplate.EnableRadarMode 1
http://bfmods.com/mdt/scripting/ObjectT ... rMode.html
User avatar
Psycho
Posts: 125
Joined: Thu Aug 25, 2011 3:31 am

Re:

Post by Psycho »

freddy wrote:perhaps this this can help

Code: Select all

ObjectTemplate.EnableRadarMode 1
http://bfmods.com/mdt/scripting/ObjectT ... rMode.html
Allready tried that, though it only change the way the sonarobject works. And I can't get to work at all.
It would be possible that its related to som bug or limitation, since my map are quite wast.

For example I had to remove animated flags on the big ships after adding a siren to them, or the flags texture sort of got stuck to the player.
I want to live in a created universe. Virtual reality, here I come.
User avatar
Psycho
Posts: 125
Joined: Thu Aug 25, 2011 3:31 am

Re: Need help with custom objects in map

Post by Psycho »

Made this to be able to spawn objects from a vehicle. The thing is that I want the created spawn point to settle on ground before the object spawns. But when using "ObjectTemplate.SpawnDelayAtStart 10" it have no effect. Anybody know why?

Here is the code:

Code: Select all

rem *** Pak40Launcher***
ObjectTemplate.create FireArms Pak40Launcher
ObjectTemplate.setNetworkableInfo PlaneFireArmInfo
ObjectTemplate.aiTemplate SupplyboxGunAI
ObjectTemplate.projectileTemplate Pak40SpawnProjectile
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize 1
ObjectTemplate.numOfMag 999
ObjectTemplate.velocity 0
ObjectTemplate.autoReload 1
ObjectTemplate.reloadtime 60
ObjectTemplate.roundOfFire 1
rem ObjectTemplate.setInputFire c_PIAltFire
ObjectTemplate.addFireArmsPosition 0/0/0 0/0/0
ObjectTemplate.AmmoType	10


rem *** Pak40SpawnProjectile***
ObjectTemplate.create Projectile Pak40SpawnProjectile
ObjectTemplate.geometry Ammobox_m1
ObjectTemplate.hasDynamicShadow 1 
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 0
ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.invisibleAtEndEffect 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 100
ObjectTemplate.maxHitPoints 100
ObjectTemplate.explosionDamage 0
ObjectTemplate.timeToLive CRD_NONE/20/0/0
ObjectTemplate.gravityModifier 100
ObjectTemplate.dieAfterColl 0
ObjectTemplate.radius 0
ObjectTemplate.material 70
ObjectTemplate.noFFSound 1
ObjectTemplate.mass 50
ObjectTemplate.drag 30
rem -------------------------------------

ObjectTemplate.addTemplate Pak40Spawner

rem -------------------------------------


rem *** Pak40Spawner ***
ObjectTemplate.create ObjectSpawner Pak40Spawner
ObjectTemplate.setObjectTemplate 1 Pak40 
ObjectTemplate.setObjectTemplate 2 Pak40
ObjectTemplate.holdObject 1
ObjectTemplate.minSpawnDelay 20
ObjectTemplate.maxSpawnDelay 20
ObjectTemplate.SpawnDelayAtStart 10
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2
ObjectTemplate.MaxNrOfObjectSpawned 1
ObjectTemplate.damageWhenLost 10
I want to live in a created universe. Virtual reality, here I come.
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Post by freddy »

i think that code is only delay for when the round starts. instead of a projectile you could use some object that breake when it hit ground and use a effect as a spawner
User avatar
Psycho
Posts: 125
Joined: Thu Aug 25, 2011 3:31 am

Re:

Post by Psycho »

freddy wrote:i think that code is only delay for when the round starts. instead of a projectile you could use some object that breake when it hit ground and use a effect as a spawner
That sounds intresting. As long the object doesen't destroys directly. since it have to seattle on ground so the cannon will be correctly aligned to the ground.

But this means I have to use a object instead for a projectile in the firearms script?

oh, wait. Can I add a effect to the projectile instead for the spawner and when the effect happens the spawner starts?
ObjectTemplate.timeToLive CRD_NONE/5/0/0 on the projectile object, and when it vanish the effects start and creates the spawner?
I want to live in a created universe. Virtual reality, here I come.
User avatar
Psycho
Posts: 125
Joined: Thu Aug 25, 2011 3:31 am

Re: Need help with custom objects in map

Post by Psycho »

something like this?

Code: Select all

rem *** AT25SpawnProjectile***
ObjectTemplate.create Projectile AT25SpawnProjectile
ObjectTemplate.geometry Ammobox_m1
ObjectTemplate.hasDynamicShadow 1 
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.setHasPointPhysics 1
ObjectTemplate.hasCollisionEffect 1
ObjectTemplate.invisibleAtEndEffect 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 10
ObjectTemplate.maxHitPoints 10
ObjectTemplate.explosionDamage 0
ObjectTemplate.timeToLive CRD_NONE/20/0/0
ObjectTemplate.gravityModifier 1
ObjectTemplate.dieAfterColl 0
ObjectTemplate.radius 0
ObjectTemplate.material 70
ObjectTemplate.noFFSound 1
ObjectTemplate.mass 50
ObjectTemplate.drag 30
rem -------------------------------------

ObjectTemplate.addArmorEffect 0 em_AT25SpawnDamage 0/0/0

rem -------------------------------------

rem *** em_AT25SpawnDamage ***
ObjectTemplate.create EffectBundle em_AT25SpawnDamage
ObjectTemplate.saveInSeparateFile 1
rem -------------------------------------
ObjectTemplate.addTemplate AT25Spawner
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.timeToLive CRD_NONE/20/0/0
rem -------------------------------------

rem *** AT25Spawner ***
ObjectTemplate.create ObjectSpawner AT25Spawner
ObjectTemplate.setObjectTemplate 1 AT25 
ObjectTemplate.setObjectTemplate 2 AT25
ObjectTemplate.holdObject 1
ObjectTemplate.minSpawnDelay 20
ObjectTemplate.maxSpawnDelay 20
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2
ObjectTemplate.MaxNrOfObjectSpawned 1
ObjectTemplate.damageWhenLost 10
This of course didn't work, but something in line with this maybe?
I want to live in a created universe. Virtual reality, here I come.
User avatar
Psycho
Posts: 125
Joined: Thu Aug 25, 2011 3:31 am

Re: Need help with custom objects in map

Post by Psycho »

Here is another try, that resulted in a FPS of 0,001 when I pressed fire hehehe. And wanted effect didnt happen.

Code: Select all

rem *** AT25Launcher***
ObjectTemplate.create FireArms AT25Launcher
ObjectTemplate.setNetworkableInfo PlaneFireArmInfo
ObjectTemplate.aiTemplate SupplyboxGunAI
ObjectTemplate.projectileTemplate AT25SpawnProjectile
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize 1
ObjectTemplate.numOfMag 999
ObjectTemplate.velocity 0
ObjectTemplate.autoReload 1
ObjectTemplate.reloadtime 60
ObjectTemplate.roundOfFire 1
rem ObjectTemplate.setInputFire c_PIAltFire
ObjectTemplate.addFireArmsPosition 0/0/0 0/0/0
ObjectTemplate.AmmoType	10

rem *** AT25SpawnProjectile***
ObjectTemplate.create Projectile AT25SpawnProjectile
rem ObjectTemplate.geometry Ammobox_m1
ObjectTemplate.hasDynamicShadow 1 
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.setHasPointPhysics 1
ObjectTemplate.hasCollisionEffect 1
ObjectTemplate.invisibleAtEndEffect 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 10
ObjectTemplate.maxHitPoints 10
ObjectTemplate.explosionDamage 0
ObjectTemplate.timeToLive CRD_NONE/20/0/0
ObjectTemplate.gravityModifier 100
ObjectTemplate.dieAfterColl 0
ObjectTemplate.radius 0
ObjectTemplate.material 70
ObjectTemplate.noFFSound 1
ObjectTemplate.mass 50
ObjectTemplate.drag 30
rem -------------------------------------
ObjectTemplate.addTemplate AT25PackageSpawner
rem -------------------------------------

rem *** AT25PackageSpawner ***
ObjectTemplate.create ObjectSpawner AT25PackageSpawner
ObjectTemplate.setObjectTemplate 1 AT25Package 
ObjectTemplate.setObjectTemplate 2 AT25Package
rem ObjectTemplate.holdObject 1
ObjectTemplate.minSpawnDelay 20
ObjectTemplate.maxSpawnDelay 20
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2
ObjectTemplate.MaxNrOfObjectSpawned 1
ObjectTemplate.damageWhenLost 10


ObjectTemplate.create SimpleObject AT25Package
ObjectTemplate.geometry Ammobox_m1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.drag 2
ObjectTemplate.mass 3000
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.hasArmor 1
ObjectTemplate.hitpoints 10
ObjectTemplate.maxhitpoints 10
ObjectTemplate.material 45
ObjectTemplate.addArmorEffect 0 em_AT25SpawnDamage 0/0/0


rem *** em_AT25SpawnDamage ***
ObjectTemplate.create EffectBundle em_AT25SpawnDamage
ObjectTemplate.saveInSeparateFile 1
rem -------------------------------------
ObjectTemplate.addTemplate AT25Spawner
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.timeToLive CRD_NONE/20/0/0
rem -------------------------------------

rem *** AT25Spawner ***
ObjectTemplate.create ObjectSpawner AT25Spawner
ObjectTemplate.setObjectTemplate 1 AT25 
ObjectTemplate.setObjectTemplate 2 AT25
ObjectTemplate.holdObject 1
ObjectTemplate.minSpawnDelay 20
ObjectTemplate.maxSpawnDelay 20
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2
ObjectTemplate.MaxNrOfObjectSpawned 1
ObjectTemplate.damageWhenLost 10
I want to live in a created universe. Virtual reality, here I come.
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: Need help with custom objects in map

Post by Senshi »

http://bfmods.com/viewtopic.php?f=43&t=417

This is not exactly what you want, but should give an idea of it.

The layout described above is this:
A (hand)weapon fires a dummy projectile that spawns a dummy object that spawns a "true" object that has a spawnpoint attached to it. But you can just change the "attached" object to whatever you want, the principle itself remain the same and the "actual" spawned object is sitting perfectly on the terrain. To make this even better, you can increase the mass more than I did (I wanted to make the object moveable/pushable, but only with some effort. Inf can't move it, but tanks can kick it around just fine ;) .

The last two "boxes" might be of interest to you, there I describe how I stabilized my dummy object by giving it mass (to make it stick to the ground more and make it harder to "push around" and how I added some basic "springs" to prevent the object from spinning and bumping around on the slightest contact. This also means the object does not start to slide on the slightest slope but just sticks to the ground. The tiny vertical "spawnoffset" I gave the object is helpful if you place the object on a non-flat terrain. It makes the object drop a tiny bit but afterwards it is glued to the ground. Else it starts "inside" the terrain and that can cause jittering, jumping and lots of ugly random stuff.
User avatar
Psycho
Posts: 125
Joined: Thu Aug 25, 2011 3:31 am

Re: Need help with custom objects in map

Post by Psycho »

And because I only want to spawn one object, I can let the "true" object die asap and the spawned object will remain for a while?
I want to live in a created universe. Virtual reality, here I come.
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: Need help with custom objects in map

Post by Senshi »

For your setup you only need a dummy projectile and a dummy object, because you would attach your objectspawner directly to the dummyobject.

For testing purposes I would suggest you use a simple (mobile!) geometry for the dummy object (the landmine is a good fit) and make it NOT invisible, so you can see how it behaves when you place it. Once you are done fiddling with the settings, you can just add the line "invisible 1" and the object will never be seen :) . I would not recommend making the objects insta-spawn, better to wait a second or two until the dummy object has really "settled". But that is for testing, just use your weapon and look how long it takes for your dummy object to stabilize. It should be very quick (below 1sec). Then you should set up the TimeToLive just so it "outlives" the objectspawner. So if your attached objectspawner has a Spawndelay of 1, make the dummyobject live 1.1 seconds.

A small delay for this kind of thing is not bad gameplaywise either, it represents the "setting up/building time". That's why I used higher delays for my rally point thing as well. It takes 5 seconds to fire the weapon (5s the officer can't use any other weapon), then again another 2s until he can switch weapons after the rally point is placed, and then it takes another 5 seconds until the rally point actually appears. All this is not necessary, but simply gameplaydesign, forcing the officer to think where he places the spawn point, because he is utterly vulnerable during that time.
Post Reply