Home   Help Search Login Register  

Author Topic: setpos vehicles groups  (Read 676 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
setpos vehicles groups
« on: 14 Oct 2003, 17:33:26 »
I have a group of tanks called tankgrp1.

a gamelogic named safespot.

When I want to setpos the whole tankplatoon I place

"_x setpos getpos safespot" foreach units tankgrp1

in a trigger or waypoint.

But only the crew is setpos-ed to safespot... why?

How can I setpos the tanks with the crew inside?



« Last Edit: 14 Oct 2003, 17:34:28 by Blanco »
Search or search or search before you ask.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:setpos vehicles groups
« Reply #1 on: 14 Oct 2003, 18:54:48 »
lol that must have been quite funny the first time you tested it ... a dozen crewmen running around without tanks.    Only the crew get setpossed because only loons can be in groups ... a tank is an inanimate vehicle, it's not in a group.

Anway, try setPossing the vehicles.    

"_x setpos getpos safespot" foreach [tank1,tank2,tank3]

syntax not guaranteed.

If the crew get stranded use moveingunner/driver/commander commands to put them back in.
« Last Edit: 14 Oct 2003, 18:55:07 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline Blanco

  • Former Staff
  • ****
Re:setpos vehicles groups
« Reply #2 on: 14 Oct 2003, 19:39:28 »
 :-\ So I have to name every single unit in the group?


OK, then...

other question about setpos...

In the attachment you see a picture of a simulated searchlight I made with a m2 machinegun. You can see I setpos-ed a tablelamp (from reallights.pbo) on the pole of the mg where the lightbeam starts. The mg turns (mgspot.sqs from Sui) without a gunner cos I moved in a gamelogic as gunner.
I can only setpos the tablelamp on the edge of the platform of the tower. When I setpos it in the middle of tower it doesn't seem to work. The tablelamp stays on the ground. It looks like the tower (barracksV1.1.pbo) object blocks it.

I tried to setpos the lamp real high and a few seconds later in the position I need. No succes...

Is there a solution for this?
 




Search or search or search before you ask.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:setpos vehicles groups
« Reply #3 on: 14 Oct 2003, 20:06:27 »
No.   You need to name the vehicles you want to move.

Your command moves the members of the group.    But what you want to do is move the vehicles, which are not members of the group.  (They are just where the group members happen to be at the time.)   So the setPos command has to refer to the vehicles.

Check the jpg, all I get is a black screen with a white dot in the middle.
Plenty of reviewed ArmA missions for you to play

Unnamed

  • Guest
Re:setpos vehicles groups
« Reply #4 on: 14 Oct 2003, 23:40:28 »
You could do this, but if you can give them a group name then doing as macguba suggested should be as easy?

Code: [Select]
_Vehicles=[] ; "If !((Vehicle _x) In _vehicles) Then {_vehicles=_vehicles+[Vehicle _x]}" ForEach (units tankgrp1) ; "_x setpos getpos safespot" ForEach _vehicles
I think you need to turn the brightness up, I can just see the silhouette of the tower and mg  :o

What happens if you camcreate the lamp straight into position, I though that ignores other objects proximity?

Well I managed to camcreate a cupboard over a soldier, to use as camo in an urban conflict. It did not work BTW, the AI just used it to store groceries :)

Offline Blanco

  • Former Staff
  • ****
Re:setpos vehicles groups
« Reply #5 on: 16 Oct 2003, 21:00:33 »
For some reason, my screenshots are always darker when I take them with printscreen. When I ALT-TAB to desktop to see them, they look good, but when I exit OFP all the pitures I took become a lot darker;

Anyway, I took some new screens + the very neat mgspot-script from Sui with a small modification by me..
Maybe there's something wrong with it, I'm not a very good scripter...
As you can see the tablelamp is in the right position as long as there no object underneath it.
Why's that?

It's amazing to see what people try to simulate a searchlight euh?
Common, great addonmakers, please give us a searchlight...
AFAIK you can't place a light on a barrel, so Ai or player can't use it, .We can use the mgspot.sqs to make it turn, it's better than nothing
 
Code: [Select]
; -- MG Searchlight Script --
; Written by Sui

; Execution line:
; [MG,Left arc limit, right arc limit] exec "spot.sqs"
; eg. [mgun1,90,270] exec "spot.sqs"

; -- Selects the arguements: [Machinegun, left limit of search arc, right limit of search arc]
_mg = _this select 0
_llimit = _this select 1
_rlimit = _this select 2
; -- Set the variable that calls the 2nd loop (to track the player)
detected = false
; -- sets the initial direction of the MG inbetween the two limits
_newhdg = (_rlimit + _llimit)/2

;;=============================================
;;YOU NEED REALLIGHTS.PBO FOR THIS!!!
;;=============================================
_sp = "LRLDeskWhite" createvehicle getpos _mg
=============================================

_xpos = getpos _mg select 0
_ypos = getpos _mg select 1
_zpos = getpos _mg select 2

;;===================================================
;;Tablelamp position
;;===================================================

_sp setpos [_xpos,_ypos,(_zpos) +0.8]

;;=======================================================
;; it looks better when the tablelamp don't shine imho
;;=======================================================
;_sp inflame true


; -- First loop... random searchlight movements
#searchloop
~0.05
; -- finds the direction of the MG relative to a random heading between the arc limits
; -- If the MG's heading is within 10 degrees of the random heading, it chooses a new random heading
? (getdir _mg - _newhdg) < 10 and (getdir _mg - _newhdg) > - 10: _newhdg = ((random (_rlimit - 90)) + _llimit)
? (getdir _mg - _newhdg) > 0: _mg setdir ((getdir _mg) - 1)
? (getdir _mg - _newhdg) < 0: _mg setdir ((getdir _mg) + 1)

; -- find the direction of the player relitive to the MG
_dirplr = ((getpos player Select 0) - (getpos _mg Select 0)) ATan2 ((getpos player Select 1) - (getpos _mg Select 1))
? _dirplr < 0: _dirplr = _dirplr + 360
? _dirplr > 360: _dirplr = _dirplr - 360
;;=====================================
;;update the direction of the tablelamp
;;=======================================
_sp setdir getdir _mg +90
;;=====================================

; -- If the player is within 5 degrees of the MG's heading (in the searchlight) and the MG knows the player
; -- is there, the alarm is tripped
? (getdir _mg - _dirplr) < 5 and (getdir _mg - _dirplr) > - 5 and (_mg knowsabout player > 1): detected = true
; -- If the player hasn't been detected, and the MG still has an alive gunner, the loop repeats
? not (detected) and ((count crew _mg) > 0): goto "searchloop"

; -- Second loop... tracks the player with the searchlight
#detectedloop
~0.05
; -- finds the bearing from the MG to the player, and makes sure it is within range (0 - 360)
_newhdg = ((getpos player Select 0) - (getpos _mg Select 0)) ATan2 ((getpos player Select 1) - (getpos _mg Select 1))
? _newhdg < 0: _newhdg = _newhdg + 360
? _newhdg > 360: _newhdg = _newhdg - 360
; -- Moves the direction of the MG depending on the bearing to the player
? (getdir _mg - _newhdg) > 0: _mg setdir ((getdir _mg) - 2)
? (getdir _mg - _newhdg) < 0: _mg setdir ((getdir _mg) + 2)
; -- If there is still a live gunner manning the MG the loop goes around again
? (east countside (crew _mg) > 0): goto "detectedloop"
« Last Edit: 16 Oct 2003, 21:19:00 by Blanco »
Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re:setpos vehicles groups
« Reply #6 on: 16 Oct 2003, 21:20:10 »
here's reallights.pbo, I couldn't find a working link...sorry
Search or search or search before you ask.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:setpos vehicles groups
« Reply #7 on: 16 Oct 2003, 21:35:38 »
as 4 da setposing vehicles thingyi think it wud work only 2 do it like dat

"(vehicle _x) setpos getpos safespot" foreach units tankgrp1

can u put example mision 4 ur script ? help us help u ;) :P

LCD OUT

« Last Edit: 16 Oct 2003, 21:37:06 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Blanco

  • Former Staff
  • ****
Re:setpos vehicles groups
« Reply #8 on: 16 Oct 2003, 22:34:14 »
LCD,

It's for a very difficult intro of a large battle, where I place & replace units & vehicles at the very last moment to reduce lag during the intro. At least I'm trying to do that.

Creating them with createunit & creatvehicle causes lag, so I choose to setpos them and even revive them if nessecary...

Naming the tanks works great, but it's always good to learn some other ways, I try your example soon.thx.








 

Search or search or search before you ask.