Home   Help Search Login Register  

Author Topic: move to object  (Read 3926 times)

0 Members and 1 Guest are viewing this topic.

Offline Killzone

  • Members
  • *
  • War is the true Enemy
move to object
« on: 18 Feb 2007, 22:24:03 »
Hi,

In ofp I used:

a domove (getpos (object 68232))

to  get a unit to move to a specific object. This is not working in ARMA. Anyone know the right way? I am not a good scripter and it seems that ARMA changed 'just' enough to drive me crazy

Thanks in advance for the help
"Everyone dies so deal with it and move on"

                                                      ME

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: move to object
« Reply #1 on: 18 Feb 2007, 23:36:24 »
Code: [Select]
a domove (position a nearestobject 12345)
I believe that will do it.  Its annoying to use nearestobject rather than object, but it workds.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re: move to object
« Reply #2 on: 18 Feb 2007, 23:53:48 »
Thanks for the help johnnyboy

However, it does not work.

I get this when trying to use it

Type Any, Expected Array, object


Any other ideas?  I did try just using move instead of domove with no luck.

Thanks again
"Everyone dies so deal with it and move on"

                                                      ME

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: move to object
« Reply #3 on: 19 Feb 2007, 07:10:41 »
It should work..

Try adding more braces, it may help in certain situations
Code: [Select]
a domove ((position a) nearestobject 68232)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: move to object
« Reply #4 on: 19 Feb 2007, 09:09:48 »
AFAIK, objects IDs do not work in ArmA, so you better place a gamelogic or a marker and issue the move command using these coordinates.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: move to object
« Reply #5 on: 19 Feb 2007, 09:39:43 »
Object IDs work just fine (check the Object ID Help topic for example) but there was an error in the above codes posted..

It should be
Code: [Select]
a doMove position  ((position a) nearestObject 1114) :whistle:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re: move to object
« Reply #6 on: 19 Feb 2007, 16:37:58 »
Thanks people for all the responses in trying to help.

h- 

Your example worked so I am all set there.

If I could ask someone for more help it would be great.  I want to be able to create a civillian at the location of an object. In ofp I used this:

"civilian6" createunit [getpos object 3892,group (dead),"a = this",1,"Private"];
[ a ] join GrpNull

This does not work and I have tried several different things with no luck. (I must get better at understanding scripts)
In case anyone is wondering I do have a dead civi on the island named dead

Thanks again everyone. As usual this site continues to be great.   :clap:   :good:   :clap:
"Everyone dies so deal with it and move on"

                                                      ME

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: move to object
« Reply #7 on: 19 Feb 2007, 20:35:12 »
may be the problem is in the object command, may be that is the reason to use nearestobject in ArmA instead of just getPos (object objectid).

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: move to object
« Reply #8 on: 19 Feb 2007, 22:49:28 »
There's something fishy with the object command, that's for sure..

The Biki doesn't even list it under ArmA scripting commands, and in our comref it's said to be used in OFP only, so

maybe it has been disabled  :dunno: ..
Why would they do that is beyond me, I mean surely it's far more effective to point to an terrain object with

object xxxx instead of nearestObject scan (if it even is a scan..)..

@Killzone
You just have to adjust that getpos part according to that example I posted earlier.
Instead of position of some unit I use [0,0,0], since the command requires a position array so let's use that..

Code: [Select]
"Civilian6" createunit [([0,0,0] nearestObject 3892),group dead,"a = this",1,"Private"]
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: move to object
« Reply #9 on: 20 Feb 2007, 03:18:53 »
Just as an fyi you can also use nearestObjects  which will allow you to specify the distance greater then 50m but using like 5000m will cause some lag or time to return the object.

the command Object is disabled in ArmA, in the description there is note about it.
Xbox Rocks

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: move to object
« Reply #10 on: 20 Feb 2007, 08:45:29 »
nearestObject ID does return objects from greater distance than 50 meters (the Biki says it's not guarantedd to find..), like in the above example the distance between [0,0,0] and the object is much much longer than 50m and the object is found without any 'lag' or delay..

However the object is in plain sight and that might help the command since the objects is already 'streamed up' and the object ID pointer is loaded up in the memory..
Which I then tested and sorta confirmed (I think  ::) ):

I placed myself on Sahrani, in town of Tiberia. I then queued an object from the island of Antiqua which way way up north compared to my position.
Using this code in a radio trigger set to repeatedly
Code: [Select]
hint format ["%1",((position player) nearestObject 498004)]at first use the command froze the game for up to 25 seconds accompanied with extensive HD activity (this is probably dependant on the PC specs and ArmA version, mine is still 1.02, 505 version has not reached me yet..), after that long pause the game started to run again but no hint was printed on the screen (on second time testing the hint showed as it was already almost faded away from the screen) .
I then 'clicked the radio' again and now without any effort or delay a hint was printed on the screen saying:
Quote
498004: ker pichlavej.p3d
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re: move to object
« Reply #11 on: 20 Feb 2007, 16:15:52 »
I found creating a number of  people (In my case 10) caused a freeze for about 10 seconds before they were created at different locations throughout the town of Bagango. Maybe this is not the best route.

I am attempting to create a animated town using different scripts. I figured using a 'distance' script if I am lets say <300m then script would create people which would then activate another script to have them move between points thus simulating activity. I can do this now with the help I have received here. However, since it does cause a significant lag/freeze creating multiple people I was thinking of changing course and having the units already created on some far away island and then set pos them with a script however I do not know how to set pos to an object. I could use game logics and 'this setPos [getPos this select 0, getpos this select 1, 0]' but I would rather not since I would need tons of logics if I want to expand beyond one town (My goal is the whole map) 

My question then is, Does anyone know how to set pos to an object. That way I can have something like 12 people transported and used in all the towns making it appear that they are in every town.

Thanks
"Everyone dies so deal with it and move on"

                                                      ME

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: move to object
« Reply #12 on: 20 Feb 2007, 22:14:43 »
I was going to say that extensive (or more than one or two) nearestObject scans would most likely cause trouble but I never did..
Well, now that's proven and not just some guess..

You should forget about the 'set pos to object' path because you would still need the nearestObject scans for that..
Instead go with the gamelogics. Place (and name)  them where you want the civilians to 'spawn' and setpos the civilians to those instead of some object(s)..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: move to object
« Reply #13 on: 21 Feb 2007, 06:55:21 »
Maybe the modelToWorld command might be of use to you: 

Code: [Select]
  _dude setpos (_object modelToWorld [1, -.5, 0]);

It allows you to specify a position relative to an object's position.  You could then have only one one marker object per town, and setpos your ten units relative to that marker object. 

What does that buy you?  I'm not sure.  You wouldn't need 10 markers in every town (a performance gain?), but as an editor, you lose the benefit of visual markers in every town...
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: move to object
« Reply #14 on: 21 Feb 2007, 07:42:08 »
Quote
You wouldn't need 10 markers in every town (a performance gain?)
Markers or gamelogics have no affect on the performance whatsoever..

Quote
It allows you to specify a position relative to an object's position
Hmm, interesting 'mis-use' of that command..  :whistle:
Basicly the setPos + some trigonometry is history..

EDIT:
@Killzone

Did you use any pause between the creation of those units?
Because I just tried to create 10 civilians with 0.2 second pause in between each creation and there was no 'hang ups' at all, and I was using that nearestObject thingy..
The object in which position the units were created was about 300 meters from my position (tested on otherwise empty Rahmadi though)..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.