Do you have _zm_perks.gsc included at the top of the file like this?:
#using scripts\zm\_zm_perks;
also change it from _zm_perks:: to zm_perks::
Here, could you take a look at my code? Not quite sure what's wrong. Also, what code would I need to do in order to have it say, give the player the Ragnarok DG4's instead? My map's name is zm_tutorial, and this is in the zm_tutorial.gsc file.
#using scripts\codescripts\struct;
#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;
#insert scripts\zm\_zm_perks.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;
#using scripts\zm\_zm_perk_widows_wine;
#using scripts\zm\_zm_perk_electric_cherry;
//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;
//*****************************************************************************
// MAIN
//*****************************************************************************
#using scripts\zm\_zm_perks;
function main()
{
zm_usermap::main();
level.perk_purchase_limit = 9;
level._zombie_custom_add_weapons = &custom_add_weapons;
level.zones = [];
level.zone_manager_init_func = &usermap_test_zone_init;
init_zones[0] = "start_zone";
level thread zm_zonemgr::manage_zones( init_zones );
// Allows you to add your own code to execute when a player spawns, without having to directly edit the function in _globallogic_player
callback::on_spawned( &on_player_spawned );
// Searches the map for triggers and threads the logic function for them, assigning an id as well
level.shootable_triggers = getEntArray( "ec_perk_trigger", "targetname" );
if( isDefined( level.shootable_triggers ) )
{
id = 0;
foreach( trigger in level.shootable_triggers )
{
trigger thread shootable_trigger_think(id);
id++;
}
}
}
function usermap_test_zone_init()
{
level flag::init( "always_on" );
level flag::set( "always_on" );
// Your code here, depends on if you have zones setup
/*
zm_zonemgr::add_adjacent_zone( "start_zone", "zone_2", "zone_1_to_2_trigger" );
zm_zonemgr::add_adjacent_zone( "zone_2", "zone_4", "zone_2_to_4_trigger" );
zm_zonemgr::add_adjacent_zone( "zone_2", "zone_6", "zone_2_to_6_trigger" );
zm_zonemgr::add_adjacent_zone( "zone_2", "zone_3", "zone_2_to_3_trigger" );
zm_zonemgr::add_adjacent_zone( "zone_3", "zone_6", "zone_3_to_6_trigger" );
zm_zonemgr::add_adjacent_zone( "zone_2", "zone_5", "zone_2_to_5_trigger" );
*/
}
function custom_add_weapons()
{
zm_weapons::load_weapon_spec_from_table("gamedata/weapons/zm/zm_levelcommon_weapons.csv", 1);
}
function on_player_spawned()
{
self notify( "shootable_trigger_destroy" );
self.shootable_triggers_shot = 0;
// Used so multiple players can do the process, rather than tying progress to the teddies
self.shootable_triggers_personal = [];
for( i = 0; i < level.shootable_triggers_personal.size; i++ )
{
self.shootable_triggers_personal[i] = false;
}
}
function shootable_trigger_think( id )
{
while(1)
{
self waittill( "damage", amount, attacker, directionVec, point, type );
if( !IsDefined( attacker ) || !IsPlayer( attacker ) )
{
WAIT_SERVER_FRAME;
continue;
}
if( IsPlayer( attacker ) )
{
if( IsDefined( attacker.shootable_triggers_personal ) && attacker.shootable_triggers_personal[id] == false )
{
attacker.shootable_triggers_personal[id] = true;
attacker thread checkProgress();
}
}
}
}
function checkProgress()
{
count = 0;
foreach( entry in self.shootable_triggers_personal )
{
if( entry == true )
{
count++;
}
}
// They have hit every teddy
if( count >= level.shootable_triggers.size )
{
// Adds the perk, but doesn't handle the HUD part
self zm_perks::give_perk( "marathon_perk" );
}
}