Sign in to follow this  
DRATiNYMOUS

new experience globallogic

Recommended Posts

Posted (edited)

Would using some of the features in New Experience with my own mod (map voting, dynamic rotation, and killstreaks) be much more complex than putting the relevant pieces from the New Experience globallogic into my own globallogic and then making a copy of main_shared/code/xxxx ? Should I expect to need very much threading or tweaking?

 

essentially I want something just like leiizko/cod4_scriptcommands but map voting, dynamic rotation, and killstreaks

Edited by DRATiNYMOUS
found an example

Share this post


Link to post
Share on other sites
Posted (edited)

So my noob attempt at using the map vote system was to :

  • Make a directory in my server's mod folder called 'code' and I put a mapvote.gsx inside with these contents. (server\mods\modname\code\.gsx)
  • Edit my _globallogic.gsc to include these lines from leiizko's _globallogic (compiled into server\mods\modname\.iwd)
  • Add the following to my server.cfg (server\main\server.cfg)
    • set g_allowvote "1"
      set g_voteAbstainWeight    "0.5"
      set mapvote "1"
      set mapvote_mapnum "5"
      set mapvote_mapnum "5"
      set mapvote_norepeat "3"
      set mapvote_norepeat "3"
      set mapvote_time "15"
      set mapvote_time "15"

This did not work because of a dynamic_rotation thread, so I added leiizko's gsx to server \mods\modname\code\ which then had another code\.gsx thread missing (obviously) but I figured I wanted that feature too so I kept adding gsx files of leiizko's to my code\.gsx until I had copies of common, player, file, events, and trueskill. Then the server launched without any errors or warnings but instead of a vote, this happened

 

throwing script exception: undefined is not an array, string, or vector

^1******* script runtime error *******
undefined is not an array, string, or vector: (file 'maps/mp/gametypes/_globallogic.gsc', line 1335)
 wait ( 20 - 2 * ( level.dvar[ "dynamic_rotation_enable" ] & level.dvar[ "mapvote" ] ) );
                         *

^1started from:
(file 'maps/mp/gametypes/_globallogic.gsc', line 1332)
 wait 5.0; //scoreboard time 5 sec
 *

 

 

I'm sure I need to mess with my own globallogic or be more specific about which parts of leiizkos scripts I use but I am not sure which would make more sense or if thats really even the issue.

 

All help appreciated :)

 

edit: i tried adding the rest of leiizko's code\.gsx files into my code directory with no change in behavior. im thinking i need to use some more of his globallogic at the moment

Edited by DRATiNYMOUS

Share this post


Link to post
Share on other sites
Posted (edited)

Swapping a lot of the files from modwarfare out for copies from new experience was able to get those features working but now I'm unable to choose or create a class due to the lack of modwarfare files so I'm basically  trying the reverse method where I'll be trying to add modwarfare features into new experience. If anyone knows which pieces of script within the modwarfare (or any mod , really ) allows the player to create a class from all allowed weapons/perks I would really love to know how to get them threaded into these directories :) ❤️

 

I assume these threads in the default ModWarfare source would contain everything I'd need (plus whatever they depend on)

image.png

Edited by DRATiNYMOUS

Share this post


Link to post
Share on other sites
Posted (edited)

i tried threading to all of those and get an error compiling script on server launch.

 

^1******* script runtime error *******
size cannot be applied to undefined: (file 'maps/mp/gametypes/_modwarfare.gsc', line 391)
  for ( index = 0; index < level.players.size; index++ )
                                 *
^1called from:
(file 'maps/mp/gametypes/_modwarfare.gsc', line 637)
 setDvarWrapper( teamName + "_allow_" + classType, game[teamName + "_" + classType + "_count"] < getDvarInt( "class_" + classType + "_limit" ) );
 *
^1called from:
(file 'maps/mp/gametypes/_modwarfare.gsc', line 223)
 updateClassAvailability( "allies", "assault" );
 *
^1called from:
(file 'maps/mp/gametypes/_modwarfare.gsc', line 216)
 level thread classDvarUpdate();
              *
^1called from:
(file 'maps/mp/gametypes/_globallogic.gsx', line 3947)
 thread maps\mp\gametypes\_modwarfare::init();
        *
^1called from:
(file 'maps/mp/gametypes/_callbacksetup.gsx', line 15)
  [[level.callbackStartGameType]]();
          *
^1started from:
(file 'maps/mp/gametypes/_callbacksetup.gsx', line 10)
CodeCallback_StartGameType()
*

 

There doesn't seem to me to be much inside of these scripts including "setDvarWrapper" and I can't find on google what that means . But I was able to find a similar script to the broken line 391.


setDvarWrapper( dvarName, setVal )
{
    setDvar( dvarName, setVal );
    if ( isDefined( level.serverDvars[dvarName] ) )
    {
        level.serverDvars[dvarName] = setVal;
        for (i = 0; i < level.players.size; i++ )
            level.players setClientDvar( dvarName, setVal ) ;
    }
}
-------------------------------------
setDvarWrapper( dvarName, setVal )
{
    setDvar( dvarName, setVal );
    if ( isDefined( level.serverDvars[dvarName] ) )
    {
        level.serverDvars[dvarName] = setVal;
        players = level.players;
        for ( index = 0; index < level.players.size; index++ )
            players[index] setClientDvar( dvarName, setVal );
    }
}


the top script is the one i found on google that had busted syntax but i think it might work after reformatting. im not really sure what difference "players = level.players;" missing makes but removing that bit from the script returned the same error on launch.

Edited by DRATiNYMOUS

Share this post


Link to post
Share on other sites

That happens with cut and paste. level.players is something set in global logic during game init. So going from the information available there are likely two possibilities. You are somehow accessing it before it is, so its undefined. Or, in the mod you are using, things were changed and the variable isnt used at all. All you can do is, first, make sure the array is set and populated with players and second compare that with when modwarfare::init is called.

It is best that you figure those possibilities out because it might be a symptom of other things. However, if you want to just see what happens add this and use players instead of level.players.

players = getEntArray( "player", "classname");

However because of the above problem using this might easily introduce its own problems. As always, use at your own risk.

Share this post


Link to post
Share on other sites
Posted (edited)
8 minutes ago, Sheryl said:

That happens with cut and paste. level.players is something set in global logic during game init. So going from the information available there are likely two possibilities. You are somehow accessing it before it is, so its undefined. Or, in the mod you are using, things were changed and the variable isnt used at all. All you can do is, first, make sure the array is set and populated with players and second compare that with when modwarfare::init is called.

It is best that you figure those possibilities out because it might be a symptom of other things. However, if you want to just see what happens add this and use players instead of level.players.

players = getEntArray( "player", "classname");

However because of the above problem using this might easily introduce its own problems. As always, use at your own risk.

thank you so much! i am just discovering  more about the arrays and stuff on zeroys site. you're suggesting i replace players=level.players with players = getEntArray( "player", "classname"); then ? I am prepared for the side effects of copy and paste, i enjoy the learning experience in the end. I just worry I will annoy everyone here so I'm struggling with when to ask for help and how much info is necessary you know? thanks again

 

edit: btw the array is set before modwarfare::init is called. the other possibility you suggest is that modwarfare has no use for the array? or?

Edited by DRATiNYMOUS

Share this post


Link to post
Share on other sites

pair '0' and 'undefined' has unmatching types 'int' and 'undefined': (file 'maps/mp/gametypes/_modwarfare.gsc', line 391)
  for ( index = 0; index < level.players.size; index++ )

Share this post


Link to post
Share on other sites
49 minutes ago, Sheryl said:

You are somehow accessing it before it is, so its undefined.

 

    thread maps\mp\gametypes\_persistence::init();
    thread maps\mp\gametypes\_menus::init();
    thread maps\mp\gametypes\_hud::init();
    thread maps\mp\gametypes\_serversettings::init();
    thread maps\mp\gametypes\_clientids::init();
    thread maps\mp\gametypes\_teams::init();
    thread maps\mp\gametypes\_weapons::init();
    thread maps\mp\gametypes\_scoreboard::init();
    thread maps\mp\gametypes\_killcam::init();
    thread maps\mp\gametypes\_shellshock::init();
    thread maps\mp\gametypes\_deathicons::init();
    thread maps\mp\gametypes\_damagefeedback::init();
    thread maps\mp\gametypes\_healthoverlay::init();
    thread maps\mp\gametypes\_spectating::init();
    thread maps\mp\gametypes\_objpoints::init();
    thread maps\mp\gametypes\_gameobjects::init();
    thread maps\mp\gametypes\_spawnlogic::init();
    thread maps\mp\gametypes\_oldschool::init();
    thread maps\mp\gametypes\_battlechatter_mp::init();
    thread code\init::startGameType();
    thread maps\mp\gametypes\_modwarfare::init();

 

I missed this. the modwarfare thread was at the top of the list and now at the bottom the server works fine and im able to pick a class finally!! I still need to enable access to everything from level 1 now!

Share this post


Link to post
Share on other sites

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.

Sign in to follow this