[Help] Custom Faction
-
Moszeusz6Pl
- Retired PR Developer
- Posts: 939
- Joined: 2010-06-24 13:41
Re: [Help] Custom Faction
You may look at grenade code, because when you are killed when throwing it, and somebody pick up your kit, when he press 4, grenade will immediately fall under his feet.

-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
Re: [Help] Custom Faction
I do not think that is anything to do with the code itself... its simply that if you have started the animation, it will always throw it if selected after. Its like the right click option but it is always player activated first, even if it has a delay.

-
Moszeusz6Pl
- Retired PR Developer
- Posts: 939
- Joined: 2010-06-24 13:41
Re: [Help] Custom Faction
Other way is to make weapon fire after pressing switch kit key. If you are going to give it to pickup kit, it might work. Add line ObjectTemplate.fire.altFireInput PIDrop, give this weapon altfire, and make sure what weapon is ready to fire instantly(no delays). Then check how long you need to press G to make it fire.

-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
Re: [Help] Custom Faction
But wouldn't that only work for the players who are using the default keys?
I got my keys all customized for example and I can't take the chance of it only working for some.
I got my keys all customized for example and I can't take the chance of it only working for some.

-
Moszeusz6Pl
- Retired PR Developer
- Posts: 939
- Joined: 2010-06-24 13:41
Re: [Help] Custom Faction
It should work for all players, because this it isn't binded to G, but to key, to which you binded drop kit option.

-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
Re: [Help] Custom Faction
So besides the ObjectTemplate.fire.altFireInput PIDrop
what other line would I need? As in, to add the altfire option?
what other line would I need? As in, to add the altfire option?

-
Moszeusz6Pl
- Retired PR Developer
- Posts: 939
- Joined: 2010-06-24 13:41
Re: [Help] Custom Faction
Add this code, and add some fake_projectile. Bold text is that need to be
changed.
changed.
Code: Select all
ObjectTemplate.addTemplate [b]fake_weapon[/b]
ObjectTemplate.create GenericFireArm [b]fake_weapon[/b]
ObjectTemplate.modifiedByUser "armandoma"
ObjectTemplate.createdInEditor 1
rem ---BeginComp:MultiFireComp ---
ObjectTemplate.createComponent SingleFireComp
ObjectTemplate.fire.roundsPerMinute 60
ObjectTemplate.fire.fireInput PIDrop
ObjectTemplate.fire.addFireRate 0
rem ---EndComp ---
rem ---BeginComp :D efaultAmmoComp ---
ObjectTemplate.createComponent DefaultAmmoComp
ObjectTemplate.ammo.nrOfMags [b]2[/b]
ObjectTemplate.ammo.magSize [b]2[/b]
ObjectTemplate.ammo.minimumTimeUntilReload 13
ObjectTemplate.ammo.autoReload 1
ObjectTemplate.ammo.reloadWithoutPlayer 1
ObjectTemplate.ammo.MagLinkWeapon [b]real_weapon[/b]
rem ---EndComp ---
rem ---BeginComp:WeaponBasedRecoilComp ---
ObjectTemplate.createComponent WeaponBasedRecoilComp
rem ---EndComp ---
rem ---BeginComp:SimpleDeviationComp ---
ObjectTemplate.createComponent SimpleDeviationComp
ObjectTemplate.deviation.minDev 6
rem ---EndComp ---
rem ---BeginComp :D efaultSoundComp ---
ObjectTemplate.createComponent DefaultSoundComp
rem ---EndComp ---
rem ---BeginComp :D efaultAnimationComp ---
ObjectTemplate.createComponent DefaultAnimationComp
rem ---EndComp ---
rem ---BeginComp :D efaultZoomComp ---
ObjectTemplate.createComponent DefaultZoomComp
ObjectTemplate.zoom.addZoomFactor 0
rem ---EndComp ---
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.projectileTemplate [b]fake_projectile[/b]
ObjectTemplate.keepProjectiles 5
ObjectTemplate.velocity 12
-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
Re: [Help] Custom Faction
You said "Add line ObjectTemplate.fire.altFireInput PIDrop, give this weapon altfire"
I added that line and I already had the rest of the stuff you showed in bold. But it doesn't work. The drop/pickup button doesn't fire the weapon.
So I first though I was missing a line to "give this weapon altfire" but I guess not. It is probably because you can't have the same key do both functions.
I added that line and I already had the rest of the stuff you showed in bold. But it doesn't work. The drop/pickup button doesn't fire the weapon.
So I first though I was missing a line to "give this weapon altfire" but I guess not. It is probably because you can't have the same key do both functions.

-
Rhino
- Retired PR Developer
- Posts: 47909
- Joined: 2005-12-13 20:00
Re: [Help] Custom Faction
I don't see how your going to get this working, at least not with this method. If it was a PCO vehicle, Python would probably be able to do this (although think you could even set it in the code without python) but handheld is most not possible, thou probably still worth looking into.
The idea of having the weapon fire off 2 mags or w/e when you pick up the kit, I just can't see working.
The idea of having the weapon fire off 2 mags or w/e when you pick up the kit, I just can't see working.
-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
Re: [Help] Custom Faction
It only needs to fire one bullet and it will already reload automatically.
The issue is the firing that bullet on its own.
Do you know of any other way to reduce ammo on a weapon so that the player starts with 1 or 2 mags but can get up to 8 for example? Because the code doesn't allow that in itself so we would always have to find a workaround.
The issue is the firing that bullet on its own.
Do you know of any other way to reduce ammo on a weapon so that the player starts with 1 or 2 mags but can get up to 8 for example? Because the code doesn't allow that in itself so we would always have to find a workaround.

-
piepieonline
- Retired PR Developer
- Posts: 433
- Joined: 2009-07-22 00:41
Re: [Help] Custom Faction
I know this is an old post, but if you still need to get the spawner name, use:Onil wrote:How does the python recognize the caches in the GPO? Object Spawner name (ex: a_121) ?
Would it spawn pickup kits randomly if I change it from ammo cache to the kit?
I checked and both the cache and the kits don't have the rotation issue and that is probably due to it being spawned by the python.
Code: Select all
spawners = bf2.objectManager.getObjectsOfType('dice.hfe.world.ObjectTemplate.ObjectSpawner')
for cp in spawners:
# do stuff to each spawner
spawnerName = cp.templateName
-
Onil
- Posts: 1232
- Joined: 2007-08-19 09:50
Re: [Help] Custom Faction
eh, thanks but we've used AAS v4 for the initial random spawner to test the gameplay stuff and we are now finishing a random spawner python script for future use. 


