OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: trooper543 on 13 Apr 2009, 18:35:09
-
Hi there All
Hope that everyone has had a wonderful Easter
Sorry to trouble you all again, i am looking for a bit of assitance with the PVP mission i am currently making, What i would like do is have a trigger/ script will give the players position away when activated but only for a short time.
In other words your enter the trigger the opposing side (Blufor) would get a hint message as well a marker that more less indicates the area you in but only stays for a short time (2mins)
If someone could please help me out that would be most appreciated or at least point me in the right direction on how to achieve this, as i need it work in MP
Many thanks inadvance
-
Your best approach is to create a script that displays the marker, and then removes it. You'll probably want to do something like this (on trigger activation):
- 1. Create the zone marker with createMarker (http://www.ofpec.com/COMREF/index.php?action=details&id=447)
2. Move it to the proper location with setMarkerPos (http://www.ofpec.com/COMREF/index.php?action=details&id=307) (no need... create the marker where you want it)- 3. Use sleep (http://www.ofpec.com/COMREF/index.php?action=details&id=776) to wait until the time has elapsed
- 4. Delete the marker with deleteMarker (http://www.ofpec.com/COMREF/index.php?action=details&id=523)
You can do this all in one script, but remember to spawn (http://www.ofpec.com/COMREF/index.php?action=details&id=784) the script so that it doesn't hold anything else up :)
-
@JamesF1
Many thnks for that mate, i dont suspose you would have a script version of this would ?
Sorry for asking just that i am no scripter
Many thanks in advance
CHeers
-
Something like this should work. I haven't tested it at all, so you'll have to debug it if it fails. Could probably be done an easier way, but I'm tired :)
Dump this in a file, say, "myscript.sqf"
if (!isServer) exitWith {};
private ["_showUnit", "_showTime", "_showMarker", "_markerName"];
_showUnit = _this select 0;
_showTime = _this select 1;
// Make a (probably) unique marker name, so we don't have clashes
// if multiple markers are named simultaneously (unlikely).
_markerName = format["marker_%1_%2", time, floor(random 100)]
// Create a marker at the unit's location.
_showMarker = createMarker[ _markerName, getPos _showUnit];
_showMarker setMarkerShape "ICON";
_showMarker setMarkerType "Dot";
_showMarker setMarkerText (name _showUnit);
// Wait
sleep _sleepTime;
// Remove the marker
deleteMarker _markerName;
You'd call this if you wanted to reveal unit "myUnit" for 30 seconds on activation:
nul=[myUnit, 30] execVM "myscript.sqf"
As I said, haven't tested the above... The best way to learn is to try it out.
-
Since you are execVMing the script, there is no reason to spawn the section of the script with the pausing in it.
Assuming the script was run with call, though, you might want to continue using the spawn, but you would want to do it this way, in order to ensure that the privates were created inside the new spawned script, not outside it (where they are actually completely ignored):
if (!isServer) exitWith {};
// Pass _this into the inner script without using it:
_this spawn
{
private ["_showUnit", "_showTime", "_showMarker", "_markerName"];
_showUnit = _this select 0;
_showTime = _this select 1;
// etc...
-
Since you are execVMing the script, there is no reason to spawn the section of the script with the pausing in it.
Whoops... I said I was tired, heh :) Revised!
-
@JamesF1
@Spooner
Gents many thanks for although you have both lost in spooners last post lol, many thanks i will test this and come back to you both
Cheers
***** EDIT*****
Okay gents now i am totally confused, how do i get this sccript to run
kind regards