UGX-Mods 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 Facebook
Sign In with Twitch

Help with scripts

broken avatar :(
Created 7 years ago
by Cxwh
0 Members and 1 Guest are viewing this topic.
1,600 views
broken avatar :(
×
broken avatar :(
Location: at
Date Registered: 26 November 2016
Last active: 6 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Signature
12 year old music critic, quadrasexual Minecrafter, Linkin Park fan, Hentai enthusiast, intelligent atheist and vegan.
×
Cxwh's Groups
Cxwh's Contact & Social LinksCxwhModsGodAspire
Okay so I'm fairly new to zombie modding, but I used to code BO2 GSC and now since BO3 Modtools were released I decided to come back to modding :D

So my main questions are:
How do I get the costs of an trigger? (.costs is just made up)
 How do I make it so that the trigger doesn't cost anything for only me?

Spoiler: click to open...
Shopping Free
Code Snippet
Plaintext
//bgb shopping free
function bgb_shopping_free()
{
    self endon("bgb_done");

    self thread wait_notify(60, "bgb_done"); //1min
    self thread waittill_call("bgb_done", "reset_triggers");

    self.shopping_free = true;
    setdvar("zombie_unlock_all", 1);

    self.triggers = strTok("zombie_doors, zombie_door, zombie_airlock_buy, zombie_debris, flag_blocker, window_shutter", ", ");
    wait 0.1;

    foreach(trigger in triggers)
    {
        trigger_ent = GetEntArray(trigger, "targetname");
        for(i = 0; i < trigger_ent.size; i++)
        {
            trigger_ent[i].old_costs = trigger_ent[i].costs;
            trigger_ent[i].costs = 0;
            trigger_ent[i].was_player_triggered = false;
           
            //add check if player is self
            trigger_ent[i] waittill("trigger", player);
            trigger_ent[i].was_player_triggered = true;
        }
    }
}

function reset_triggers()
{
    triggers = self.triggers;
    foreach(trigger in triggers)
    {
        trigger_ent = GetEntArray(trigger, "targetname");
        for(i = 0; i < trigger_ent.size; i++)
        {
            if( !trigger_ent[i].was_player_triggered )
                trigger_ent[i].costs = trigger_ent[i].old_costs;
        }
    }
    wait 0.1;

    if(!self others_have_shopping_free())
        setdvar("zombie_unlock_all", 0);
    self.triggers = undefined;
}

function others_have_shopping_free()
{
    players = GetPlayers(self.team);
    foreach(player in players)
    {
        if(player == self)
            continue;

        if(player.shopping_free)
            return true;
        else
            result = false;
    }
    return result;
}

function wait_notify(time, event)
{
    wait time;
    self notify(event);
}

function waittill_call(event, func, arg1, arg2)
{
    self waittill(event);

    if(isDefined( arg1 ) && isDefined( arg2 ))
        self thread [[ func ]](arg1, arg2);

    else if(isDefined( arg1 ) && !isDefined( arg2 ))
        self thread [[ func ]](arg1);

    else
        self thread [[ func ]]();
}

And I'm trying to make my own gobblegums (bgbs) and I made this script but I don't know the names of the fxs/sounds, can someone help me with it or show me a way to work around it?

This is more of a random question
Are there any effects for stuff like the electric cherry electricity/blast furnace? (sound, fx)

Spoiler: click to open...
Has no name yet
Code Snippet
Plaintext
//new bgb
function have_not_found_a_name_yet()
{
    self endon("bgb_done");

    range = 120;
    rangeSQ = range*range; //since we're using distanceSquared
    self thread electrocuting_ambient(range);

    //time = &RandomIntRange(1, 3); //would be better because i wont get results like 0.11
    time = &RandomFloatRange(0.1, 0.3);
    self waittill("player_used_bgb");

    AI = GetAITeamArray("axis");
    AI = self getClosest(AI, rangeSQ);
    for(i = 0; i < AI.size; i++)
    {
        AI[i] FreezeControls(true); //idk how to freeze a zombie lol
        fx_duration = RandomFloatRange(0.1, 0.3);

        wait time; //or time/10 if I use IntRange
        self notify("electrocuting_zombies");

        while(fx_duration <= 0)
        {
            //bo2's fx - don't know bo3's fx
            PlayFxOnTag(level._effect["prox_grenade_player_shock"], AI[i], "j_head");
            PlayFxOnTag(level._effect["prox_grenade_player_shock"], AI[i], "J_Spine1");
            PlayFxOnTag(level._effect["prox_grenade_player_shock"], AI[i], "J_Spine4");
            PlayFxOnTag(level._effect["prox_grenade_player_shock"], AI[i], "pelvis");
            fx_duration -= 0.09; //just to add more randomness
            wait 0.05;
        }
        wait 0.05;
        AI[i] FreezeControls(false);
        AI[i] DetachAll();
        AI[i] DoDamage(AI[i].health + 1, self.origin, self);
        self zm_score::add_to_player_score(100); //or less idk
    }
}

function electrocuting_ambient(range)
{
    self endon("bgb_done");

    self waittill("electrocuting_zombies");
    pos = self.origin;

    PlaySoundAtPosition("wpn_taser_mine_zap", pos); //bo2's sound
    Earthquake(0.22, 0.4, pos, range);
}

function getClosest(ents, rangeSQ, is_squared = true) //SQ = squared
{
    index = 0;
    newArr = []

    if(!is_squared)
        rangeSQ *= rangeSQ;

    for(i = 0; i < ents.size; i++)
    {
        if(DistanceSquared(self.origin, ents[i].origin) <= rangeSQ)
        {
            newArr[index] = ents[i];
            index++;
        }
    }
    return newArr;
}
I would be thankfull for any help I can get!
Last Edit: November 30, 2016, 04:07:49 pm by MZslayer11
broken avatar :(
×
broken avatar :(
Location: at
Date Registered: 26 November 2016
Last active: 6 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Cxwh's Groups
Cxwh's Contact & Social LinksCxwhModsGodAspire
I'm new to UGX and I don't know how to edit posts (if I even can) so I apologise for the [INDENT] tags throughout this post
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 7 March 2014
Last active: 2 months ago
Posts
1,191
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Site Moderator
My Groups
More
My Contact & Social Links
More
×
MZslayer11's Groups
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
You cannot edit posts until you reach 20 posts on the forum. (Anti spam measure)
I can remove those for you. 
broken avatar :(
×
broken avatar :(
Location: at
Date Registered: 26 November 2016
Last active: 6 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Cxwh's Groups
Cxwh's Contact & Social LinksCxwhModsGodAspire
You cannot edit posts until you reach 20 posts on the forum. (Anti spam measure)
I can remove those for you.
Thank's! I'll try and get those 20 points asap :D

 
Loading ...