Mission saying name of player who completed.

herculys

Member
i am using this crash_spawner.sqf in my server
http://pastebin.com/eY7LmPn

this crash spawner uses a _finder and shows the name of the player who arrived helicrash


and i'm using DZMS
https://github.com/SMVampire/DZMS-DayZMissionSystem


i just want do add the name of player who completed mission like the helicrash, can someone help me with that?

and another thing, i already tried to change:

[nil,nil,rTitleText,format["O HeliCrash foi capturado por %1!", _finder], "PLAIN",10] call RE;

for a hint or hintSilent box like debug monitor, but got no success, someone knows what I can do?

ps. i'm not using debug monitor by default, i have a HUD, and debug monitor come only if toggle.
 
Last edited:
i personally have never had any luck with RE calls and find it easier to use pyblicvariables and eventhandlers.

if your finder code is working for the helicrash, it should work for missions.

did you add this code also that gets the name of the nearest player and puts it into the _finder variable?
Code:
    {
   if((isPlayer _x) && (_x     distance _pos <= 25)) then {                                   _playerPresent = true;
      _finder = name _x;
                       };
                        
                 } foreach playableUnits;
 
yes, but i didnt find a place to put this so i put in each mission file, and i get this error:

_finder = name _x;

[nil,nil,rTitleText,"Uma missao foi>
14:13:12 Error position: <_x;

[nil,nil,rTitleText,"Uma missao foi>
14:13:12 Error Undefined variable in expression: _x
14:13:12 File z\addons\dayz_server\DZMS\Missions\Major\SM1.sqf, line 61
 
_x is what they call the magic variable. it contains whatever the current object is in a foreach loop. in this case it loops foreach playable unit ( all players ) and the code runs for each one. each time the _x holds the PLAYER object that is currently in the loop.
so you need the entire foreach playableunit loop

the loop and the RE code will go on your missions right where it currently says that the mission was completed. ..
 
but the helicrash use, distance _pos <= 25

i dont know if mission system uses _pos, if not, this will work?

edit
i think mission use _coords, i'll try.
 
now it worked very fine, thanks.

any news about hint box and show coordinates like gps for exemple:

Mission completed by
nameplayer
at 112 | 78​
 
So you want to use a hint box instead of the title text?
Not sure if your can use RE with hintsilent so you would have to use rhint. try this.
Code:
_text =  parseText format ["
            <t size='1' font='Bitstream' align='center' color='#5882FA'>Mission Completed by</t><br/>
            <t size='1' font='Bitstream' align='Center' >%1</t><br/>
            <t size='1' font='Bitstream' align='center' >at %2 : %3 </t><br/>",
           _finder, round(_pos select 1),round( _pos select 2)];
[nil,nil,rHINT,_text] call RE;
Personally I find it much easier to use public variables and event handlers and this is how to would perform the same as above, except I know I can use hintsilent this way.

in your mission files
Code:
//this has to include the _finder after you have gotten the players name and the position of the mission whatever its called
finder = [_finder, _position select 0, _position select 1];
publicvariable "finder";

Now in your init.sqf you can either put this code inline or you can save it to a file finder.sqf and execVM "finder.sqf" from your init.sqf

Code:
"finder" addpublicvariableeventhandler {
     //the publicvarible we sent to all computers contains an array of the name of the variable and then the data we assigned to it [finder, [players name, xpos, ypos]
      _info = finder select 1;
      hintsilent  parseText format ["
            <t size='1' font='Bitstream' align='center' color='#5882FA'>Mission Completed by</t><br/>
            <t size='1' font='Bitstream' align='Center' >%1</t><br/>
            <t size='1' font='Bitstream' align='center' >at %2 : %3 </t><br/>",
           _info select 0, _info select 0,_info select 1];
 
another question in crash_spawner.sqf has it.
Code:
 _playerPresent = false;
                        {
                                if((isPlayer _x) && (_x distance _pos <= 25)) then {
                                        _playerPresent = true;
                                        _finder = name _x;
                                };
                            
                        } foreach playableUnits;
                    
                        (_playerPresent)

i need to add this (_playerPresent) for my mission too? what this line and first line mean?
 
_playerpresent = false; is just defining the variable so you dont get the 'undefined variable' in your log file. this line here at the bottom of what you posted ..
(_playerPresent)
that executes your rhint only if _playerpresent is true. So if we dont have it set to false to begin with then you will get the undefined variable error because its not equal to anything.

So .. short story, yes you need that line also.
 
Back
Top