Home   Help Search Login Register  

Author Topic: Make a mechanic.  (Read 1660 times)

0 Members and 2 Guests are viewing this topic.

ollestolpe

  • Guest
Make a mechanic.
« on: 17 Jun 2005, 12:31:26 »
I have never made any addons. I am somewhat familiar with OFP scripting though.
What I really need to do now is a mechanic. A soldier that has the ability of repairing vehicles.

How could I go about doing this? Or is it allready made?
My idea is that when this dude is close to a damaged vehicle (not a destroyed one) he should get the option to repair it.
Also I want to be able to give an AI-machanic the order to repair a vehicle.

It's for our heavily modified MFCTI.
Would be so happy if you guys could help me out.

Offline oyman

  • Members
  • *
  • king of pings
Re:Make a mechanic.
« Reply #1 on: 17 Jun 2005, 17:06:48 »
I have made something for you ;)

there is a west and east version, there names are both Mechanic under
Men
« Last Edit: 17 Jun 2005, 17:07:03 by oyman »

ollestolpe

  • Guest
Re:Make a mechanic.
« Reply #2 on: 17 Jun 2005, 17:24:36 »
Awsome!
Just what I needed!!!!

Thank you so much!

ollestolpe

  • Guest
Re:Make a mechanic.
« Reply #3 on: 30 Jun 2005, 00:12:14 »
I just found a bug...
I wonder if itr's even possible to solve.

If you ride a car with a mechanic and smash up the car. You can tell the mech to get out, and then you repair the truck. But when you ask him to get back in the car he just pops out again.

It is as if the mechanic still counted the car as broken and therefor he can't stay in it.
Would it be possible to solve this?

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:Make a mechanic.
« Reply #4 on: 30 Jun 2005, 00:41:58 »
that's clever stuff oyman, makes it look all-so-simple to do.

can you tell me if all the empty class things {} are actually necessary, or will the engine pickup on the derived class of :SoldierWB regardless? Seems a huge waste of typing deriving derived derives which are all predeclared anyway. Have never seen it done any other way, but just curious.

Just say no to bugz

Offline oyman

  • Members
  • *
  • king of pings
Re:Make a mechanic.
« Reply #5 on: 30 Jun 2005, 01:27:14 »
I just found a bug...
I wonder if itr's even possible to solve.

If you ride a car with a mechanic and smash up the car. You can tell the mech to get out, and then you repair the truck. But when you ask him to get back in the car he just pops out again.

It is as if the mechanic still counted the car as broken and therefor he can't stay in it.
Would it be possible to solve this?
hmm, that is a serious bug :-\ , ive been messing around seeing if i can find any way to fix it. one thing i found is that the mechanic only pops out after repairing heavily damaged vehicles. I drove a jeep into a m1a1, it was heavily damaged, told mechanic to get out he repaired it, but wouldnt get in :( . I tried it with a 5t truck, it was about 1/4 damaged, he repaired and got in fine. so this bug has me stumped :-\

maybe ill make a readme to go along with the repair addon with some info about that bug

Quote
that's clever stuff oyman, makes it look all-so-simple to do.

can you tell me if all the empty class things {} are actually necessary, or will the engine pickup on the derived class of :SoldierWB regardless? Seems a huge waste of typing deriving derived derives which are all predeclared anyway. Have never seen it done any other way, but just curious.
I guess your talking about this part
Code: [Select]
  class All{};
   class AllVehicles:All{};
   class Land: AllVehicles{};  
   class Man: Land{};
   class Soldier: Man{};
   class SoldierWB: Soldier{};
if I take that part out then it will give me a error when starting up ofp something along the lines of this
Quote
undefined base class "SoldierWB"
so we have to put them in

and if i didnt answer your question right please tell me :)
« Last Edit: 30 Jun 2005, 01:28:05 by oyman »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Make a mechanic.
« Reply #6 on: 30 Jun 2005, 03:17:16 »
Basically Mikero the mechanic inherits the characteristics of the SoldierWB class, which inherits from the Soldier class, which inherits from Man class.......etc etc.

All these classes are defined in the main game config.

You can then redefine only the characteristics you need changed for your custom class, and all the other charateristics it inherits will remain the same.


Planck
I know a little about a lot, and a lot about a little.

UNN

  • Guest
Re:Make a mechanic.
« Reply #7 on: 01 Jul 2005, 14:29:55 »
Quote
hmm, that is a serious bug  , ive been messing around seeing if i can find any way to fix it. one thing i found is that the mechanic only pops out after repairing heavily damaged vehicles.

That happens when the vehicle recieves so much damage it cant move anymore. Use the CanMove command to check this. When a vehicle is disabled, the AI automaticaly get kicked out of the vehicle.

There is a bug in OFP where if you repair it with a repair truck (or your mechanic). CanMove remains set to false, so no AI can get in. You can fix this by using SetDamage on the vehicle with any value.

You could add something like this to the mechanics getout event:

Code: [Select]
If !(CanMove _Vehicle) Then {_Vehicle SetDamage (GetDamage _Vehicle)}
The problem is, this will mean that any vehicle the AI mechanic is in, will never be disabled, only damaged.

« Last Edit: 01 Jul 2005, 14:31:25 by UNN »