Page 1 of 1

Adding a soldier spawn to a projectile

Posted: Sat Jul 14, 2012 2:28 am
by Swaffy
I looked around, even in ServerSideModding, for this small mod.

How do I add a soldier spawn to a projectile? I made a radio StandardMesh to use for the projectile. It drops and sits on the ground after being "fired" (using the landmine animations) but the spawner I added isn't working. How do I add it?

This is my projectile coding:

Code: Select all

ObjectTemplate.create Projectile RadioSpawnProjectile
ObjectTemplate.createNotInGrid 1 
ObjectTemplate.geometry RadioSpawner_m1
ObjectTemplate.saveInSeparateFile 1 
ObjectTemplate.addTemplate RadioSpawnPoint
ObjectTemplate.setPosition 0/0.1/0 
rem * Life span of three minutes.
ObjectTemplate.timeToLive CRD_NONE/180/0/0 
ObjectTemplate.gravityModifier 1 
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 0
ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 0
ObjectTemplate.material 230
ObjectTemplate.invisible 0
ObjectTemplate.DetonateOnWaterCollision 0 
ObjectTemplate.dieAfterColl 0
ObjectTemplate.drag 0.04 
ObjectTemplate.mass 800 

ObjectTemplate.create SpawnPoint RadioSpawnPoint
ObjectTemplate.setSpawnId 200
ObjectTemplate.setGroup 2

Re: Adding a soldier spawn to a projectile

Posted: Sat Jul 14, 2012 10:35 am
by freddy
It seems you have to use a object to get it to work, Senshi made a thread about it here: viewtopic.php?f=43&t=417

Re: Adding a soldier spawn to a projectile

Posted: Sun Jul 15, 2012 8:53 pm
by Swaffy
freddy wrote:It seems you have to use a object to get it to work, Senshi made a thread about it here: viewtopic.php?f=43&t=417
I was looking for so long for that exact thread, how come I didn't find it?
Thanks.

Re: Adding a soldier spawn to a projectile

Posted: Wed Jul 18, 2012 5:40 pm
by Swaffy
New question, relevant to this.

If I want one of these for both teams, do I need two separate HandFireArms with two separate spawners in order for it to work? Or can I use the same HandFireArm for both teams and the game will know which team threw the spawner and knows who to spawn?

Re: Adding a soldier spawn to a projectile

Posted: Fri Jul 20, 2012 11:46 pm
by Senshi
No, the weapon-launched-PCO will not know what the team the "firing" weapon is on. It can't know it.

You have to look at 5), there's a line with

Code: Select all

ObjectTemplate.team 1
This single line define what team object the template will spawn.

Only control points are capable of passing on their Team value to attached spawners. As the weapon-launched spawners are not actually attached or related to the soldier who fired them, but are created completely independent, they are not bound to any team (which would default them to Team 0). And the line of code above is a method to define a default team for an ObjectTemplate. You can set this line for Templates attached to flags as well, but they will have no effect there, as this setting is immediately being overwritten by the flag's team value.

You also want to make sure that on 4), you set the

Code: Select all

SpawnPointManager.groupteam 1
to what you need. Also, if you want multiple selectable points or want to use them for both teams simultaneously, make sure to set up a unique Spawngroup for each set. Spawngroups define (as one could guess) which individual spawnpoints should be grouped together. On most vanilla maps, all spawnpoints are attached to a single flag, which practically only means that all of them get assigned the same Spawngroup (This is what BC42 does by default). This results in a single selectable spawn position on the ingame map, located at the centroid of all individual spawnpoints.
In my example, I specified a single group for all the 4 or 5 individual spawners spread around my rallye point, so they also only get a single dot ingame. If you'd use the same group for other spawners (or if you just place multiple instances of the rally points throughout the map, without letting them expire), all of those will be combined ingame into a single dot that will be seen somewhere in the center of the map. If you choose to spawn on this point, you will randomly spawn at one of the individual spawners with that ID. If one team should get multiple pickup-kits that have this spawn-gun (as I propose in the thread), you should make individual weapons for each of them. If you want to add this spawn-weapon to the generic kit selection menu (so a large number of possible players have it), I would suggest you take a look at RandomGeometries, which would allow you to easily make sure that the players get unique spawners. Or at least you could cycle easily through a large number of individual groups which would make it very unlikely that the same ID is used simultaneously by two players. It's important to note that "RandomGeometries" is not actually random, but just iterates. So it starts with geometry 0, then 1, 2,3,... . Which also has some nice benefits, just as it does in this case.

I hope this makes things clearer and doesn't confuse you even more :D .

EDIT:
@Black Mamba: If you have no meaningful contributions, just refrain from posting. There's been a noteable increase in troll and flame posts from your end, and we don't intend to tolerate this much longer. It might be mildly funny once, but definitely not in these quantities. It's plain immature and annoying.

Re: Adding a soldier spawn to a projectile

Posted: Sat Jul 21, 2012 6:41 am
by Swaffy
I had a strong feeling I needed to make a separate set for each side.

Anyway,

Re: Adding a soldier spawn to a projectile

Posted: Sat Jul 21, 2012 9:17 am
by Senshi
Great to see someone actually benefitted from my tutorial ;) . It always seemed to me that the "advanced" tutorials are not really high in demand...

Re: Adding a soldier spawn to a projectile

Posted: Sat Jul 21, 2012 2:10 pm
by freddy
i did a quick and dirty teamleaderkit for ssm once, the thing that bugging me tho is that if you put some sort of healing or ammo supply to a weapon, it only work when that weapon is selected, but if you put a spawner to a weapon it "shows" all the time.

one could use a PCO and the code disableSpawnPointsOnEnter instead but thats not really the same