Home   Help Search Login Register  

Author Topic: MP Player Vs Player help  (Read 2021 times)

0 Members and 1 Guest are viewing this topic.

Offline trooper543

  • Members
  • *
MP Player Vs Player help
« 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

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: MP Player Vs Player help
« Reply #1 on: 13 Apr 2009, 19:26:54 »
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
  • 2. Move it to the proper location with setMarkerPos (no need... create the marker where you want it)
  • 3. Use sleep to wait until the time has elapsed
  • 4. Delete the marker with deleteMarker

You can do this all in one script, but remember to spawn the script so that it doesn't hold anything else up :)
« Last Edit: 13 Apr 2009, 22:09:25 by JamesF1 »

Offline trooper543

  • Members
  • *
Re: MP Player Vs Player help
« Reply #2 on: 13 Apr 2009, 21:28:22 »
@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

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: MP Player Vs Player help
« Reply #3 on: 13 Apr 2009, 22:08:14 »
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"
Code: [Select]
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:
Code: [Select]
nul=[myUnit, 30] execVM "myscript.sqf"
As I said, haven't tested the above...  The best way to learn is to try it out.
« Last Edit: 14 Apr 2009, 01:39:06 by JamesF1 »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: MP Player Vs Player help
« Reply #4 on: 14 Apr 2009, 01:37:27 »
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):
Code: (called version of the script) [Select]
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...
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: MP Player Vs Player help
« Reply #5 on: 14 Apr 2009, 01:38:29 »
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!

Offline trooper543

  • Members
  • *
Re: MP Player Vs Player help
« Reply #6 on: 18 Apr 2009, 02:47:15 »
@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
« Last Edit: 21 Apr 2009, 16:00:48 by trooper543 »