Author Topic: A question about FH1 code  (Read 1263 times)

Offline Handicap

  • Newbie
  • *
  • Posts: 6
    • View Profile
A question about FH1 code
« on: 30-01-2011, 09:01:50 »
Sup guys. Didn't know where to ask so I'll ask here.

I've been playing FH1 for a quite while, and FH2 for a couple of days now, but this question isn't about FH.

You see, we have been working on updating the BF1942 mod FinnWars, and we would like to enhance our deployable weapon's code. I've been reading through the FH1 a couple of times but haven't figured out HOW did you guys make the deployables to give a new weapon when you leave the gun? We released a new version last (finnish) independence day, but it was partly rushed out. We get a lot of nagging about the deployable guns and I agree that they are rather awkward to use, since you have to find an ammo box to get a new one.

Hope there are still some guys who know how this was done.

Offline fh_spitfire

  • Developer
  • ******
  • Posts: 421
  • FHer since 0.6 | aka spitfire05
    • View Profile
Re: A question about FH1 code
« Reply #1 on: 30-01-2011, 10:01:26 »
AFAIK deployed weapons are supply points for deploy projectiles.

Offline Handicap

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: A question about FH1 code
« Reply #2 on: 30-01-2011, 14:01:53 »
Tried that, but it gave the new gun before the old one was destroyed, since it was active all the time.

Making the supply spawn when the gun gets destroyed is AFAIK impossible on dedicated servers.

Offline Archimonday

  • Full Member
  • ***
  • Posts: 1.197
  • Sir vis pacem, para bellum!
    • View Profile
Re: A question about FH1 code
« Reply #3 on: 30-01-2011, 18:01:46 »
The way they do it is by making the tripod an ammo resupply object, thus when you leave, despite having used your only gun, your ammo gets replenished.

In FH1 you could stand next to a tripod and get ammo for any weapon, it just disappeared quickly.

Offline Handicap

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: A question about FH1 code
« Reply #4 on: 30-01-2011, 18:01:16 »
But why don't you get the ammo all the time when you're next to the tripod?

Offline Archimonday

  • Full Member
  • ***
  • Posts: 1.197
  • Sir vis pacem, para bellum!
    • View Profile
Re: A question about FH1 code
« Reply #5 on: 30-01-2011, 20:01:23 »
The supply object probably has a time to live set to it. gimme a few minutes


rem *** hanomagSupplyDepot ***
ObjectTemplate.create SupplyDepot hanomagSupplyDepot
ObjectTemplate.radius 1.4
ObjectTemplate.team 0
ObjectTemplate.setHealth -1 4.0 0
ObjectTemplate.addAmmoType 1 -1 15 0
ObjectTemplate.addAmmoType 2 -1 1.2 0
ObjectTemplate.addAmmoType 3 -1 1.2 0
ObjectTemplate.loadSoundScript ../../../Common/Sounds/SupplyDepot.ssc


Hanomag Supple Depot from the Halftracks in Vanilla


rem *** hanomagSupplyDepot ***
ObjectTemplate.create SupplyDepot hanomagSupplyDepot
ObjectTemplate.radius 1.4
ObjectTemplate.team 0
ObjectTemplate.setHealth -1 4.0 0
ObjectTemplate.addAmmoType 1 -1 15 0
ObjectTemplate.addAmmoType 2 -1 1.2 0
ObjectTemplate.addAmmoType 3 -1 1.2 0
ObjectTemplate.loadSoundScript ../../../Common/Sounds/SupplyDepot.ssc
ObjectTemplate.timeToLive CRD_NONE 1/0/0 <--- Added Time to live code, this is a CRD_NONE so that there is no randomization in the time, and it is in number of seconds. According to this the hanomag supply depot should now only exist for 1 second then disappear.
« Last Edit: 30-01-2011, 20:01:30 by Archimonday »

Offline Handicap

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: A question about FH1 code
« Reply #6 on: 30-01-2011, 21:01:26 »
But why does it give you the ammo AFTER you have left the gun? With my logic, the supply objects should disappear one second after the gun has been placed.

Offline Archimonday

  • Full Member
  • ***
  • Posts: 1.197
  • Sir vis pacem, para bellum!
    • View Profile
Re: A question about FH1 code
« Reply #7 on: 30-01-2011, 21:01:54 »
Id have to redownload FH1 to take a closer look, there is a separate object which stays on the ground after you have left, and has the resupply object attached to it, not the gun itself. It can be related to a vehicle wreck if you catch my drift.

Offline Handicap

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: A question about FH1 code
« Reply #8 on: 30-01-2011, 23:01:25 »
Taking a look at the code again. It still doesn't make sense. Where in the code is the "activate on death" stuff hidden? The gun (or "gun") gives you ammo in a quite noticeable radius so it cannot be active all the time.

Offline Archimonday

  • Full Member
  • ***
  • Posts: 1.197
  • Sir vis pacem, para bellum!
    • View Profile
Re: A question about FH1 code
« Reply #9 on: 30-01-2011, 23:01:31 »
I think your misunderstanding, its not the gun itself giving you the ammunition, the object your using and the object you see after you pick the gun up are two different objects. One of the usable player object, the machine gun itself, the second is a secondary object that looks like a tripod, which then has a supply object attached to it to replenish the deployable machine gun projectile.

Offline Handicap

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: A question about FH1 code
« Reply #10 on: 31-01-2011, 10:01:54 »
I understand that there are 2 main objects (apart from the rotational bundles and stuff). The tripod thingy and the gun. However I just don't understand why does the tripod give you ammo after you have left the gun. I've understood that the gun is attached to the tripod and they both get destroyed because of the line that tells them to self-destruct on exit. But still, if the tripod is spawned with the gun on top of it, why does it give you the ammo when the gun is destroyed, and the tripod is (assuming it is) merely a wreck.