[How-To] Improved vehicle spawn functions

Doc is it imperative we use the new SQL database? I updated my server to 1751 but left the SQL alone because I use your improved vehicle spawn
 

Doc

Valued Member!
The new mysql schema is faster but there are issues with vehicles spawning which may have been fixed (?). As far as I know, this vehicle spawn will still work with the new schema :)
 
Paste the error please :)

It should work with1 751
Well...I went and redid my steps to duplicate the problem and now it saves fine...not sure what I was doing wrong. Must be my noob gene kickin in. :)

Now, I can't seem to create a new column in the object_classes or object_data as your post states. How do I make a new column? I am running the "trial" of Navicat...think that is my problem?
 

Doc

Valued Member!
Well...I went and redid my steps to duplicate the problem and now it saves fine...not sure what I was doing wrong. Must be my noob gene kickin in. :)

Now, I can't seem to create a new column in the object_classes or object_data as your post states. How do I make a new column? I am running the "trial" of Navicat...think that is my problem?
The trial should be fine - but you can use Navicat Lite which is just a free version (or be naughty and torre......)!!

If you click Design Table you can add another column :)
 

nemeth

New Member
Thank you Doc for your work .. but where i can see the minimum and maximum spawns on map and how i can change them ? I want to put in like 65 vehicles.
 

McKeighan

Well-Known Member
Mine fails at this line in the sql

Code:
SET @initialClassCount = fGetClassCount(@rsClassname);

I have NO idea why i'm missing all these functions from a stock pwonzor database, but I am. Doc, can you drop in what that function is supposed to be? I can bring it into sql once I get that much.


( i mean fGetClassCount doesn't exhist in my database)


Thanks.


(EDIT - ok I found it.. For any in the same boat, here's the main code for this function)

Code:
DROP FUNCTION IF EXISTS `fGetClassCount`;
DELIMITER ;;
CREATE FUNCTION `fGetClassCount`(`clname` varchar(32)) RETURNS smallint(3)
    READS SQL DATA
BEGIN
DECLARE iClassCount SMALLINT(3) DEFAULT 0;
SELECT COUNT(*)
INTO iClassCount
FROM Object_DATA
WHERE Classname = clname;
RETURN iClassCount;
END
 
Is this already implemented in the most recent release of Pwnozor's Server Pack?
Looks a lot like it, since there is randomization in that one too. Dunno about dynamic vehicle numbers, but damage and fuel is randomized (even though thanks to DayZ core bug, you can just bump in to a chopper and it fixes itself x_x)
 
I tried using Pwnozor's pack and could never get vehicles to actually show up in game. They were in the database, but never showed up in game. I am using DayZ Server Control Center and it's working well. Love the web interface as well. Just wish a few features were added to make the game a little more custom.
 
Hello,
I am getting an error that reports pFixMaxNum does not exist.

As you can see on the picture I really don't have such procedure, but in the tutorial there is no word about it.
Could anyone give me some advice on how to solve this problem?
 

McKeighan

Well-Known Member
I had the same problem allavett - and needed to do a lot of google searching to figure out what the procedure even looks like.

Do some more searching on get it hub and google, if u're still comming up empty, i can attempt to snag the sql off my server and drop the code in here.
 

McKeighan

Well-Known Member
Code:
DELIMITER $$
CREATE [EMAIL]DEFINER=`dayz`@`localhost[/EMAIL]` PROCEDURE `pFixMaxNum`()
BEGIN
 DECLARE iCounter INT DEFAULT 0;
  SELECT COUNT(*) INTO @iClassesCount FROM object_classes WHERE Classname<>'';
  WHILE (iCounter < @iClassesCount) DO
   SELECT Classname, MaxNum INTO @Classname, @MaxNum FROM object_classes LIMIT iCounter,1;
   SELECT COUNT(*) INTO @iMaxClassSpawn FROM object_spawns WHERE Classname LIKE @Classname;
   IF (@MaxNum > @iMaxClassSpawn) THEN
    UPDATE object_classes SET MaxNum = @iMaxClassSpawn WHERE Classname = @Classname;
   END IF;
   SET iCounter = iCounter + 1;
  END WHILE;

END
That's the exact code from that proceedure

you will also need a function called "fGetClassCount"

Code:
DELIMITER $$
CREATE [EMAIL]DEFINER=`dayz`@`localhost[/EMAIL]` FUNCTION `fGetClassCount`(`clname` varchar(32)) RETURNS smallint(3)
    READS SQL DATA
BEGIN
DECLARE iClassCount SMALLINT(3) DEFAULT 0;
SELECT COUNT(*)
INTO iClassCount
FROM Object_DATA
WHERE Classname = clname;
RETURN iClassCount;
END
 
Thank you McKeighan! Will start testing right now :)
E:
Still no go. I must be doing something wrong or not doing enough.

Should I edit Parameter or Return type? I tryed a few things, but then I get a different error.
 
Top