Jump to content

chaoticgood

Member
  • Content Count

    37
  • Joined

  • Last visited

  • Medals

Everything posted by chaoticgood

  1. Make a function: myFunction = { code that you want on vehicle respawn goes here. e.g _this setPos (position player); }; Then in the Vehicle Respawn Module expression field put: (_this select 0) spawn myFunction; This will run the function every time the vehicle respawns and sends the argument "(_this select 0)", which is the vehicle, to the function.
  2. Yes, you need to make sure the client knows what "RescueBoat" is. The client should know what it is because it's a global variable, if you placed the boat in the editor then you need to make sure "RescueBoat" (without quotes) is in the name field so the client knows which boat you are refereing to. The only other thing I can think of is it might be trying to put you both in the same slot at the same time which probably won't work. If this is the case then this might work: waitUntil{!(isNull player)}; _p = player _p moveInCargo [RescueBoat,1]; if(!(_p in RescueBoat))then{_p moveInCargo [RescueBoat,2];}; removeAllWeapons _p; removeHeadgear _p; _p unassignItem "NVGoggles"; _p removeItem "NVGoggles";
  3. if(isServer || isDedicated) then { Player1 moveInCargo RescueBoat; Player2 moveInCargo RescueBoat; removeAllWeapons Player1; removeAllWeapons Player2; removeHeadgear Player1; removeHeadgear Player2; Player1 unassignItem "NVGoggles"; Player1 removeItem "NVGoggles"; Player2 unassignItem "NVGoggles"; Player2 removeItem "NVGoggles"; } I think the reason this only works for 1 player is because it's asking the server or host to make these changes. Any changes to the player character should generally be done by the client. Try this instead: waitUntil{!(isNull player)}; _p = player _p moveInCargo RescueBoat; removeAllWeapons _p; removeHeadgear _p; _p unassignItem "NVGoggles"; _p removeItem "NVGoggles"; This will launch on every client and NOT the server. It then gets the clients player and does the stuff you want to that player.
  4. chaoticgood

    Vehicle Respawn Module

    Thanks Larrow,I just figured it out after I called it quits for tonight and I was going to wait and see if someone had a solution until tomorrow, then I was going try and make my own vehicle respawn script if I couldn't find an answer.
  5. chaoticgood

    Vehicle Respawn Module

    Try putting a call/spawn/execVM in the expression field inside of the Vehicle Respawn Module then send the augument (the Vehicle being respawned) to the function/script. I came here looking for some help with the Vehicle Respawn Module, as above, you can run scripts or functions for the vehicles that respawn by using the expression field. However, I can only get it to work on a hosted server and NOT a dedicated server. Does anyone have the same problem? Here is the script in question: if(isDedicated or isServer)then{execVM "serverFunctions.sqf";sleep 0.1;call serverFuncTest;}; waitUntil{!(isNull player)}; execVM "functions.sqf"; sleep 0.1; execVM "Script.sqf"; serverFunctions.sqf vehInit = { clearWeaponCargo _this; clearMagazineCargo _this; _this addWeaponCargo ["arifle_Katiba_F",2]; _this addMagazineCargo ["30Rnd_65x39_caseless_green",8]; }; serverFuncTest = { "O_Heli_Attack_02_black_F" createVehicle [3781.24,7919.35,0]; }; Ok, in a hosted server, the respawned vehicles call the vehInit function from the Vehicle Respawn Module's expression field. In a dedicated server the vehicles respawn but they don't call the function even though they should because the expression field is unchanged. The serverFuncTest is just to see if the functions are being loaded properly.
  6. Hello, I have 3 problems that I am unable to solve. 1. My script runs fine on my client but when a friend joins the listen server after it's started, the script does not execute for him. 2. When I go back to the lobby and choose a different slot, the newly spawned character does not run the script. 3. When I go back to the lobby and choose a different slot, an AI is left behind in the old slot even though AI is disabled in the description.ext. so here it is: init.sqf execVM "functions.sqf"; sleep 1; execVM "Script.sqf"; functions.sqf playerInit = { _this setPos [3757.36,7958.89,0]; removeAllWeapons _this; removeVest _this; removeHeadgear _this; _this addMagazine "16Rnd_9x21_Mag"; _this addMagazine "16Rnd_9x21_Mag"; _this addWeapon "hgun_Rook40_F"; _teamColour = assignedTeam _this; hint format ["Team Colour: %1",_teamColour]; _this addAction ["Spawn Dialog Test",{createDialog "SpawnTeleport"}]; }; script.sqf _p = player; _p call playerInit; _p addMPEventHandler ["MPRespawn",{(_this select 0) call playerInit;}]; So what it's supposed to do is: the player spawns in, he gets "initialised" by the function, then the eventhandler gets added to him so if he respawns, it will "initialise" him again.
  7. chaoticgood

    Scripting for multiplayer problems

    Alright! Thanks for the help everyone, my script now works as intended. I changed my init.sqf to look like this: waitUntil{!(isNull player)}; execVM "functions.sqf"; sleep 0.1; execVM "Script.sqf"; I thought it was odd that your first script you gave me zenophon, did not work, so I tried it with just part of the line. Now the script runs on players and JIP players which is wonderful!
  8. chaoticgood

    Scripting for multiplayer problems

    Ok, Beigen's script works with JTS_2009's fix applied to it. Can someone walk me through as to why Beigens script works? My script is ran on JIP players now whereas before it did not.
  9. chaoticgood

    Scripting for multiplayer problems

    I replaced my init.sqf with the one you gave me Beigen. However it gave me an error on the last line: if(T_JP |#|== true)then{execVM "myscript";}; Error ==:type Bool, Expected Number, String, Object, ect. I also replaced "myscript" with my own funcions.sqf and script.sqf EDIT: could the problem be that I'm using a listen server and not a dedicated?
  10. chaoticgood

    Scripting for multiplayer problems

    Thanks for the help. I added the line and it still is not working as intended. I assume the line you told me to add makes sure the function and script only run on the client and NOT the server. The respawn type is set to BASE and I've set that up in the editor so it works correctly. The problem comes when people JIP, the script doesn't run for them as far as I can tell. Any advice on how to do so would be appreciated. Thanks again.
  11. Hello, my current script churns out an error and I don't know why. Here it is: Script.sqf player call GearReplace; "GearReplace" is a function inside of functions.sqf GearReplace = { _this removeAllWeapons; }; And finally, inside of my init.sqf execVM "functions.sqf"; execVM "Script.sqf"; This gives me an error message ingame: player call |#|gearreplace Error undefined variable in expression: gearreplace line 1 The script is supposed to remove the players weapons.
  12. chaoticgood

    Script error, can't figure out why

    Thanks, I got it working.
×