pliskin124 4 Posted April 26, 2017 I need a script that will spawn a vehicle on a marker through an addaction, and then despawn it if another selection is made. For instance, I want a jet pilot to be able to go up to a computer, make their selection on an aircraft, get in it, fly it around, park it anywhere, go back to the computer and select a new aircraft, but delete the old aircraft in order to save server resources. The first half of the script, spawning a vehicle on a marker is the easy part and I can probably figure out, the second half about deleting the previous vehicle and replacing it is the part I'm lost on. Any assistance would be helpful thanks. Share this post Link to post Share on other sites
tirpitz 15 Posted April 26, 2017 Rough flow:Select vehicleCheck if player has vehicle associated with themDelete old vehicleSpawn new vehicleSave vehicle variable to player for retrieval laterSent from my D6503 using Tapatalk Share this post Link to post Share on other sites
pliskin124 4 Posted April 26, 2017 Not sure how the vehicle would be associated with the player if they're not in it? Also not really sure where to go from there as far as scripting goes. Share this post Link to post Share on other sites
Midnighters 151 Posted April 26, 2017 5 hours ago, pliskin124 said: Not sure how the vehicle would be associated with the player if they're not in it? Also not really sure where to go from there as far as scripting goes. tirpitz means that the player now has an assigned vehicle. Just like if you were to plop a unit into a helo, now you can see that it's assigned to the unit and you can tell if the unit has flown or ridden in the helo. if((assignedVehicle player) isEqualTo objNull) then { hint "player has no vehicle assigned" } else { hint format["Player has vehicle : %1 assigned to it",(assignedVehicle player)];}; example. Share this post Link to post Share on other sites
pierremgi 2699 Posted April 26, 2017 Not sure that assigning the vehicle is the best solution in case of shift or respawn or else. What you can do is to set a variable for the vehicle when spawned: _veh setVariable ["creator", _thisPlayer]; then, you can delete it: {deleteVehicle _X} forEach (vehicles select {_x getVariable "creator" == _thisPlayer}); Share this post Link to post Share on other sites
tirpitz 15 Posted April 26, 2017 That's not what I meantI meant something along the lines ofPlayer setvariable ["veh", _veh]Sent from my D6503 using Tapatalk Share this post Link to post Share on other sites