Jump to content
Sign in to follow this  
fight9

VicMarker v1 - Customizable & Dynamic Vehicle Marker Script

Recommended Posts

VicMarker v1



Customizable & Dynamic Vehicle Marker Script

By Fight9

vicmarkerpic.png

I have been teaching myself scripting over the last couple of weeks and have finally been able to create something that was worth a thread. This script is very simple in principle but has a huge amount of options that make it helpful. I was working on a high command mission and was annoyed that I could never get getIn waypoints close to my empty vehicles; they needed markers! In most basic form, the script adds a dynamic marker to your vehicle and tracks its position. At the same time, it detects whether the vehicle is alive, disabled, or dead. The marker and text change depending on its status. You can define a total of 9 parameters when calling the script, but only if you want. If you like the markers and colors I have chosen, you can stick with the default ones and are not required to define them in the parameters.

Features:

- Script creates a marker and follows the vehicle

- Vehicles have three states: Alive, Disabled, and Dead

- All three states have customizable icons

- Definable icon, color, hints, and whether the icon is removed with destruction

- Makers are updated every 3 seconds with new vehicle positions

- The Script uses the vehicles name as its marker name, so if you need to find the marker in another script or trigger, it would be easily definable

- Script includes a complete list of marker icons and colors available

Usage:

To use the script, all you have to do is move the vicMarker.sqf into your mission folder and add this line to your vehicles INIT (name your vehicle!)

null = [this] execVM "vicMarker.sqf";

If you want to change any of the marker parameters, here are the default ones being used (Look in the sqf file for a full list of icons and colors)

null = [this, "Victor Name", false, true, "b_support", "ColorWest", "b_maint", "ColorBlack", "hd_warning", "ColorRed"] execVM "vicMarker.sqf";

Here is all those parameters explained:

null = [this, " Marker Display Name", Display Status Hints (true/false), display destroyed marker (true/false), "Alive Marker Type", "Alive marker color", "Disabled Marker Type", "Disabled Marker Color", "Destroyed Marker Type", "Destroyed Marker Color"] execVM "vicMarker.sqf"; 

You can also use this in a trigger, your unit.sqf, or another script by replacing 'this' with the vehicle name

null = [Victor1] execVM "vicMarker.sqf";

Known Issues:

- The Hints are local and don't like to work in MP. Until I can figure out how to send them globally, I have them disabled by default (changeable in parameters).

- If you don't name your vehicle nor declare a display name in the parameters, the name ends up being a long string of numbers and the model file name.

- The "Disabled" state is defined by the canMove command. If often requires half of the tires to be gone or the engine on red. Vehicles are mostly disabled before then though

Future Plans:

- Add vehicle/unit/faction detection and define marker icons accordingly

- Find a better way to detect damage on a vehicle

- Optimize?

Download:

Example Mission

Help:

If any of you amazing scripters around here have a few moments to look at this and tell me what I did wrong, or what I could improve on, I would appreciate it a lot. I am releasing this because I figure that it might help me learn more advanced techniques. I'm sure my methods are often wrong...

Share this post


Link to post
Share on other sites

Release frontpaged on the Armaholic homepage.

==================================================

You are not registered on Armaholic, or at least not that we are aware of. In the future we offer the possibility to authors to maintain their own pages.

If you wish to be able to do this as well please register on Armaholic and let me know about it.

This is not mandatory at all! Only if you wish to control your own content you are welcome to join, otherwise we will continue to follow your work like we have always done ;)

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Known Issues:

- The Hints are local and don't like to work in MP. Until I can figure out how to send them globally, I have them disabled by default (changeable in parameters).

BIS_fnc_MP is great for sending anything globally or to certain units.

From your code line 63

hint format ["%1 Has Been Repaired",_text]; // Hint vehicle disabled

You can send it globally using this.

[[{hint format ["%1 Has Been Repaired",_text];}],"BIS_fnc_Spawn",true] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites

To touch on what Johnson's said, you can also send the hint to any given unit.

[{hint "the vehicle has been repaired";},"BIS_fnc_spawn", _theGuy, false] spawn BIS_fnc_MP;

Share this post


Link to post
Share on other sites

How would I go about making the script continue after the vehicle respawns. I am using the BIS Vehicle Respawn Module. When the vehicle respawns the destroyed marker remains where the vehicle was destroyed and the script doesn't fire again from the vehicle respawn module.

In the expression line of the module I have:

(this select 0) null = [this] execVM "vicMarker.sqf";

I am sure the error is in the syntax of the module's expression line but I am having difficulty finding anything on how to correctly input.

Share this post


Link to post
Share on other sites
How would I go about making the script continue after the vehicle respawns. I am using the BIS Vehicle Respawn Module. When the vehicle respawns the destroyed marker remains where the vehicle was destroyed and the script doesn't fire again from the vehicle respawn module.

In the expression line of the module I have:

(this select 0) null = [this] execVM "vicMarker.sqf";

I am sure the error is in the syntax of the module's expression line but I am having difficulty finding anything on how to correctly input.

That's a good question, sir. I am working on a similar problem at the moment involving markers and vehicle respawn (and teleportation). Perhaps when I find the solution, I'll apply it to this script as well. I have not touched this script since I made the OP. It was the first coherent script I wrote and I have learned A LOT since then. The problem I face right now, is that when the old vehicle is deleted and the new vehicle is created with the same vehicleVarName, the script no longer recognizes it.

I am thinking of writing my own respawn script to conclude the script/mod I am currently working on via damage eventHandlers. It's just a concept in my head at the moment, but perhaps I'll get some time soon to figure it out and place it into the game. It's that, or a way to adjust the marker position characteristics when the new vehicle is created.

In the meantime however, using

null = [this] execVM "vicMarker.sqf";

in the modules expression line should work. If not, try using the vehicle name instead of the [this]. Ie null = [victor1] execVM. I don't not have much experience with the BIS vehicle respawn module, so I cannot tell you how it exactly works.

Share this post


Link to post
Share on other sites
That's a good question, sir. I am working on a similar problem at the moment involving markers and vehicle respawn (and teleportation). Perhaps when I find the solution, I'll apply it to this script as well. I have not touched this script since I made the OP. It was the first coherent script I wrote and I have learned A LOT since then. The problem I face right now, is that when the old vehicle is deleted and the new vehicle is created with the same vehicleVarName, the script no longer recognizes it.

I am thinking of writing my own respawn script to conclude the script/mod I am currently working on via damage eventHandlers. It's just a concept in my head at the moment, but perhaps I'll get some time soon to figure it out and place it into the game. It's that, or a way to adjust the marker position characteristics when the new vehicle is created.

In the meantime however, using

null = [this] execVM "vicMarker.sqf";

in the modules expression line should work. If not, try using the vehicle name instead of the [this]. Ie null = [victor1] execVM. I don't not have much experience with the BIS vehicle respawn module, so I cannot tell you how it exactly works.

Well, I got it to work. Created a function then called it from the vehicle respawn module

(_this select 0) spawn MH1_Respawn;

I had to edit your script a bit too (sorry :o ) I'm sure there are errors (like the deleted markers moving to the bottom left of the map).

[ALiVE]Occupation.Altis.pbo]Here is a link to the .pbo of the mission I am building using your script. You will need to launch with the ALiVE mod to edit.

Edited by Rellikplug
clarification

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×