Heeeere's johnny! 51 Posted September 17, 2015 TIME_START = 10; Should be #define TIME_START 10 ... just being nitpicky. ;) Share this post Link to post Share on other sites
Larrow 2810 Posted September 17, 2015 Should also be _unit = _this select 0; _unit addeventHandlerbut meh thats what you get when i paste from testing in units init ;) 1 Share this post Link to post Share on other sites
thedubl 43 Posted September 17, 2015 Whoa! Thanks! I added the #define _unit. So, a couple questions. Should I wrap the isServer around it still? Should I add, "null = [this]execVM "tkpunish.sqf";" in the localplayerinit or the playable init (does it even matter)? I am visual person/learner and actually seeing that bit really solidified some things I was not sure about. I will give it a go and post back! Thanks again for all the assistance. dubl Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 17, 2015 Should I wrap the isServer around it still? Better leave it out, because you want this stuff to work client side. As long as you test on your local PC, isServer will be true. But when you actually have a running server and clients joining that server, isServer will be false on the clients. Should I add, "null = [this]execVM "tkpunish.sqf";" in the localplayerinit or the playable init (does it even matter)? You may put that into the init field of the playable unit in the ingame editor. But if you lookup here, you'll find an "initPlayerLocal.sqf" in that table. That file will be executed on the client when he joins the mission. So you could also take the above line, replace "this" by "player" and put it into a file called "initPlayerLocal.sqf" which is to be put where your "init.sqf" is located and you don't need to worry about your editor placed unit's init fields regardings this point. Share this post Link to post Share on other sites
thedubl 43 Posted September 17, 2015 Ok. I already have a initplayerlocal.init. So, I will go that route. Trying it now! Larrow I would like to clarify something. _unit = _this select 0; in the eventhandler does not need the parenthesis? Is it the same for the _killer = (_this select 1);? It wasn't working last night, but I did not really have a chance to mess with it long. initplayerlocal.init //tk scriptnull = [player]execVM "tkpunish.sqf"; tkpunish.sqf #define TIME_START = 59;TAG_fnc_teamKill = {disableUserInput true;//We can use player as we are now on the clients machine that killedplayer setCaptive true;player switchMove "AinjPpneMstpSnonWrflDnon";titleText ["Teamkill punishment!", "PLAIN", 2];sleep 3;_time = TIME_START;while {_time > 0} do {_time = _time - 1;sleep 1;titleText [format["Time Left: %1",_time], "PLAIN"];};disableUserInput false;player setCaptive false;forceRespawn player;};_unit addEventHandler ["killed", {_unit = (_this select 0);_killer = (_this select 1);//If we are a vehicle death exitif(vehicle _killer isEqualTo vehicle _unit) exitWith{};if (isPlayer _killer && { side group _unit isEqualTo side _killer} ) then {[] remoteExec [ "TAG_fnc_teamKill", _killer ];};}]; dubl Share this post Link to post Share on other sites
thedubl 43 Posted September 18, 2015 Hey there! I will try using the playable unit init since the the initplayerlocal.init was a no go. I already have some things in the player init. It is ok to have multiple exec in the init? Again, the above is exactly what I am using. example: null = [this]execVM "tkpunish.sqf"; null = [this]execVM "exmaple.sqf"; dubl Share this post Link to post Share on other sites
thedubl 43 Posted September 18, 2015 The define was not working. However, I set time in the function and it works. Thanks for the help! UPDATE: I might have spoken to soon. Doesn't seem to run on the server. Still looking into it. UPDATE: player init all working!!! Thanks! dubl WORKING BELOW: /********************************************************************************Teamkiller punishmentplace this in the initplayerlocal.initnull = [player]execVM "tkpunish.sqf";orplayable init of the unitnull = [this]execVM "tkpunish.sqf";*********************************************************************************///#define TIME_START = 10_unit= _this select 0;TAG_fnc_teamKill = {//We can use player as we are now on the clients machine that killeddisableUserInput true;player setCaptive true;player switchMove "AinjPpneMstpSnonWrflDnon";titleText ["Teamkill punishment!", "BLACK FADED", 2];sleep 3;_time = 60;while {_time > 3} do {_time = _time - 1;sleep 1;titleText [format["Time Left: %1",_time], "PLAIN"];};titleText ["Be aware of your team at all times to avoid time out!", "BLACK FADED", 2];sleep 3;disableUserInput false;player setCaptive false;forceRespawn player;};_unit addEventHandler ["killed", {_unit= _this select 0;_killer=_this select 1 ;//If we are a vehicle death exitif(vehicle _killer isEqualTo vehicle _unit) exitWith{};if (isPlayer _killer && { side group _unit isEqualTo side _killer } ) then {[] remoteExec [ "TAG_fnc_teamKill", _killer ];};}]; 1 Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 19, 2015 Just to round it out, it's supposed to be #define TIME_START 10 (without "="), not #define TIME_START = 10. Defines are no variables, but placeholders which the preprocessor searches in the script and replaces by the respective value (10 here) prior to interpreting ("compiling") the script. That's why they don't have a "=". Share this post Link to post Share on other sites
thedubl 43 Posted September 19, 2015 AHHHHH! hahaha well... I can't believe I overlooked it. Thanks everyone for helping and contributing! It is a fixed and working with define or with setting time in the function. dubl Share this post Link to post Share on other sites
davidoss 550 Posted September 20, 2015 Well the function which you wrote is no dramatic enough. Try this one. TAG_fnc_teamKill = { private ["_txt", "_output", "_declare"]; [profileName + " has killed Teammate!", "systemChat"] call BIS_fnc_MP; sleep 2; player setCaptive true; disableUserInput true; sleep 2; titleCut ["", "BLACK FADED", 999]; sleep 3; playSound "WoundedGuyA_03"; titleText ["YOU HAVE KILLED A TEAMMATE!!","PLAIN"]; titleFadeOut 5; sleep 5; playSound "WoundedGuyA_04"; titleText ["HOW COULD YOU?!","PLAIN"]; titleFadeOut 5; sleep 5; _txt = "You are experiencing extreme stress caused by killing your teammate!!"; _output = [ [_txt,"<t size='1.2' font='PuristaBold'>%1</t>",15] ]; _declare = [_output,0,0.5,"<t color='#FFFFFFFF' align='center'>%1</t>"] spawn BIS_fnc_typeText; waitUntil {scriptDone _declare}; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; titleCut ["", "BLACK IN", 5]; sleep 3; playSound "WoundedGuyA_06"; player switchMove "Acts_UnconsciousStandUp_part2"; waituntil { sleep 0.5; animationState player != "Acts_UnconsciousStandUp_part2"}; titleCut ["", "BLACK FADED", 999]; sleep 2; playSound "4Five_near"; player setdamage 0.9; player setCaptive false; disableUserInput false; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; titleCut ["", "BLACK IN", 5]; player setdamage 1; }; 1 Share this post Link to post Share on other sites
thedubl 43 Posted September 21, 2015 Hey Davidoss, That is pretty nice! dubl Share this post Link to post Share on other sites