Thanks Loque,
Will check those out. Very interesting.
sixsens has been helping a lot with testing on his server. We fixed a problem due to my code not taking account of decor values not syncing to all players from NPCs since the NPCs were probably not loaded for all players… and were returning 0 for those clients.
I have random missions at predefined locations as well as now completely random location missions working, where anywhere on a map a random mission can spawn, and if on water peds with boats will spawn. For completely random location missions, you can define the x range and y range on the map where missions can spawn.
We found some limitations, that non-host players will only see NPC blips when they get close enough… around 500m (sometimes less) close to the NPCs, even wen blip range is to be long range. It makes sense no,since the NPCs and their decor does not exist yet for the other clients who have not come within range With setting them to be mission entities (I think), the blips seem to stay across the map, once you have gotten close enough to load the NPCs. So I am working on adding an extra optional mission blip for certain types of missions, like IsDefend that will show start point as well as end point for NPCs, since non-host clients may not see the NPC blips right away.
I have 2.9.1 alpha out now also has mission counter/timeouts…
http://www.mediafire.com/file/4c4773157881074/mrp-missions-2.9.1.zip/file
You will notice a ‘Time Left’ counter now.
There are 2 settings,
first in missions.lua:
Config.MissionLengthMinutes = 10
You can set MissionLengthMinutes per mission as well which overrides the global value.
Second in server.lua:
–This is in minutes. How long to wait, when there are players online
–for the server to find the host and trigger a new mission
local ExtraTimeToWaitToStartNextMission = 5
So a mission will by default timeout in 10 minutes.
Then there is the Config.MissionSpaceTime =10000 (which is in milliseconds). which can also be set per mission, which is the space between the current mission ending (where reward pickups spawn and then should disappear) and the next mission starting.
So what happens is that the players can complete a mission, it can timeout etc… and now the client that competed the mission will tell the server to find the host and the server will/should have the host spawn the next mission, rather than the client who completed it. Same with timeouts.
The server will run in a loop and keep track of the time the last mission would timeout/end + spacetime. If there has not been mission activity since the last mission would of ended, it will wait an extra ExtraTimeToWaitToStartNextMission minutes past that time before checking the clients for the host and getting the host to spawn the next mission. If that makes sense.
This value is set to 5 minutes by default.
sixsens is going to do some more testing