Home   Help Search Login Register  

Author Topic: How to Place a MG Haevy static in a Car and Loadout & Loadin works???  (Read 1121 times)

0 Members and 1 Guest are viewing this topic.

Offline ed-dutchie

  • Members
  • *
Hello all. ( I'm new here... Greetings to All) :good:

I have an question for you. And I'm really hopping that you can help me out with it.
I'm building a new mission and stumble on one problem that I can't fix.
( Because I don't know how to do this. So help me out PLZ.) :clap:

The Problem:
I want to place a MachineGun 12_7" static as cargo in to a Car or an Jeep or Hmmwv.
This Machinegun stands on a tripod and haze to be handled with the mouse menu command
[ Load out MG-Static] and [Load in MG Static]  till now it did end work.

I read the bit on [ How to store Weapons in a Vehicle]  but this works only halfway.
You can load out the MachineGun 12_7" But you cannot load the MachineGun 12_7" back in to the car.
When you have to go to the next waypoint in the mission.

I have skim most of the Ofp Forums about it. But there is almost nothing in there (Or I have mist it)
that explains this on how to do this. The only bit I have found so far is the bit on how to store weapons in a vehicle.
And that is only working halfway.

Now I'm hopping that some of you can help me out with this Problem. With Tips on it.
And maybe some good links to site's that it explains on how to do this.

In front thanks and hopefully till hearings

Greetings ed-dutchie. and thanks again for any answer to it. :good:

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
This can not be done without scripting. The game engine considers the M2 a vehicle. In fact, I don't see how you could have loaded out the MG at all. For you to unload it, did you not have to first put in into the vehicle somehow? Please explain.
urp!

Offline ed-dutchie

  • Members
  • *
Hello Mr.Peanut, Greetings.

Yes it is a script file that I do use. And because of your little tip on it I search further.
And found something else about it. The Deploy.sqs and The Load.sqs scripts but there is a little thing with it. PLZ Help me out.

I use something New and this has a little Bug with it. The Loops will always go on even if you have deploy the MG.
So I was wondering if this could be solved to? Do you have any Ideas on it.???

>>> The New script. Deploy <<<

The Deploy.sqs:

Code: [Select]
_truck = _this select 0
_someguy = _this select 1
_index = _this select 2

_pos = getpos _someguy
_dir = getdir _someguy
_truck removeaction _index

titletext ["", "Black Out", 1]
~1
_mgun = "M2StaticMG" createvehicle [(getpos _truck select 0)-(sin (getdir _truck)*5),
(getpos _truck select 1)-(cos (getdir _truck)*5), 1.05]
_mgun setdir getdir _truck
~.5
titletext ["", "Black In", 1]

#PackUp
~.1
?(!alive _mgun): exit
_truck = nearestObject [_mgun, "Truck5T"]
?(!alive _truck): goto "PackUp"
?_truck distance _mgun > 5: goto "PackUp"

_load = _mgun addaction ["Load Machine Gun", "Load.sqs"]

#Loop
?_truck distance _mgun > 5: _mgun removeaction _load; goto "PackUp"
?(!alive _mgun): exit
?(!alive _truck): _mgun removeaction _load; goto "PackUp"
~.1
goto "Loop"



The Load.sqs:

Code: [Select]
_mgun = _this select 0
_someguy = _this select 1
_index = _this select 2

_mgun removeaction _index
_truck = nearestObject [_mgun, "Truck5T"]

titletext ["", "Black Out", 1]
~1
deletevehicle _mgun
titletext ["", "Black In", 1]
~1
_deploy = _truck addaction ["Deploy Machine Gun", "deploy.sqs"]

#Loop
?(!alive _truck): _truck removeaction _deploy; exit
~.1
goto "Loop"



The only problem I see is, those loops after the addaction will continue even after the action is used,
Which means that if the MG-gun is Deployed and Redeployed continually there will be several of the same scripts looping,
which may cause a slowdown. I am unsure on how to solve this at this point.??? Help, Help,Help.

Do Some Of You have any Ideas on solving this issue on the loops problem.
Or do exist there an better scripts for this thing???


In front Thanks for any answer and Idea on it, Greetings ed-dutchie :good:
« Last Edit: 15 Feb 2008, 15:26:11 by bedges »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
ed,

The problem you describe is true.  Those scripts will spawn multiple copies of themselves which will really screw things up. Unfortunately I am going away on vacation tomorrow, and now it is my bed time. If no one else helps you before I get back(9-10 days) then I'll solve it for you.  Those scripts need major surgery...

urp!

Offline ed-dutchie

  • Members
  • *
Thanks Mr.Peanut, Greetings. (And have a fine Vacation)

I'll will in the mean time search further and explore more script Tutorials in the hoop of solving this.
If you have a better Script without the Loop command. I will be very happy about it.
Or maybe there is a totally other approach to it. But that I still do not no.
So I will experiment for a while with it.

Greetings ed-dutchie and till hearings ( Have fun ) :good: