Results 1 to 4 of 4

Thread: Error script

  1. #1
    Private
    Join Date
    Jan 2019
    Posts
    15
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Error script

    Hey Guys, could you help me see the problem? Thx.


    PHP Code:
    ******* script runtime error *******
    undefined is not an entity: (file 'scripts/shop.gsc'line 330)
     
    weap hide();
     *
    called from:
    (
    file 'scripts/shop.gsc'line 107)
     for(
    i=0;i<randomboxes.size;i++) randomboxes[ithread randombox(randomweaps[i]);
                                                           *
    called from:
    (
    file 'scripts/ballerina.gsc'line 550)
        
    thread scripts\shop::init();
               *
    called from:
    (
    file 'maps/mp/gametypes/_callbacksetup.gsc'line 15)
      [[
    level.callbackStartGameType]]();
              *
    started from:
    (
    file 'maps/mp/gametypes/_callbacksetup.gsc'line 10)
    CodeCallback_StartGameType()
    *
    ************************************
    Error during initialization:
    script runtime error
    (see console for details)
    (
    file 'maps/mp/gametypes/_callbacksetup.gsc'line 10
    ---------------------------it concerns this below
    PHP Code:
    randombox(weap)
    {
        
    weap hide();
        
    weap.origin;
        
    cost 500;
        
        
    // init set of weapons in this randombox
        
    self.weapons = [];
        
    self.weaponsModel = []; 
    Last edited by Mitch; 9th January 2019 at 17:44. Reason: use php or code tags!

  2. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    397
    Thanks
    74
    Thanked 91 Times in 77 Posts
    PHP Code:
    randombox(weap)
    {
    if (!
    isDefined(weap))
        return;

    weap hide();
    weap.origin;
    cost 500;

    // init set of weapons in this randombox
    self.weapons = [];
    self.weaponsModel = []; 
    but, it's not fix all errors, try
    Code:
    developer 0
    or use last libcod version's: developer errors - no stop server
    write shit code's

  3. The Following User Says Thank You to maxdamage99 For This Useful Post:

    stoiczkow (9th January 2019)

  4. #3
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    624
    Thanks
    191
    Thanked 421 Times in 283 Posts
    Here you call the function 'randombox' on the list and pass the weapon (with the same index as the box) via the first parameter:

    PHP Code:
    for(i=0;i<randomboxes.size;i++) randomboxes[ithread randombox(randomweaps[i]); 
    Your loop ran out of weapons therefore the variable 'weap' is now undefined (no entity) which results in a script runtime error.

    You can do one of these options:
    • Make sure both lists are the same size.
    • Check randomweaps's size before calling the 'randombox' function.
    Last edited by Mitch; 9th January 2019 at 18:00. Reason: list bbcode

  5. #4
    Private
    Join Date
    Jan 2019
    Posts
    15
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Mitch View Post
    Here you call the function 'randombox' on the list and pass the weapon (with the same index as the box) via the first parameter:

    PHP Code:
    for(i=0;i<randomboxes.size;i++) randomboxes[ithread randombox(randomweaps[i]); 
    Your loop ran out of weapons therefore the variable 'weap' is now undefined (no entity) which results in a script runtime error.

    You can do one of these options:
    • Make sure both lists are the same size.
    • Check randomweaps's size before calling the 'randombox' function.
    if...return fixed this error. thx.
    https://i.imgur.com/0a6oNbP.png

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •