vehicle – Talk
Lou Montana (talk | contribs) m (Text replacement - "ArmA2" to "{{arma2}}") |
Lou Montana (talk | contribs) m (Text replacement - "<code>" to "<code style="display: block">") |
||
Line 31: | Line 31: | ||
::Ok you're incorrect. While it seems like its not working, it does. Whenever there is a named unit (player) in an unamed vehicle, the vehicle inherits the units name. I'm not great at explaining, let this code speak for itself: | ::Ok you're incorrect. While it seems like its not working, it does. Whenever there is a named unit (player) in an unamed vehicle, the vehicle inherits the units name. I'm not great at explaining, let this code speak for itself: | ||
::Get in vehicle, execute: (i used the debug console in Esc menu) | ::Get in vehicle, execute: (i used the debug console in Esc menu) | ||
::<code>'''veh''' = vehicle player;</code> | ::<code style="display: block">'''veh''' = vehicle player;</code> | ||
::'''veh''' will equal: ''B Alpha 1-1:1 (Benargee)'' <br> | ::'''veh''' will equal: ''B Alpha 1-1:1 (Benargee)'' <br> | ||
::Get out of vehicle, do not execute anything. Leave '''veh''' alone <br> | ::Get out of vehicle, do not execute anything. Leave '''veh''' alone <br> | ||
::'''veh''' will equal: ''327a4100# 5: heli_light_01_f.p3d'' | ::'''veh''' will equal: ''327a4100# 5: heli_light_01_f.p3d'' | ||
::If you're still not convinced. Execute this next when far away from vehicle. | ::If you're still not convinced. Execute this next when far away from vehicle. | ||
::<code>'''veh''' setDamage 1;</code> | ::<code style="display: block">'''veh''' setDamage 1;</code> | ||
::Vehicle will blow up, player will not die from script(if youre clear of the explosion).<br> | ::Vehicle will blow up, player will not die from script(if youre clear of the explosion).<br> | ||
::This proves that '''veh''' is attached to the vehicle and not the player character. Arma works in mysterious ways my friend, beware and think outside the box. Objects used in this example are '''B_Soldier_F''' (NATO rifleman(player)) '''B_Heli_Light_01_F''' (empty mh-9). | ::This proves that '''veh''' is attached to the vehicle and not the player character. Arma works in mysterious ways my friend, beware and think outside the box. Objects used in this example are '''B_Soldier_F''' (NATO rifleman(player)) '''B_Heli_Light_01_F''' (empty mh-9). |
Latest revision as of 11:53, 11 January 2023
saw the edit...after the fact i realized i should have put this in discussion first or asked....my mistake (tad carried away that we can finally help to improve the wiki). The confusion came from the fact that when you're in the driver seat, (vehicle player) appears to return the exact same object as player. so how can this return false (which is infact the current result, again my mistake) when its the same object?
copytoclipboard format ["%1\n%2",(vehicle player),player];
from the driver seat: B Alpha 1-1:1 (dr.strangepete)\nB Alpha 1-1:1 (dr.strangepete)
standing outside: B Alpha 1-1:1 (dr.strangepete)\nB Alpha 1-1:1 (dr.strangepete)
from passenger seat: 3a050100# 163953: offroad_01_unarmed_f.p3d\nB Alpha 1-1:1 (dr.strangepete)
-- the string-string comparison is in fact true...so only the object comparison is false if i'm understanding correctly? but the expected output should be what the passenger seat shows. (i'm not arguing whether or not its a bug, im assuming this is a design)
so is there some way to cleanly explain this in the wiki entry for others? thanks for your patience --Strangepete (talk) 17:32, 16 February 2014 (CET)
A note was added to the effect that the given example did not work with Arma 2.
This is not true it works perfectly well, but of course as it uses '?' it must be used in a script and not in init lines or trigger activation lines.
The note was removed and clarification of the example added.
Planck 13:50, 6 November 2009 (CET)
I've tried this with Arma 3 in the editor and if you don't name the vehicle, regardless of where you are in the vehicle (driver or otherwise), "vehicle player == player". Based on the logic in the example, this is incorrect as it's identifying the player as not being in a vehicle.
--Firefly2442 (talk) 00:56, 21 September 2014 (CEST)
- Ok you're incorrect. While it seems like its not working, it does. Whenever there is a named unit (player) in an unamed vehicle, the vehicle inherits the units name. I'm not great at explaining, let this code speak for itself:
- Get in vehicle, execute: (i used the debug console in Esc menu)
veh = vehicle player;
- veh will equal: B Alpha 1-1:1 (Benargee)
- Get out of vehicle, do not execute anything. Leave veh alone
- veh will equal: 327a4100# 5: heli_light_01_f.p3d
- If you're still not convinced. Execute this next when far away from vehicle.
veh setDamage 1;
- Vehicle will blow up, player will not die from script(if youre clear of the explosion).
- This proves that veh is attached to the vehicle and not the player character. Arma works in mysterious ways my friend, beware and think outside the box. Objects used in this example are B_Soldier_F (NATO rifleman(player)) B_Heli_Light_01_F (empty mh-9).
- --Benargee (talk) 19:47, 20 September 2014 (EST) Arma 3 1.28.127008
- Thanks, yeah I wasn't aware that it was doing object comparison as opposed to string comparison. Slightly confused for a moment, glad it's sorted. Cheers. :)
- --Firefly2442 (talk) 02:18, 21 September 2014 (CEST)