Home   Help Search Login Register  

Author Topic: little help with getpos setpos  (Read 1509 times)

0 Members and 1 Guest are viewing this topic.

Offline frogstomp

  • Members
  • *
little help with getpos setpos
« on: 06 Oct 2007, 23:36:57 »
been years since ive edited and Im having a hard time with getpos setpos i cant remember
anyways basiclly all im looking for is to have a truck that has an addaction to deploy a compound around the truck with a tent campfire medic tent and an ammobox.
then an addaction to pack up the compound and move it to an island or something until its deployed again. i made a mission with the layout really small. request is kinda lame i know ::) but im sure others could benefit from the script
http://members.shaw.ca/roxwilliam/compound.Intro.rar (ftp://http://members.shaw.ca/roxwilliam/compound.Intro.rar)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: little help with getpos setpos
« Reply #1 on: 06 Oct 2007, 23:47:53 »
So the question is?
Or should we move your mission to beta forum for testing and submission?

Offline frogstomp

  • Members
  • *
Re: little help with getpos setpos
« Reply #2 on: 07 Oct 2007, 21:08:50 »
so the question is anyone have a script that could do this?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: little help with getpos setpos
« Reply #3 on: 07 Oct 2007, 22:02:18 »
Not that you need any setPos, what you need is createVehicle and setDir commands to create the compound and then just deleteVehicle to remove the compound.

For the list of classes you might use for createVehicle you may check CfgVehiclesOFP/ArmA.


Just a small example:

init field of your truck:
Code: [Select]
this addAction ["Deploy compound", "deploy_compound.sqf"]
And now two example scripts:
Code: [Select]
// deploy_compound.sqf
_truck = _this select 0;
_idacc = _this select 2;

_truck removeAction _idacc;
_dir = getDir _truck;

_pos = [(getPos _truck select 0)+sin(_dir + 180)*15,(getPos _truck select 0)+cos(_dir + 180)*15, 0];
compound_tent = "MASH" createVehicle _pos;
compound_tent setDir _dir;

_pos = [(getPos _truck select 0)+sin(_dir + 200)*15,(getPos _truck select 0)+cos(_dir + 200)*15, 0];
compound_ammo = "AmmoBoxWest" createVehicle _pos;

_pos = [(getPos _truck select 0)+sin(_dir + 180)*10,(getPos _truck select 0)+cos(_dir + 180)*10, 0];
compound_fire = "Fire" createVehicle _pos;

_truck addAction ["Pack compound", "pack_compound.sqf"]

Code: [Select]
// pack_compound.sqf
_truck = _this select 0;
_idacc = _this select 2;
_truck removeAction _idacc;

deleteVehicle compound_tent;
deleteVehicle compound_fire;
deleteVehicle compound_ammo;

_truck addAction ["Deploy compound", "deploy_compound.sqf"];

Offline Knight Trane

  • Members
  • *
Re: little help with getpos setpos
« Reply #4 on: 06 Feb 2009, 23:40:25 »
Would this aproach work for a "Setpos" that uses a map building?

By map building, I mean, a building thats part of the island.

I already setpos one building with objects, but I would like to be able to do the same thing to any of the other buildings of the same class name.  Regaurdless of their pos on the map.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: little help with getpos setpos
« Reply #5 on: 07 Feb 2009, 03:21:44 »
Well now, you can't actually move any of the buildings that are part of the wrp file, i.e. already part of the island.
But you can place an identical building on the map if you desire.
Just use the list Mandoble supplied above for the classnames.


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

Offline Knight Trane

  • Members
  • *
Re: little help with getpos setpos
« Reply #6 on: 07 Feb 2009, 06:27:34 »
I miss spoke. 

I meant that I setPos objects in a building that already exists on the map.

I want the same setup for buildings of the same classname reguardless of their Facing or location on the map.

I guess that would have to be a "nearestBuidling" line to find the Building and the direction. 

And now that I think of it.  Wouldn't have to have some sort of reference point in the buiilding?