Give Perk Through Easter Egg Help?

broken avatar :(
Created 1157 days ago
by kingneo
0 Members and 1 Guest are viewing this topic.
1,936 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 13 July 2016
Last active: 1107 days ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
kingneo's Groups
kingneo's Contact & Social Links
Hi,

In my custom map I have three teddy bears that, when shot, give the player the electric cherry perk. I have the script mostly working for this thanks to Xylozi, but near the end of the script, I have the code
self _zm_perks::give_perk( "electric_cherry_perk" );

However, I get an error when building/linking that says this: "^1ERR(6E) scripts/zm/zm_tutorial.gsc (155,1)  : Compiler Internal Error :  Unresolved external '_zm_perks::give_perk'"

Anyone know what's going on here? Thanks!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 107 days ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
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::
Last Edit: October 08, 2016, 11:00:16 pm by reckfullies
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 13 July 2016
Last active: 1107 days ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
kingneo's Groups
kingneo's Contact & Social Links
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" );
    }
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 107 days ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
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" );
    }
}

I'm not sure you can currently give the player ragnarok dg4's in the beta.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 13 July 2016
Last active: 1107 days ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
kingneo's Groups
kingneo's Contact & Social Links
I'm not sure you can currently give the player ragnarok dg4's in the beta.
Okay cool, but can you see what I'm doing wrong in my code? Thanks for the help again man, really appreciate it, just really new to scirpting/the mod tools XD

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...