SmokeyMeadow
Well-Known Member
Hi there. it's been a while since I posted, but I'm getting back into DayZ and have a new script I'm working on. Basically, this script allows players to tag certain signs with their choice of picture from a preset menu. I have a number of bases on my server with signs out front, and signs on the roadside all over the map. Tagging the signs allows players to "claim" these areas. At least it would, but I'm having some problems with the signs being persistent after the player leaves the session.
Does anyone know why this might be? I'm using the setobjecttexture command, which executes perfectly and skins the sign with a paa file just how I want it. I believe the problem may lie in the script executing on the client side but not the server side.
Here's my fn_selfaction to activate the signs:
That goes in fn_selfactions, obviously.
Here is a sample menu:
Make a folder called scripts in your mission folder, then make a folder called tagit in there, and finally put the above code into an sqf file called tagmenu sqf which goes in the tagit folder.
Here's a sample of the actual sqf that does the skinning. This is where the problem is occurring.
You name that tag1.sqf, or tag2, whatever you want it to be. Then you put this paa file into a folder called "paa" in your mission folder. It's just a sample image, a classic menacing badguy target from a shooting range in one of my bases. Feel free to use your own paa images.
As for my original question, does anyone know why this wouldn't be persistent until at least the server restarts?
Does anyone know why this might be? I'm using the setobjecttexture command, which executes perfectly and skins the sign with a paa file just how I want it. I believe the problem may lie in the script executing on the client side but not the server side.
Here's my fn_selfaction to activate the signs:
Code:
//SIGN START
if (cursorTarget isKindOf "WarfareBunkerSign" && (player distance cursorTarget < 5)) then {
if (s_player_sign < 0) then {
s_player_sign = player addAction ["Alter Sign","scripts\tagit\tagmenu.sqf",cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_sign;
s_player_sign = -1;
} ;
//SIGN END
That goes in fn_selfactions, obviously.
Here is a sample menu:
Code:
//Tagit! by Smokey Meadow
tagchoice = nil;
myTag =
[
["",true],
["Please select your tag:", [-1], "", -5, [["expression", ""]], "1", "1"],
["", [], "", -5, [["expression", ""]], "1", "1"],
["Tag 1", [], "", -5, [["expression", "tagchoice = 1;"]], "1", "1"],
["Tag 2", [], "", -5, [["expression", "tagchoice = 2;"]], "1", "1"],
["Tag 3", [], "", -5, [["expression", "tagchoice = 3;"]], "1", "1"],
["Tag 4", [], "", -5, [["expression", "tagchoice = 4;"]], "1", "1"],
["", [], "", -5, [["expression", ""]], "1", "0"],
["Exit", [], "", -3, [["expression", ""]], "1", "1"]
];
showCommandingMenu "#USER:myTag";
waitUntil {!isNil ("tagchoice")};
if (tagchoice == 1) then {execVM "scripts\tagit\tag1.sqf";};
if (tagchoice == 2) then {execVM "scripts\tagit\tag2.sqf";};
if (tagchoice == 3) then {execVM "scripts\tagit\tag3.sqf";};
if (tagchoice == 4) then {execVM "scripts\tagit\tag4.sqf";};
Make a folder called scripts in your mission folder, then make a folder called tagit in there, and finally put the above code into an sqf file called tagmenu sqf which goes in the tagit folder.
Here's a sample of the actual sqf that does the skinning. This is where the problem is occurring.
Code:
private ["_tagsign"];
if (isServer) exitwith {};
player playActionNow "Medic";
sleep 1;
//titleText ["Sign claimed for target practice!","PLAIN DOWN"]; titleFadeOut 5;
_tagsign = nearestObject [player, "WarfareBunkerSign"];
_tagsign setObjectTexture [0,"paa\t1.paa"]
sleep 1;
You name that tag1.sqf, or tag2, whatever you want it to be. Then you put this paa file into a folder called "paa" in your mission folder. It's just a sample image, a classic menacing badguy target from a shooting range in one of my bases. Feel free to use your own paa images.
As for my original question, does anyone know why this wouldn't be persistent until at least the server restarts?