Jump to content
  • 0

Need some expertise on "count" command


dodgitech10

Question

Recommended Posts

  • 0

As mentioned, the BI wiki (https://community.bistudio.com/wiki/) is your scripting bible, don't leave home without it. Avoid simply guessing the use of a scripting command at all costs, always use the Wiki first. I've added the BI Wiki as a search engine on Firefox, and I constantly use it whenever writing any kind of code. Every page for each scripting command explains its syntax and how it's used (what goes in, what goes out).

 

When scripting, it doesn't even matter if I "think" I know about the scripting commands that I use, I always double-check if I have the slightest doubt. Very often, I find that many commands can be used in multiple ways, just check the page for "count" as an example: https://community.bistudio.com/wiki/count. It seems common for new scripting commands (or new ways to use them) to be added with every Arma 3 update, so it's always worth the time to double-check the wiki for any syntax changes or new commands.

 

As for saving vehicles to the DB, that's something I recommend avoiding like the plague because you will 100% encounter problems eventually.

I am surprised to hear there is no safe/easy way of saving vehicles to the db :(

Link to comment
Share on other sites

  • 0

As for saving vehicles to the DB, that's something I recommend avoiding like the plague because you will 100% encounter problems eventually.

 

I am surprised to hear there is no safe/easy way of saving vehicles to the db :(

 

i have yet to see a problem when saving to the database unless there is not enough slots left ...

 

what does create a problem when saving vehicles to the database, is code like this:

 

		EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1;
		EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit);
		_slot = EPOCH_VehicleSlots select 0;
		_item setVariable ['VEHICLE_SLOT',_slot,true];
		EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot];
		EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
		publicVariable 'EPOCH_VehicleSlotCount';
Link to comment
Share on other sites

  • 0

Check out this thread in the Bug Report thread where other people are experiencing disappearing vehicles as a result of vehicle-saving scripts:

 

Basically, the vehicle amounts set in epochconfig.hpp are hard limits of how many of each vehicle type can be spawned on each server start. If your server currently has fewer than the maximum number of a certain vehicle type, and another script/addon spawns another one of this vehicle, it will be successfully saved and spawned in on server restart. However, if the limit of that vehicle type was already reached when the new vehicle was spawned in by the script/addon, on next server start the hard limit will kick in and whatever vehicles that exceed this limit will not be spawned in.

 

To demonstrate this easily, if you set all the vehicle amounts to zero in your epochconfig.hpp (to simulate the limit being exceeded), you will have no vehicles spawned in on next server restart, even though these vehicles are already saved to the DB.

Link to comment
Share on other sites

  • 0

Check out this thread in the Bug Report thread where other people are experiencing disappearing vehicles as a result of vehicle-saving scripts:

 

Basically, the vehicle amounts set in epochconfig.hpp are hard limits of how many of each vehicle type can be spawned on each server start. If your server currently has fewer than the maximum number of a certain vehicle type, and another script/addon spawns another one of this vehicle, it will be successfully saved and spawned in on server restart. However, if the limit of that vehicle type was already reached when the new vehicle was spawned in by the script/addon, on next server start the hard limit will kick in and whatever vehicles that exceed this limit will not be spawned in.

 

To demonstrate this easily, if you set all the vehicle amounts to zero in your epochconfig.hpp (to simulate the limit being exceeded), you will have no vehicles spawned in on next server restart, even though these vehicles are already saved to the DB.

 

thats not entirely correct, as the server will not delete a vehicle if there are more than max allowed per vehicle.

as long as it does not exceed the global max, max allowed per vehicle is just to stop the server from spawning in more of this type of vehicle, when this amount of the vehicle type in question, is already present on the map.

 

the problem arises when someone adds a slot to EPOCH_VehicleSlots while server is running not to mention removing a completely diffrent one (that could be occupied) and expects it to work propper after a restart.

 

if you would actually look at the code i quoted, you would also understand the problem.

 

i have yet to buy a vehicle from my blackmarket traders that did not save to the database, unless i specifically choose to buy a temp vehicle ... but then again, i dont attempt to add slots while server is running.

Link to comment
Share on other sites

  • 0

thats not entirely correct, as the server will not delete a vehicle if there are more than max allowed per vehicle.

as long as it does not exceed the global max, max allowed per vehicle is just to stop the server from spawning in more of this type of vehicle, when this amount of the vehicle type in question, is already present on the map.

 

the problem arises when someone adds a slot to EPOCH_VehicleSlots while server is running not to mention removing a completely diffrent one (that could be occupied) and expects it to work propper after a restart.

 

if you would actually look at the code i quoted, you would also understand the problem.

 

i have yet to buy a vehicle from my blackmarket traders that did not save to the database, unless i specifically choose to buy a temp vehicle ... but then again, i dont attempt to add slots while server is running.

 

If you would actually look at the words I wrote, you would understand that you're countering my post with what I wrote in my own post.

 

The reason I did not read your quote is that it is irrelevant to the content of my post. In my testing situation, all the vehicles of my test server were spawned in my Epoch code, and I am absolutely certain that the Epoch devs know how to spawn in vehicles into their own database correctly. I am saying that "correctly spawned" vehicles are still subject to this hard limit, no matter how good or how bad the scripting used to spawn in the vehicle.

 

It is possible that script-spawned vehicles can be spawned in even if they're not allowedVehiclesList of epochconfig.hpp (thus not subject to any limit) , but I am not 100% certain if this is possible since I haven't traced through Epoch's vehicle spawning code.

Link to comment
Share on other sites

  • 0

If you would actually look at the words I wrote, you would understand that you're countering my post with what I wrote in my own post.

The reason I did not read your quote is that it is irrelevant to the content of my post.

 

i do read what you write, however i am doubting very much that you do the same ... if you dropped your arrogant behavior and actually read it, you would know that it is very rellevant to the subject at hand.

 

In my testing situation, all the vehicles of my test server were spawned in my Epoch code, and I am absolutely certain that the Epoch devs know how to spawn in vehicles into their own database correctly. I am saying that "correctly spawned" vehicles are still subject to this hard limit, no matter how good or how bad the scripting used to spawn in the vehicle.

 

this hardlimit you speak of is still not per vehicle class as you say, it is an overall limit for all vehicles on the server wich is calculated by adding all numbers from allowedVehiclesList togheter.

the idividual numbers only represents how many the server is allowed to spawn of said vehicle.

 

spawning a vehicle in epoch does not require a master degree in anything, its quite simple really:

if the vehicle is assigned a slot, you can save it using EPOCH_server_save_vehicle on the server, obviusly if you overwrite or delete a slot, this will affect the other vehicle(s) that was using the slot(s) in question.

 

It is possible that script-spawned vehicles can be spawned in even if they're not allowedVehiclesList of epochconfig.hpp (thus not subject to any limit) , but I am not 100% certain if this is possible since I haven't traced through Epoch's vehicle spawning code.

 

there is no problems in saving vehicles (or anything else for that matter) to the database (even if they are not in allowedVehiclesList), as long as you are not messing up the slots or overwriting relevant data.

 

now you obviusly do not read what others write and make up your own oppinion of what you think they will say or do.

i cant have a discussion with such an arrogant person.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...