Jump to content
Mr. Green Gaming

Custom NTS script


Recommended Posts

Posted (edited)

Hi there!

On request of FantomicanYoshi I've made a custom NTS script (based on the famous NTS by BinSlayer). This script only chooses a random vehicle from the vehicles you choose. For example you can choose to only do an NTS map with RC vehicles, sport cars or bikes etcetera, everything is possible (even planes, boats and cars mixed for the same checkpoint).

Download

customClientNTS.lua

customServerNTS.lua

Install

To install add both lua files in the same folder where the meta.xml is located. Also add the following lines to the meta.xml directly after the <meta> tag.

    <script src="customClientNTS.lua" type="client"></script>
    <script src="customServerNTS.lua" type="server"></script>

Very important!

The script has two modes. A default mode and a mode which is compatible with the mrgreen plugin (this script overrules the mrgreen plugin). The script is set to the default mode if you do nothing, but if you want to make it compatible with the mrgreen plugin you need to edit a variable in the customClientNTS.lua script. In the top of this script at line 16 you find the next variable:

bb_mrgreenPlugin = 0 -- 0 = disabled, 1 = enabled

To make the script compatible with the mrgreen plugin this variable needs to be changed to:

bb_mrgreenPlugin = 1 -- 0 = disabled, 1 = enabled

Edit it to your own preferences

To edit it to your own preferences open the customClientNTS.lua file. In the script there are already 3 categories implemented: Air, Land and Sea. You'll recognize these categories through the script.

First thing we need to do is go to the top of the script and add which cp belongs to which category. Right now we have 3 types of cp's, Air cp's, Land cp's and Sea cp's. Add the number of the checkpoint to the right category. For example in the next code the first 5 cp's are Air cp's, the second 5 are Land cp's and the last 5 are Sea cp's.

bb_cpAir = {1, 2, 3, 4, 5}
bb_cpLand = {6, 7, 8, 9, 10}
bb_cpSea = {11, 12, 13, 14, 15}

Next thing we do is define which vehicles we want to allow in the NTS script. This can be done by adding the model ID's to the rightful categories. In this example we only want helicopters in the air, only race vehicles on land and only a jetmax, speeder and squalo in the sea.

bb_vehAir = {548, 425, 417, 487, 488, 497, 563, 447, 469}
bb_vehLand = {411, 415, 429, 434, 451, 477, 480, 494, 502, 503, 506, 541, 555, 558, 559, 560, 561, 562, 565} 
bb_vehSea = {493, 452, 446}

Right now you are done if you only want three different categories. Now I'll continue to explain how you create your own additional categories.

Additional categories

First we need to add a table which defines to which cp's the category applies. Edit the 'yourname' part to whatever name you like (keep it unique so it doesn't interfere with other variables).

yourname_cp = {1, 4, 5, 7, 9}

Now we add a table which contains all the vehicles of this category.

yourname_veh = {602, 496, 401}

Next we need to add a new elseif statement to check for the new category. This can be done around line 50 (the comment shows where exactly). This part triggers the checks to see if the cp taken is a cp from your category, whether the vehicle changed to (in the mix server) is an allowed vehicle and at last change it to a new random vehicle from your category.

	elseif yourname_isCP(bb_currentCP) then
		if yourname_check(bb_model) then
		else
			setElementModel(getPedOccupiedVehicle(localPlayer), yourname_ran())
		end

Then we add the check whether the cp taken is a cp from your category (around line 90).

function yourname_isCP(bb_currentCP)
    for i, value in ipairs(yourname_cp) do
        if value == bb_currentCP then
            return true
        end
    end
    return false
end

Then we add the check whether the vehicle changed to (in the mix server) is allowed (around line 120).

function yourname_check(bb_model)
	for i, value in ipairs(yourname_veh) do
        if value == bb_model then
            return true
		end
    end
	return false
end

Last we add the part where a new random model is generated for the player (around line 135).

function yourname_ran()
	bb_model = yourname_veh[math.random(1, table.getn(yourname_veh))]
	return bb_model
end

Now we have created a new custom category for NTS. As many categories as you want can be added but remember to always choose unique names.

Limitations for Mix server

Because the mrgreen plugin and this script work seperately from each other, this script sometimes needs to correct things, caused by the mrgreen plugin, that we do not want. For example the mrgreen plugin may change the vehicle to a model which is not allowed. In that case this script changes it to a vehicle that is allowed, but that takes a short amount of time (to be exact 50 milliseconds). Although very short, you see two models appear very fast after each other when this happens.

The reroll perk may change the vehicle to a model which is not allowed. I think it's solvable, but yet have to think about how.

Limitations for both servers

There is a statistical difference in which vehicle is most likely to be changed to. What this difference is exactly can be calculated, but I did not do that. I can give you the formula. :P 

Statistical chance for allowed vehicles which are also part of the default NTS:

( Number of allowed vehicles in table which are also in the default NTS mode ) / ( Number of vehicles in the default NTS mode ) + ( 1 - ( Number of allowed vehicles in table which are also in the default NTS mode ) / ( Number of vehicles in the default NTS mode ) ) * ( ( Number of allowed vehicles in table which ARE in the default NTS mode ) / ( Number of allowed vehicles in table ) )

Statistical chance for allowed vehicles which are not part of the default NTS:

( 1 - ( Number of allowed vehicles in table which are also in the default NTS mode ) / ( Number of vehicles in the default NTS mode ) ) * ( ( Number of allowed vehicles in table which ARE NOT in the default NTS mode ) / ( Number of allowed vehicles in table ) )

Do not bother to calculate, maybe I'll implement it in the script sometime and output it in the debugscript or something.

 

If there are any questions or you need troubleshooting you can ask them in this topic.

Edited by Bierbuikje
Posted (edited)

It would be perfect if Rerolling would be compatible with this as well. SDK or AleksCore, maybe one of you can help with it?

Because, maybe not everyone realizes it, but this script creates a LOT more freedom and possibilites for making NTS-maps. Just some examples; you don't have to bother with vehicle changes in front of tunnels or narrow spaces; you just take big vehicles out of rotation at those certain checkpoints. If you need to gain some speed for a jump somewhere, you can just enable relatively fast cars for that spot. Off-road racing is now possible by choosing suitable vehicles. With the default Mr. Green Editor, I feel very limited when working with NTS maps because you always need to create room for Combine Harvesters, Andromeda's and let's not forget the Marquis. Being able to take those vehicles out of rotation at some spots would be wonderful. Not saying that I would take out TOO many vehicles of course - NTS must still remain it's charm and be different from the race server. But this script paves the way for more diversity.

Edited by BlueYoshi97
Posted

I have read like 50-70% of it, but I have a question/thought about it. I was mix map manager for ~1 year and helping former mix map manager for some months, idk if this is exactly a NTS map. I mean it should be TOTALLY random, not randoming the vehicle by certain choosen vehicles. Its like some race maps which you go through a cp and you get a diff vehicle, but the difference here you can add more vehicles to the cp. Its just what I think about it, but in general good work @Bierbuikje

Posted
9 hours ago, Cena said:

I mean it should be TOTALLY random, not randoming the vehicle by certain choosen vehicles.

Sometimes there are maps where not all random vehicles are compatible, like one of the latest Yoshi maps where the whole map is in hovermode. In the current NTS script it is possible to spawn a vehicle (like a bike) which does not work with hovermode. This script is mainly useful for these maps where you need to exclude certain vehicles which are not compatible. I agree that NTS mode should include as much vehicles as possible, but that's up to the editor who uses it.

Posted
1 hour ago, Bierbuikje said:

Sometimes there are maps where not all random vehicles are compatible, like one of the latest Yoshi maps where the whole map is in hovermode. In the current NTS script it is possible to spawn a vehicle (like a bike) which does not work with hovermode. This script is mainly useful for these maps where you need to exclude certain vehicles which are not compatible. I agree that NTS mode should include as much vehicles as possible, but that's up to the editor who uses it.

idk Yoshi last map, but I understand what you mean. Anyway, Its up to Flipper and Mad to accept it. Again good job :) 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...