progamer 14 Posted July 27, 2013 (edited) If someone could please help me make these two scripts work, i would be very thankful! The other issue I have had is making the scripts run with the mission start and work throughout the mission. The "C" key should make your character jump. https://www.dropbox.com/sh/d6qdrbi2rxqd0ur/31sz_nkysF The two scripts are from the discontinued Stratis-RP. I have permission to make them work as a standalone and release and maintain them for public use. Edited July 27, 2013 by ProGamer Share this post Link to post Share on other sites
Ed! 13 Posted July 27, 2013 I can help you with jumping :P keyPress_jump = 57; //spacebar disableSerialization; private["_display"]; _display = nil; waituntil { _display = findDisplay 46; if (isNil "_display") exitWith {false}; if (isNull _display) exitWith {false}; true; }; keyPress = { keyPress_lastPressed = _this select 1; _return = false; if(_this select 1 == keyPress_jump) then { if(isTouchingGround player) then { player setVelocity [velocity player select 0, velocity player select 1, 5]; }; _return = true; }; _return; }; _display displayAddEventHandler ["KeyDown", "_this call keyPress"]; Share this post Link to post Share on other sites
progamer 14 Posted July 27, 2013 (edited) onKeyPress = compile preprocessFile "onKeyPress.sqf"; waituntil {!(IsNull (findDisplay 46))}; (findDisplay 46) displaySetEventHandler ["KeyDown", "_this call onKeyPress;"]; jumping = 0; fn_Jump = { if(jumping == 1 || (!(isTouchingGround player)) || climbing == 1) exitWith {}; if(vehicle player == player) exitWith { if(speed player > 17) then { jumping = 1; player setVelocity [(velocity player select 0),(velocity player select 1),(velocity player select 2) + 4]; [[player,"AovrPercMrunSrasWrflDf"],"fn_Animation",nil,false] spawn BIS_fnc_MP; waitUntil {animationState player != "AovrPercMrunSrasWrflDf"}; jumping = 0; }; }; }; ---------- Post added at 20:45 ---------- Previous post was at 20:27 ---------- How do i eliminate onKeyPress.sqf so its only uses one script? ---------- Post added at 20:47 ---------- Previous post was at 20:45 ---------- onKeyPress.sqf if(!alive player) exitWith {_handled}; case 46: { if(vehicle player == player) then {[] spawn fn_Jump;}; }; _handled; Edited July 27, 2013 by ProGamer Share this post Link to post Share on other sites
Ed! 13 Posted July 27, 2013 onKeyPress = { if(!alive player) exitWith {_handled}; case 46: { if(vehicle player == player) then {[] spawn fn_Jump;}; }; _handled; }; Share this post Link to post Share on other sites
progamer 14 Posted July 27, 2013 (edited) Ok, so what am i doing wrong? Jump.sqf onKeyPress = { if(!alive player) exitWith {_handled}; case 46: { if(vehicle player == player) then {[] spawn fn_Jump;}; }; _handled; }; jumping = 0; fn_Jump = { if(jumping == 1 || (!(isTouchingGround player)) || climbing == 1) exitWith {}; if(vehicle player == player) exitWith { if(speed player > 17) then { jumping = 1; player setVelocity [(velocity player select 0),(velocity player select 1),(velocity player select 2) + 4]; [[player,"AovrPercMrunSrasWrflDf"],"fn_Animation",nil,false] spawn BIS_fnc_MP; waitUntil {animationState player != "AovrPercMrunSrasWrflDf"}; jumping = 0; }; }; }; init.sqf: execVM "jump.sqf"; waitUntil {!isNil "fn_Jump"}; Edited July 27, 2013 by ProGamer Share this post Link to post Share on other sites
ylguf 1 Posted July 28, 2013 Ok, so what am i doing wrong? I might be wrong on a couple of these but 1. your missing a key pressed event handler 2. your using a case without a switch 3. you have (vehicle player == player) running multiple times (only need it once) 4. you are checking players speed. I don't see why this is relevant to why they can jump or not, I could see It affecting the total height jumped but why is it only possible to jump when you are running faster then 17km/h 5. you are calling fn_animation and im assuming its not defined anywhere 6. there is a nil in the BIS_fnc_MP. im pretty sure nil will return errors or make it not execute at all. it needs to be bool/object/group/side/playerid 7. what is _handled. why is it there and what is its purpose 8. mixed inline and newline formatting(it makes it look like copy and pasted stuff from other people) Share this post Link to post Share on other sites
Ed! 13 Posted July 28, 2013 I might be wrong on a couple of these but1. your missing a key pressed event handler 2. your using a case without a switch 3. you have (vehicle player == player) running multiple times (only need it once) 4. you are checking players speed. I don't see why this is relevant to why they can jump or not, I could see It affecting the total height jumped but why is it only possible to jump when you are running faster then 17km/h 5. you are calling fn_animation and im assuming its not defined anywhere 6. there is a nil in the BIS_fnc_MP. im pretty sure nil will return errors or make it not execute at all. it needs to be bool/object/group/side/playerid 7. what is _handled. why is it there and what is its purpose 8. mixed inline and newline formatting(it makes it look like copy and pasted stuff from other people) number 6 is ok. nil means the script is executed at every player. Share this post Link to post Share on other sites
progamer 14 Posted July 28, 2013 I had one of the forum member help and was able to get it working but still working on getting the running jump animation to play. Share this post Link to post Share on other sites
ylguf 1 Posted July 28, 2013 number 6 is ok. nil means the script is executed at every player. thanks for replying, could someone confirm this or elaborate on this. to my knowledge true executes on every client and false will execute on the server. nowhere in the documentation does it mention nil. and i cant come up with any logic that makes sense of (true == nil). or any of the following (bool/object/group/side/playerid == nil) that being said i haven't used nil in this command always bool/object and the animation not playing might have something to do with #5 if my assumption is correct Share this post Link to post Share on other sites
progamer 14 Posted July 28, 2013 The animation is acually a "running jump" animation BIS made. Share this post Link to post Share on other sites