aimgame 5 Posted November 23, 2023 Hi people! Im trying to invent football script for a3. And in Editor it already works pretty fine. But in MP there's something strange in the neighborhood way it works - first few seconds i can easely kick and punch the ball and it jumps and flyes like it should. But then suddenly it stucks in a spot and just spins around itself if i kick it, but it's not moving anywhere... Anyone have any ideas how come? P.S. If there was something that turns off the simulation, i guess the ball wouldn't spin then. Also it doesn't really matter what way i create the ball: whether its from server or a client - situation is the same. Share this post Link to post Share on other sites
mrcurry 470 Posted November 23, 2023 1 hour ago, aimgame said: Hi people! Im trying to invent football script for a3. And in Editor it already works pretty fine. But in MP there's something strange in the neighborhood way it works - first few seconds i can easely kick and punch the ball and it jumps and flyes like it should. But then suddenly it stucks in a spot and just spins around itself if i kick it, but it's not moving anywhere... Anyone have any ideas how come? P.S. If there was something that turns off the simulation, i guess the ball wouldn't spin then. Also it doesn't really matter what way i create the ball: whether its from server or a client - situation is the same. Woop looks like I'm first, that makes this the perfect time to say, in perfect Samuel L. Jackson: Show the football-kicking code in your football-kicking mission. Share this post Link to post Share on other sites
JCataclisma 36 Posted November 23, 2023 I would guess it might be related to simulation as well. At least for some pulling/tow vehicles systems we have in Invade&Annex, it's known that the pulled vehicle will stop almost instantly once the lead truck no longer receives input from player. Share this post Link to post Share on other sites
aimgame 5 Posted November 24, 2023 19 hours ago, mrcurry said: Woop looks like I'm first, that makes this the perfect time to say, in perfect Samuel L. Jackson: Show the football-kicking code in your football-kicking mission. Sure:) i have an NPC that allows to register on the match, with this code: private["_trig","_gotBall"]; _trig = [_this,0,objNull,[objNull]] call BIS_fnc_param; if (isNull _trig) exitWith {}; _gotBall = false; { if ("plp_bo_beachballred.p3d" in str _x) exitWith {_gotBall = true}; } forEach (vehicles inAreaArray _trig); if (_gotBall) exitWith {hint "The match is already started! Registration not allowed!"}; player setVariable ["isFootballist",true]; hint "You are registered as a participant!"; Then i have a football zone trigger: private["_trig","_pos"]; FTBLtrig = [_this,0,objNull,[objNull]] call BIS_fnc_param; if (isNull FTBLtrig) exitWith {}; if (vehicle player != player) exitWith {hint "Cant play in vehicle!"}; if !(currentWeapon player isEqualTo "") exitWith {hint "Cant play with weapon!"}; if !(primaryWeapon player isEqualTo "") exitWith {hint "Cant play with weapon!"}; if !(secondaryWeapon player isEqualTo "") exitWith {hint "Cant play with weapon!"}; if !(handgunWeapon player isEqualTo "") exitWith {hint "Cant play with weapon!"}; if !(player getVariable["isFootballist",false]) exitWith {hint "You're not registered!"}; _pos = position FTBLtrig; [FTBLtrig] execvm "aims_footballSpwnBall.sqf"; while {player inArea FTBLtrig} do { player allowDamage false; FTB_EH = (findDisplay 46) displayAddEventHandler ["MouseButtonDown",{ if (player inArea FTBLtrig) then { if ((_this select 1) == 0) then { if ((typeOf cursorObject in ["plp_bo_VolleyBall_Mvl","plp_bo_BeachBallRed_Mvl"]) and ((cursorObject distance player) < 3)) then { [parseText format["<t font='PuristaBold' size='1.6'>Pass!</t><br />speed: %1 km/h",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; _initial_speed = 8; _velocity = eyeDirection player vectorMultiply _initial_speed; _vel = _velocity; cursorObject setDir (direction player); cursorObject setVelocity [ (_vel select 0), (_vel select 1), (_vel select 2) ]; }; } else { if ((typeOf cursorObject in ["plp_bo_VolleyBall_Mvl","plp_bo_BeachBallRed_Mvl"]) and ((cursorObject distance player) < 3)) then { [parseText format["<t font='PuristaBold' size='1.6'>Kick!</t><br />speed: %1 km/h",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; _initial_speed = 7; _velocity = eyeDirection player vectorMultiply _initial_speed; _vel = _velocity; cursorObject setDir (direction player); cursorObject setVectorUp [0,0.15,0]; cursorObject setVelocity [ (_vel select 0), (_vel select 1), ((_vel select 2) + _initial_speed + 2) ]; }; }; }; }]; uisleep 0.5; findDisplay 46 displayRemoveEventHandler ["MouseButtonDown",FTB_EH]; if !(player inArea FTBLtrig) exitWith {[FTBLtrig] execVM "aim_footballClientOut.sqf"}; if (vehicle player != player) exitWith {hint "Cant play in veh!"}; if !(currentWeapon player isEqualTo "") exitWith {hint "Cant play with weap!"; player allowDamage true;}; if !(primaryWeapon player isEqualTo "") exitWith {hint "Cant play with weap!"; player allowDamage true;}; if !(secondaryWeapon player isEqualTo "") exitWith {hint "Cant play with weap!"; player allowDamage true;}; if !(handgunWeapon player isEqualTo "") exitWith {hint "Cant play with weap!"; player allowDamage true;}; }; The ball spawned if player is in trigger and is registered on match: private["_trig","_pos","_ball","_gotBall"]; _trig = [_this,0,objNull,[objNull]] call BIS_fnc_param; if (isNull _trig) exitWith {}; _gotBall = false; { if ("plp_bo_beachballred.p3d" in str _x) exitWith {_gotBall = true}; } forEach (vehicles inAreaArray _trig); if (_gotBall) exitWith {hint "The match is already started! The ball is on the field!"}; { deleteVehicle _x; } forEach nearestObjects[_trig,["plp_bo_BeachBallRed_Mvl"],2000]; _pos = position _trig; [parseText format["<t font='PuristaBold' size='1.6'>Ball drop</t><br />in 5 sec.",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; uisleep 1; [parseText format["<t font='PuristaBold' size='1.6'>Ball drop</t><br />in 4 sec.",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; uisleep 1; [parseText format["<t font='PuristaBold' size='1.6'>Ball drop</t><br />in 3 sec.",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; uisleep 1; [parseText format["<t font='PuristaBold' size='1.6'>Ball drop</t><br />in 2 sec.",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; uisleep 1; [parseText format["<t font='PuristaBold' size='1.6'>Ball drop</t><br />in 1 sec.",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; uisleep 1; [parseText format["<t font='PuristaBold' size='1.6'>Start!</t><br />",round(speed player)], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles; systemchat format["Ball drop: %1",_pos]; _ball = createVehicle ["plp_bo_BeachBallRed_Mvl", [(_pos select 0),(_pos select 1),15], [], 0, "CAN_COLLIDE"]; //plp_bo_beachballred.p3d _ball allowDamage false; _ball enableSimulation true; { "The match is started!" remoteexeccall ["systemchat",_x]; } forEach AllPlayers; If player is out of the trigger: private["_trig","_pos"]; _trig = [_this,0,objNull,[objNull]] call BIS_fnc_param; if (isNull _trig) exitWith {}; _pos = position _trig; systemchat "You've abandoned football zone! If the ball is out of the field - get back and there will be a new ball drop in center."; hint "You've abandoned football zone! If the ball is out of the field - get back and there will be a new ball drop in center."; player allowDamage true; For now this is all i've got:) 1 Share this post Link to post Share on other sites
aimgame 5 Posted November 25, 2023 Here's a short video of this problem - - first few seconds everything is perfect, but then... - turning the simulation off and on - doesn't help. By the way, if i make setPos for this stucked ball it rolls a bit by itself for 1-2 sec, but then stops again and not moving like on video. I'm already thinking whether I won't have to prescribe the physics of movements for this manually... so that the ball can roll and fly through the setPos... but that would be so dumb football(( Share this post Link to post Share on other sites
mrcurry 470 Posted November 30, 2023 On 11/28/2023 at 8:43 AM, aimgame said: Anyone? Please🙂 Yes ofc, I completely forgot about the thread tbh, this is why the quote and mention features are great 😉 As for your problem it sounds like it's related to the objects simulation mode cause this is similar to how many smaller objects behave. They pretend to do physics for a bit and then they don't. What's the typeof for your ball objects? I see references to On 11/24/2023 at 12:42 PM, aimgame said: (typeOf cursorObject in ["plp_bo_VolleyBall_Mvl","plp_bo_BeachBallRed_Mvl"] But these don't seem like standard BI classes so I'm guessing modded? May be that the modder didn't plan for this use case. You could try a different ball-like object. You can check the config sim setting by executing this in the debug console: getText( configFile >> "CfgVehicles" >> "yourObjectType" >> "simulation" ) Not sure exactly how the sim values affect the the physics but I imagine you'd need to find the correct config settings to get the engine to do it all for you. 1 Share this post Link to post Share on other sites
aimgame 5 Posted December 20, 2023 getText( configFile >> "CfgVehicles" >> "yourObjectType" >> "simulation" ) - for different objects: Unit - soldier static objs - house movable objs - thingX LandVehs - carx Planes - airplane Helis - helicopterrtd Ships/boats - shipX For some reason "plp_bo_BeachBallRed_Mvl" got shipX simulation type. I.e. "Land_Volleyball_01_F" and "plp_bo_VolleyBall_Mvl" got thingX simulation... Im gonna try theese ones and get back with result:) Share this post Link to post Share on other sites
aimgame 5 Posted December 20, 2023 SOLVED! Objects with thingX simulation type work perfectly! 1 Share this post Link to post Share on other sites
aimgame 5 Posted December 21, 2023 Another problem appeared... The ball can be kicked only by the player that activated the script... And if i spawn the ball by server - no one can kick it((( Is there any command to make object to be availible for every player? Maybe some "reveal" or "setOwner" will help? Share this post Link to post Share on other sites
j0nes 194 Posted December 23, 2023 you'd need to run the mousebuttondown code on every client if im reading it correctly. use https://community.bistudio.com/wiki/remoteExec and looking at example 2 on that biki page, you could do it like this: "message" remoteExec ["hint", -2]; // sends a hint message to everybody but the server (also not hosted server) Share this post Link to post Share on other sites
aimgame 5 Posted December 24, 2023 You mean i need to remoteExec the kicking of the ball? But wouldn't it be as much sametime ballkicks as number of players online?))) Maybe i should try spawning the ball by server and remoteExec the kicking to the server... so the server will move the ball... Share this post Link to post Share on other sites
aimgame 5 Posted January 3 Tried to solve radicaly - respawn the ball on every kick:) So it is on each player - when kicking: 1. deleteVehicle ball 2. createVehicle ball in the same place 3. this new ball is local for the player so he can kick it... BUT! This couse another problem - players spawn multiple balls on every kick, even though i delete extra ones(( Probably it is due to out of sync. Share this post Link to post Share on other sites
aimgame 5 Posted January 7 I guess there's got to be some other solution with one single ball... Any ideas? Please! Share this post Link to post Share on other sites
mrcurry 470 Posted January 7 On 12/21/2023 at 9:15 PM, aimgame said: Another problem appeared... The ball can be kicked only by the player that activated the script... And if i spawn the ball by server - no one can kick it((( Is there any command to make object to be availible for every player? Maybe some "reveal" or "setOwner" will help? Don't respawn the ball, just spawn it once on the Server. Each client sends a message when they "kick the ball" to the server which applies "the kick". We can group several local commands into one network "message"-function which is best practice for MP. The message is sent using remoteExec. Assuming you use the same method of kicking as described previously in the thread: 1. Make a function using CfgFunctions, as an example lets call it: TAG_fnc_serverApplyKick. The reason to use CfgFunctions is that such functions are by default approved for remote execution and makes the code available for all, server and clients. 2. The function needs parameters to be applied to the "kick"-commands: setDir, setVelocity so something like: Spoiler // First make sure this is never executed on anywhere but the server if( !isServer ) exitWith { // Message to catch if we made a mistake somewhere, this should normally never show up systemChat "Function ""serverApplyKick"" should not be excuted on non-server machines."; }; // Read the parameters params [ //Param name Default Allowed Types ["_ball", objNull, [objNull] ], ["_dir", 0, [0] ], ["_velocity", [0,0,0], [[]] ] ]; // Check ball if( isNull _ball ) exitWith { /* Ball is null */ }; if( !local _ball ) exitWith { /* Ball is not local to this machine */ }; // Apply "kick" _ball setDir _dir; _ball setVelocity _velocity; 3. In the client code for reacting to the "MouseButtonDown" instead of calling setDir and setVelocity to apply the kick you should remoteExec "TAG_fnc_serverApplyKick" to the server like so: private _ball = cursorObject; if( !isNull _ball ) then { [ _ball, _dir, _velocity ] remoteExec ["TAG_fnc_serverApplyKick", 2]; } Note: The 2 at the end of the remoteExec right-hand argument means server only. 2 = server only 0 = everyone, -x = all but x (e.g. -2 = all but server) any other number = client specific id as seen in clientOwner. More info on remoteExec here 1 Share this post Link to post Share on other sites
CDStewart87 0 Posted January 11 Hey fellas. I am returning to Arma 3 after some years and was searching for a couple of scripts (for personal use only) at about 3:00 in the morning and half asleep when i saw the title of this thread. started to read it and lost about an hour trying to comprehend both the technical level you two are on and the comradery shown, the willingness to help each other is what keeps this community alive (and a great game! thanks BI) but the dedication is wonderful! I hope to come back to this thread some time and see the final project! and honestly I'm glad we might get to kick some balls! and relieved its not about what i originally thought it was. ha-ha. Happy new years and good luck! - just a fly on the wall dodging balls Share this post Link to post Share on other sites