Posts
86
Respect
34Add +1
Forum Rank
Rotting Walker
Primary Group
Community Mapper
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager. |
>class,zm_mod_levelTo parse our script, we add the line:
>group,modtools
xmodel,skybox_default_day
material,luts_t7_default
// BSP
col_map,maps/zm/zm_yourmapname.d3dbsp
gfx_map,maps/zm/zm_yourmapname.d3dbsp
// Audio
sound,zm_yourmapname
scriptparsetree,scripts/zm/zm_yourmapname.gsc
scriptparsetree,scripts/zm/zm_yourmapname.csc
scriptparsetree,scripts/zm/my_external_script.gscto the bottom.
function my_cool_print_function()this can be it for our external script. Now let's find a way to call it.
{
IPrintLnBold("Your Mom looks like a Turtle");
}
function main()Since we also want this function to be called after all players have connected, and then 10 seconds after that, we should call it below the wait(10); line.
{
zm_usermap::main();
level._zombie_custom_add_weapons =&custom_add_weapons;
//Setup the levels Zombie Zone Volumes
level.zones = ;
level.zone_manager_init_func =&usermap_test_zone_init;
init_zones[0] = "start_zone";
level thread zm_zonemgr::manage_zones( init_zones );
level.pathdist_type = PATHDIST_ORIGINAL;
level waittill("all_players_connected");
wait(10);
thread my_awesome_function();
}
function my_awesome_function()
{
IPrintLnBold("Hello Everybody");
}
my_external_script::my_cool_print_function();notice:
thread my_external_script::my_cool_print_function();So, let's show it all in place:
function main()
{
zm_usermap::main();
level._zombie_custom_add_weapons =&custom_add_weapons;
//Setup the levels Zombie Zone Volumes
level.zones = ;
level.zone_manager_init_func =&usermap_test_zone_init;
init_zones[0] = "start_zone";
level thread zm_zonemgr::manage_zones( init_zones );
level.pathdist_type = PATHDIST_ORIGINAL;
level waittill("all_players_connected");
wait(10);
thread my_awesome_function();
thread my_external_script::my_cool_print_function();
}
function my_awesome_function()
{
IPrintLnBold("Hello Everybody");
}
********************************************************************************this is because anytime you call a function from an external .gsc file, you must include that file in the #using's at the stop of the script that's calling it.
UNRECOVERABLE ERROR:
^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_yourmapname.gsc'
ERR(6E) scripts/zm/zm_yourmapname.gsc (93,0) : Compiler Internal Error : Unresolved external 'my_external_script::my_cool_print_function'
Linker will now terminate.
********************************************************************************
#using scripts\zm\my_external_script;notice:
#using scripts\codescripts\struct;Now in-game you should notice both the print function inside yourmapname.gsc and the print function in the my_external_script.gsc being called, at pretty much the same exact time.
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\_zm_utility.gsh;
#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;
#using scripts\shared\ai\zombie_utility;
//Perks
#using scripts\zm\_zm_pack_a_punch;
#using scripts\zm\_zm_pack_a_punch_util;
#using scripts\zm\_zm_perk_additionalprimaryweapon;
#using scripts\zm\_zm_perk_doubletap2;
#using scripts\zm\_zm_perk_deadshot;
#using scripts\zm\_zm_perk_juggernaut;
#using scripts\zm\_zm_perk_quick_revive;
#using scripts\zm\_zm_perk_sleight_of_hand;
#using scripts\zm\_zm_perk_staminup;
//Powerups
#using scripts\zm\_zm_powerup_double_points;
#using scripts\zm\_zm_powerup_carpenter;
#using scripts\zm\_zm_powerup_fire_sale;
#using scripts\zm\_zm_powerup_free_perk;
#using scripts\zm\_zm_powerup_full_ammo;
#using scripts\zm\_zm_powerup_insta_kill;
#using scripts\zm\_zm_powerup_nuke;
//#using scripts\zm\_zm_powerup_weapon_minigun;
//Traps
#using scripts\zm\_zm_trap_electric;
#using scripts\zm\zm_usermap;
#using scripts\zm\my_external_script;
//*****************************************************************************
// MAIN
//*****************************************************************************
function main()
{
zm_usermap::main();
level._zombie_custom_add_weapons =&custom_add_weapons;
//Setup the levels Zombie Zone Volumes
level.zones = ;
level.zone_manager_init_func =&usermap_test_zone_init;
init_zones[0] = "start_zone";
level thread zm_zonemgr::manage_zones( init_zones );
level.pathdist_type = PATHDIST_ORIGINAL;
level waittill("all_players_connected");
wait(10);
thread my_awesome_function();
thread my_external_script::my_cool_print_function();
}
function my_awesome_function()
{
IPrintLnBold("Hello Everybody");
}
function usermap_test_zone_init()
{
level flag::init( "always_on" );
level flag::set( "always_on" );
}
function custom_add_weapons()
{
zm_weapons::load_weapon_spec_from_table("gamedata/weapons/zm/zm_levelcommon_weapons.csv", 1);
}
#namespace zombie_utility;it's as simple as putting #namespace followed by the name you want to give the script.
zom = zombie_utility::spawn_zombie( spawner, target_name, location, round_number );I just have to remember to have the #using for the script at the top of my script:
#using scripts\shared\ai\zombie_utility;and remember to make sure I'm calling the function by whatever #namespace Treyarch gave that script, not necessarily the filename (though in this case they are the same)