Forum Jump :

Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2016-04-29 03:46        
     
I'm working on a project for ARMA 3 police scenario. My goal is to attach multiple objects inside the default patrol cars. (We voted against using custom cars). I have figured out how to attach a laptop to a vehicle and place it just fine but my problem is I want it to attach a laptop and other items to all the police vehicles. I have thought about possibly creating the items (laptop etc.) when a player uses a addaction on an object and it creates the object under the player and then it attaches to the nearest object but I can't seem to figure out how to go about doing that. i have looked all over the Internet and have not found anyone attempting this same idea. Thoughts?


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#2 Posted at 2016-04-29 17:53        
     
A little bit complex, and confuse for me. What do you need? what car (class)? A laptop inside the car? where? player is driver? That sounds weird. Before thinking addAction, precise the effect.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2016-04-29 21:39        
     
This is for a multiplayer mission so it will have multiple drivers. I have came up with a possible solution I just have a glitch I am trying to figure out now. For the solution I am going to make a script and the # of laptops I need and name them. Then I will setup an addaction command to a box. This addaction will take the selected laptop (ex. Laptop01) and attach it to the nearest vehicle.

Does anyone know how to attach a named object to the closesest vehicle?

Here is my idea:

Player gets a vehicle and drives it to the box to get the laptop.
Then, the player uses addaction and finds "Equip laptop 01 to the vehicle"
Then, the addaction checks for a vehicle within a 25m radius of the player and attaches the laptop to the vehicle.


is this possible?

Added 7 minutes later:

I also have a bug when attaching the laptop inside the off-road. It spawns fine and is in the right place but the problem I have is when I go into first person the laptop kinda disappears. I have an addaction on the laptop so I know it is still there but it's not there. When the off-road spawns with the passenger door missing you can see the corner of the laptop outside of the vehicle or in the dashboard but when you go back into 3rd person it is in the right place. Any ideas?

Also so when in first person outside of the vehicle you can see the laptop in the right place.

This post was edited by Lockpwnage (2016-04-29 21:49, 596 days ago)


Author Message

DL++  



Posts: 181
Rank:


Level: Member

Country: uk
Location: England
Occupation: Studying C++/C#/Python
Age:
In-game name:

 
#4 Posted at 2016-04-29 23:05        
     
Try this
It will find the nearest car to the box the action is selected form and then spawn a laptop and attach it to the car, You will have to adjust the attachTo x,y,z

Place this into the init of the box
this addAction ["Equip laptop 01 to the vehicle",{  
_car = nearestObjects [_this select 0, ["Car"], 25]; 
 
	if (count _car > 0) then { 
	target = _car select 0; 
	laptop = createVehicle ["Land_Laptop_device_F",position player , [], 0, "can_collide"]; 
	laptop attachTo [target, [-0.3, 0, 0.008] ];  
    
	};
}]
Now this is not multiplayer format as I dont know that. But Im sure someone can add to this...

EDIT: I thinks this works for multiplayer ..Not sure
this addAction ["Equip laptop 01 to the vehicle",{  
_car = nearestObjects [_this select 0, ["Car"], 25]; 
 
	if (count _car > 0) then { 
	target = _car select 0; 
	laptop = createVehicle ["Land_Laptop_device_F",position player , [], 0, "can_collide"]; 
	laptop attachTo [target, [-0.3, 0, 0.008] ];  
    
	};
}]call BIS_fnc_MP;

Break it, study it, rebuild it.

Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2016-04-29 23:46        
     
Thanks, I will test this when I get home and provide an update. I'm also wondering if this works how would I be able to addaction to the laptop spawned in the vehicle. Because, I have other laptops Ingame under the same class so I don't want all the laptops to have the addaction menu only the ones in the vehicles.


Author Message

DL++  



Posts: 181
Rank:


Level: Member

Country: uk
Location: England
Occupation: Studying C++/C#/Python
Age:
In-game name:

 
#6 Posted at 2016-04-30 00:13        
     

this addAction ["Equip laptop 01 to the vehicle",{  
_car = nearestObjects [_this select 0, ["Car"], 25]; 
 
    if (count _car > 0) then { 
    target = _car select 0; 
    laptop = createVehicle ["Land_Laptop_device_F",position player , [], 0, "can_collide"]; 
    laptop attachTo [target, [-0.3, 0, 0.008] ];  
    laptop addAction ["",""]; //Will addaction to that specific spawned object.
    };
}]call BIS_fnc_MP;




Break it, study it, rebuild it.

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#7 Posted at 2016-04-30 04:53        
     
For an addAction, you don't need to remoteExec it. (Bis_fnc_MP is prehistoric!). This is a AG EL command but EL just means that if you use a EL command in code, like hint "something", only the player who triggers the action will see "something" hint. As you want to "attachTo", AG EG command, there is no problem for other players. Fortunately this command works fine on vehicles (but inconsistent on buildings).

For toggling attach/detach laptop on an object (player in the example), see this post.

You have to write some conditions inside the command parameters (see BIKI). These conditions are the only one code here which is checked on each frame! That means you can check distance between 2 objects or evolving situation (player inside vehicle or else). For these conditions parameters you need to use the special variable _this (referring to the unit calling the action) and _target (the object the action is "attached").
example _this distance _target < 20 (player must be within 20 m from laptop)

This post was edited by Pierre MGI (2016-04-30 17:17, 595 days ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 12
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#8 Posted at 2016-04-30 18:15        
     
I tested this and it works great. Thanks!

This post was edited by Lockpwnage (2016-05-01 03:19, 595 days ago)