[How-To] Improved vehicle spawn functions

Discussion in 'General Discussion' started by Doc, Dec 16, 2012.

  1. Doc

    Doc Valued Member!

    Joined:
    Nov 23, 2012
    Messages:
    355
    Likes Received:
    39
    Paste the error please :)

    It should work with1 751
     
  2. m1lkm8n

    m1lkm8n Member

    Joined:
    Jan 18, 2013
    Messages:
    94
    Likes Received:
    7
    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
     
  3. Doc

    Doc Valued Member!

    Joined:
    Nov 23, 2012
    Messages:
    355
    Likes Received:
    39
    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 :)
     
  4. m1lkm8n

    m1lkm8n Member

    Joined:
    Jan 18, 2013
    Messages:
    94
    Likes Received:
    7
    Is there a link to show how to get the spawn database into the new SQL database?
     
  5. Maxiron

    Maxiron New Member

    Joined:
    Feb 8, 2013
    Messages:
    3
    Likes Received:
    0
    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?
     
  6. Doc

    Doc Valued Member!

    Joined:
    Nov 23, 2012
    Messages:
    355
    Likes Received:
    39
    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 :)
     
  7. Maxiron

    Maxiron New Member

    Joined:
    Feb 8, 2013
    Messages:
    3
    Likes Received:
    0
    Thanks a lot Doc!
     
  8. nemeth

    nemeth New Member

    Joined:
    Mar 4, 2013
    Messages:
    16
    Likes Received:
    0
    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.
     
  9. khal

    khal New Member

    Joined:
    Feb 17, 2013
    Messages:
    16
    Likes Received:
    1
    I tried and... fail
    long and complicated.. will try no more

    sorry for bad english
     
  10. Arterio

    Arterio Member

    Joined:
    Mar 27, 2013
    Messages:
    97
    Likes Received:
    4
    Is this already implemented in the most recent release of Pwnozor's Server Pack?
     
  11. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    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
     
  12. MrRightclick

    MrRightclick New Member

    Joined:
    Jan 15, 2013
    Messages:
    29
    Likes Received:
    2
    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)
     
  13. Arterio

    Arterio Member

    Joined:
    Mar 27, 2013
    Messages:
    97
    Likes Received:
    4
    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.
     
  14. allavett

    allavett New Member

    Joined:
    Apr 17, 2013
    Messages:
    20
    Likes Received:
    3
    Hello,
    I am getting an error that reports pFixMaxNum does not exist.
    [​IMG]
    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?
     
  15. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    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.
     
  16. allavett

    allavett New Member

    Joined:
    Apr 17, 2013
    Messages:
    20
    Likes Received:
    3
    McKeighan, you must have some mad googling skills :rolleyes:
    I've been looking but no results. If you could get the procedure for me, I would really appreciate it.
     
  17. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    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
    
     
    allavett likes this.
  18. allavett

    allavett New Member

    Joined:
    Apr 17, 2013
    Messages:
    20
    Likes Received:
    3
    Thank you McKeighan! Will start testing right now :)
    E:
    Still no go. I must be doing something wrong or not doing enough. [​IMG]
    Should I edit Parameter or Return type? I tryed a few things, but then I get a different error.
     
  19. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    I had that same error, but can't remember what i changed to get it to function. :( Sorry.
     
  20. allavett

    allavett New Member

    Joined:
    Apr 17, 2013
    Messages:
    20
    Likes Received:
    3
    No problem. Atleast you got me this far, for which I am really greatful :)
     

Share This Page