Hi! I release a simple gang territory conquest script. Optimized for ESX and QB, expandable as needed. It can be integrated with polyzones or another system if necessary.
It works by time, it is configurable from the capture time between points, the time to capture a point, the colors of each band, the zones, etc…
The zones are reset at each restart. You can add as many zones as you want and randomly select some of them at each reboot (Or all).
Thanks!! Not in the current version, although it is not very complicated to implement. In the future I may raise it, if someone is encouraged they can participate in the mod and create PR’s!
okay bro, good works, maybe you could do it more advanced? while you capturing the zone, npc bots attacking you, you have a attack waves to defeand/capture the zone’s?
Thx!! At the moment I do not plan to extend it but if there are many people interested in a functionality we may try to carry it forward. You can also make your own implementations on top of this version.
This would require changing the focus of the current system. Currently the restriction is by Job, if you do not have the job that you have previously defined, it will not let you conquer. As I said, it can be adapted so that anyone can conquer the points and require the item, you can also make each attempt to conquer remove an item from your inventory.
Config.timeBetweenConquers = 600 -- 10min default - Time between conquers
because in my case the os.time() counts in seconds not milliseconds.
this worked flawless too.
then I recnognized that Players with a other Job cant capture the point even if its “Conquerable”
so i changed this:
Citizen.CreateThread(function()
while true do
Citizen.Wait(120000) -------------------------------------
print(ESX.GetPlayerFromId(source))
print(os.time())
for k, v in pairs(zones) do
if (v.owner ~= '' and os.time() > v.conqueredTime + Config.timeBetweenConquers and v.latestPointTime ~= '' ) then
print("wieder verfuegbar")
v.status = 2
v.latestPointTime = ''
v.pointRecent = false ------------------------------------------------------------------
TriggerClientEvent('xex_gangwars:setZones', -1, zones)
end
end
end
end)
its working for me now but when the point is “Conquerable” again the same job can capture it again and it would be great to get a option if player want it or it have to be captured by another “gang”.
I hope you understood my bad english and maybe you implement these things the good way… not that way I did because your code looks much cleaner!
The script is mainly based on the job of the person to paint the colors and control the zones. If you have not added the Jobs to the Config.gangJobs table you may have this problem when saving a point. You can try adding them there and try. Otherwise, you may have to do some more adaptation to make it work correctly.
At this point:
v.color = Config.gangJobs[gang].color
Is being assigned a color based on that table. And also an owner according to the job:
sure I’ve inserted the jobs in the config before
I have to insert in line ~98 in server lua
v.pointRecent = false
to make the point “Conquerable” for others again after the waiting time why?
Is this the right way?
my problem is when I use this script without changing this the point says it is “Conquerable” again but other jobs cant capture it. Why? is this a bug?
There are 2 loops, one changes the state of the zone to conquerable, and the other checks that a point has not been captured recently. Between captures there is a delay.
Modifying it in the way you indicate you are mixing the two actions in the same loop. Cheer up, greetings!
In the tryToConquerZone() function, check before doing anything that this point does not already belong to that job. If owner property it’s equal to the job of the person trying to conquer, don’t let them do it.
if v.owner ~= yourjob then
-- Conquer
else
--- Stop it
end
I think with that you will be able to make it work. Greetings!
first at all thanks but I think you missunderstand me.
If I don’t insert v.pointRecent = false in the server lua as I written above nobody ever can capture the point again once its captured.
even if its conquerable again no matter wich job the player has.
If I insert v.pointRecent = false like I written it works but it should do that without that… am I wrong?