Jump to content

Recommended Posts

Hey! I wrote a code for a random manhunt scenario, and for 2 players it works fine because i wrote all of the code in the init.sqf. But with more players everytime someone loads in the scenario gets randomised again and again. I tried to make a game object which will have an action to load in the scenario but it failed. I have to type the code in the debug console for it to work. anyone has a solution? Thanks! link for the code if you have time to figure out what is happening

Share this post


Link to post
Share on other sites

why didnt you post the code? its just two lines:

_actionID = player addAction ["Exec the file", "randomspawn.sqf"]
hint str _this;

init.sqf is executed for the server and all clients before mission start. try initPlayerLocal.sqf instead

  • Like 2

Share this post


Link to post
Share on other sites

It would be much preferred to not have to download anything to look at people's code, there are many ways to do this. First of all just including it with your post with the code tag, don't forget to use a spoiler tag if the code is long. There are various code-sharing sites as well. Then of course there is Github, probably the best option

  • Like 2

Share this post


Link to post
Share on other sites
5 hours ago, 7erra said:

try initPlayerLocal.sqf instead

 

This. Avoid using init.sqf whenever possible. Keep in mind that in MP it is the last item to initialize.

  • Like 2

Share this post


Link to post
Share on other sites

What do you need exactly?

- A randomized scenario and every player has the same?

   You need to randomize a variable in initServer, then public it forExample : rSpawn = selectRandom [....]; publicVariable "rSpawn"; then code with rSpawn choice in initPlayerLocal.sqf (all players have the same)

 

- A randomized scenario (fixed of course) for each player? , so the initPlayerLocal.sqf is just fine. No need to randomize a variable on server. Do that in initPlayerLocal.sqf

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×