Home   Help Search Login Register  

Author Topic: SetPos Getpos Tuts?  (Read 766 times)

0 Members and 2 Guests are viewing this topic.

cpt.Hawkeyez

  • Guest
SetPos Getpos Tuts?
« on: 26 Oct 2003, 19:47:54 »
can anyone point me in the right direction for a Setpos Tutorial Im trying to make a couple of bases and I forgot everything since I havent played in quite along time.

/CymPatheeY

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:SetPos Getpos Tuts?
« Reply #1 on: 26 Oct 2003, 20:50:32 »
Code: [Select]
this setpos [getpos this select 0, getpos this select 1, Z]
Put this in the init field of an object, and replace Z with a number. That will place the object Z meters above the ground.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

sanam

  • Guest
Re:SetPos Getpos Tuts? Right Here.
« Reply #2 on: 27 Oct 2003, 03:06:08 »
You Ready ?

Let's Go then

Create a reference object, on the map, where you want it.
name it Object. Can even be a GameLogic.
In the Init, do:

This exec "BaseCreator.sqs"

&& Create an .SQS called "BaseCreator"...

For sure.

in your sqs, try:

_Object = Object
; it's to tell the script what's your reference.
; then do this:

_axisX = getpos _Object select 0
_axisY = getpos _Object select 1
_axisZ = getpos _Object select 2

; So now _axisX is the X coord of your Object, & so on.

; then Camcreate your objects in relative position from your reference Object.
; To know how to find the real names,  the right names OFP uses, look at the posts's bottom.
; DyL stands for "Distance you'll like"
; & Ayl for "Angle you'll Like".

_NewBuild0 = "NameOfObject" camcreate [_axisX+Dyl,_axisY+Dyl,axisZ+Dyl] setdir Ayl
_NewBuild1 = "...

; this way you can pile up, rotate, and so on. As much as you like.


_newBuild stands for nothing, it's to have a pretty numbered list on the side.
_axisX & others may be called the way you like also.

Here comes a funny example: this is a target made of multiple books, that I use to be sure my AddonWeapon I'm workin on is accurate enough & isn't too powerfull: If all the books explodes in every direction, then it is too much. And if only one of them moves, I got the right info on actual accuracy.

My ref object is a soldier, called "Dum2" with this init line:
removeallweapons this; this setbehaviour "careless"; this exec "tar2.sqs"

_Victim = dum2
_book0 = aaa553

_px = getpos _Victim select 0
_py = getpos _Victim select 1
_pz = getpos _Victim select 2


_book0 = "aaa553" camcreate [_px+0.00,_py+2,_pz+0.25] setdir 45
_book1 = "AAA553" camcreate [_px+0.40,_py+2,_pz+0.25] setdir 45
_book2 = "AAA553" camcreate [_px+0.10,_py+2,_pz+0.65] setdir 45
_book3 = "AAA553" camcreate [_px+0.30,_py+2,_pz+0.65] setdir 45
_book4 = "AAA553" camcreate [_px+0.05,_py+2,_pz+1.00] setdir 45
_book5 = "AAA553" camcreate [_px+0.35,_py+2,_pz+1.00] setdir 45
_book6 = "AAA553" camcreate [_px+0.05,_py+2,_pz+1.30] setdir 45
_book7 = "AAA553" camcreate [_px+0.35,_py+2,_pz+1.30] setdir 45
_book8 = "AAA553" camcreate [_px+0.20,_py+2,_pz+1.75] setdir 45

exit




Acknoweledgements:
 
Chris's OFP Script Editor http://www.chenderman.com/CHOFPSE.htm
KEG EdUpgrade http://www.ofpec.com/editors/browse.php?browsewhat=3
The-Architect Firing Range http://www.ofpec.com/missions/linkstats.php?ID=780 is where I put my targets

cheers, hope it helps.

Peacepunk.

PS. and More Links:
The build-in "Camera.sqs" is also a great way to find the coordinates of the position  you want on the map. Check
Messiah's camera.sqs  tut to find how:
http://www.ofpec.com/editors/browse.php?category=1_3
And also several other ways to find your pos can be found in the Script Depot:
http://www.ofpec.com/editors/browse.php?browsewhat=2&category=2_10

If you got a position this way, then it's just Copy/Paste in your SQS job. Maybe easier.


NOW...

How to know the codename of this nice church ? Create an empty map mission, save it a sensitive way ie ObjectCodeFinder, In This mission put only the object you're lookin' for (well, with you as player of course), preview to be sure it's the good one,  save the mission, get out, open the SQM file from YourSensibleNamedMission folder, and find it: it's the only object that's not a player !

I now there are references all around, but it happens not for the object I was lookin' after in the editorUpgrade: the "AAA553" black book...  
« Last Edit: 27 Oct 2003, 03:25:25 by PeacePunk »