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

Easy EEs, buildables, custom doors, and buyable debris (_mc_puzzles_v1.7.1)

broken avatar :(
Created 10 years ago
by MakeCents
0 Members and 1 Guest are viewing this topic.
8,502 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Update 10-4-2014: Added three prefabs, ee, weapon_base, and power. By adjusting the correlating thread Each_puzzle(...); you can copy the prefab you want into your map and move the pieces around. I hope this makes it easier to understand this script and how to use it.

v1.6 fixed power switch trigger
v1.7 fixed line that gives each player the buildable gun in GiveMeAGun()
v1.7.1 fixed givemegun again so it doesn't let same player get more than one time (dl includes prefabs)


Instructions
This script will handle EEs, buildables, custom doors, and buyable debris, as it is. It is set up as a template for you to easily expand if you wish, but there are some existing functions. Points reward, secret door, electric on, and gun build. You need only to edit the
Code Snippet
Plaintext
thread Each_puzzle(...);
code lines, and set up your kvps in radiant to make this script work. See below for steps. Please read, I left a lot of notes.

You should understand how to use radiant and what script models, brush models, and kvps are
before attempting to use this, and already know how to make images, shaders, and sounds, if necessary.


This is just how simple this is:

*********Initial Setup**********
First, if you haven't already, copy the below code to a file named _mc_puzzles.gsc, or download and extract the attachment _mc_puzzles_v1.7.rar to your mapname\maps folder. _mc_puzzles_docs.txt is included for instructions. Add
Code Snippet
Plaintext
 maps\_mc_puzzles::init();
somewhere under:
Code Snippet
Plaintext
maps\_zombiemode::main();
in your mapname.gsc

You may chose to use or not use the prefabs. There are instructions for both ways.
*********After Setup Not Using Prefabs***********
In radiant, if your not using the prefabs:
Make 3 script_models with kvps: targetname: ee_a1, ee_a2, and ee_a3
Make 3 trigger damages with kvps: targetname: ee_a1_trig, ee_a2_trig, and ee_a3_trig

Save, Close, and
Compile map


Open _mc_puzzles.gsc in your mapname\maps folder
Change:
Code Snippet
Plaintext
thread Each_puzzle(0,"ee","ee_a","",0,"points","","");
to
Code Snippet
Plaintext
thread Each_puzzle(3,"ee","ee_a","",0,"points","","");

Save, Close, and
Build your mod

Run game and shoot three script_models to get 5000 points

*********After Setup Using Prefabs***********
if you are using the prefabs then copy them into your map and make the following correlating changes:
For the ee prefab, change:
Code Snippet
Plaintext
 thread Each_puzzle(0,"ee","ee_a","",0,"points","",""); //change count for ee points

to
Code Snippet
Plaintext
 thread Each_puzzle(3,"ee","ee_a","",0,"points","",""); //change count for ee points

For the power prefab, change:

Code Snippet
Plaintext
thread Each_puzzle(0,"buildable","build_a","Pick up electric part?",1,"electric","",""); //change count

to
Code Snippet
Plaintext
thread Each_puzzle(2,"buildable","build_a","Pick up electric part?",1,"electric","",""); //change count

For the weapon_base prefab, change:
Code Snippet
Plaintext
 thread Each_puzzle(0,"buildable","build_b","Pick up gun part?",1,"gun","",""); //change count

to
Code Snippet
Plaintext
 thread Each_puzzle(3,"buildable","build_b","Pick up gun part?",1,"gun","",""); //change count


Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;


/*
#################################
_mc_puzzles_v1.7.1
by M.A.K.E C E N T S           ##
by ...Your name                ##
#################################
See _mc_puzzles_docs.txt for more information on editing this script

This script is designed to make EE's, buildable's, custom doors, and debris easier to handle.
Edit the following where needed to make your EE, buildable, door, or debris work the way you want
You should understand how to use radiant and what script models, brush models, and kvps are
before attempting to use this, and already know how to make images, shaders, and sounds, if necessary.

Make sure you call this from you nazi_zombie_mapname.gsc: maps\_mc_puzzles::init();
somewhere under: maps\_zombiemode::main();*/

init()
{   
    flag_wait( "all_players_connected" );
    //I precache everything in _zombiemode.gsc where its organized...
   
    //====================Add puzzle info==========================
    level.puzzlecounts = []; //initalize the counts for keeping track of how many have been triggered

    //Argument definitions:
    //thread Each_puzzle(count,delta,puzzle_prefix,hint,after,reward,sound,fx);

    //#########################################EES#######################################
    thread Each_puzzle(0,"ee","ee_a","",0,"points","",""); //change count for ee points
    thread Each_puzzle(0,"ee","ee_b","",0,"secret_door","",""); //change count for secret_door

    //#####################################BUILDABLES##################################
    thread Each_puzzle(0,"buildable","build_a","Pick up electric part?",1,"electric","",""); //change count
    thread Each_puzzle(0,"buildable","build_b","Pick up gun part?",1,"gun","",""); //change count

    /*Setup trigger for after buildable is complete if you want
    If one is not set up then it will just trigger at the end of buildable and ignore this*/
    turnonelec_trig = getent("turnonelec_trig", "targetname"); //trigger for the electric buildable
    turnonelec_trig thread buildmodelhide();//make handle script_noteworthy kvp: "power_switch" to make it rotate and play fx
    //for electric, make an extra trigger with targetname "use_power_switch", and then place that outside your map
    imadethis_trig = getent("imadethis_trig", "targetname"); //trigger for the gun buildable
    imadethis_trig thread buildmodelhide();
   
    //################################DOORS######################################
    thread Each_puzzle(0,"doorrotate","door_a","Open door",0,"","door_slide_open","");//rotates 90 degrees
   
    //#################################DEBRIS#####################################
    thread Each_puzzle(0,"debris","debris_a","Clear debris",0,"","weap_wall","poltergeist");
}
buildmodelhide(){
    self disable_trigger();
    if(isdefined(self.target)){
        model = getent(self.target,"targetname");
        model hide();
    }
}
//=============================pieces of puzzle=================================
Each_puzzle(count,delta,puzzle_prefix,hint,after,reward,sound,fx){
    e = level.puzzlecounts.size;
    level.puzzlecounts[e] = count; //add how many of this set/puzzle there are
    for(i=1;i<count+1;i++){ //for each piece in set/puzzle
        thread Each_piece(e,i,delta,puzzle_prefix,hint,after,reward,sound,fx);
    }
}
Each_piece(e,i,delta,puzzle_prefix,hint,after,reward,sound,fx){
    //==============================init vars=======================
    player = undefined;
    puzzle_after = undefined;
    puzzle_trig = [];
    puzzle_name = puzzle_prefix + i;
    //============================BEGIN===============================
    puzzle = getent(puzzle_name, "targetname"); //example kvp: puzzle_a1
    // The trig is the script_model name, with number, and "_trig"
    puzzle_trig = getentarray(puzzle_name + "_trig","targetname");//example kvp: puzzle_a1_trig
    iprintlnbold(puzzle_trig.size);
    //puzzles hide a script_model, to be shown after, before finding an puzzle.
    if(after){
        puzzle_after = getent(puzzle_name + "_after", "targetname"); //example kvp: puzzle_a1_after
        puzzle_after hide();
    }
    for(t=0;t<puzzle_trig.size;t++){
        puzzle_trig[t] enablelinkto();
        puzzle_trig[t] linkto(puzzle);
        // checks hint, none, "", or TEXT
        if(!(hint=="")){ //if hint = "" then it will have icon with no hint unless kvp name is defined
           puzzle_trig[t] thread SetHint(hint,0); //0 ius for no hint icon     
        }
    }
   
    //======================Before Delta===================================
    Before_Trigger(puzzle,delta,puzzle_name); //Edit the helper function below
    //=====Wait for trigger and Check if player can afford it==================
    for(t=0;t<puzzle_trig.size;t++){
        puzzle_trig[t] thread Buypiece(puzzle); //Get the player that bought it
    }
   
    puzzle waittill("triggered");
    player = puzzle thread getplayerfromname();

    //======================Atter Delta======================================
    After_Trigger(puzzle_after,delta,puzzle_name, puzzle,sound,fx, player,reward);
    //=================update count================================
    level.puzzlecounts[e] = level.puzzlecounts[e] - 1; //Update number of this puzzle pieces found
    //==============give the player something if you want====================
    //player iprintlnbold("You found me!"); //do something for player that triggered it...
    //=================Check progress and reward if done======================
    thread RewardMe(e, reward, puzzle); //checks if this puzzle is over
}
//==========================Puzzle Helper Functions=============================
SetHint(text,icon){//what to say, "", for default, 0 for no icon, 1 for icon
    //if you want the hand icon comment out the following line
    if(text=="NOHINTS"){ //This will show no hint string or icon. Don't do this
        self setCursorHint("HINT_NOICON");
    }else{ //This will set hint and icon
        if(isdefined(self.target)){ //grab the name from the target to set the hint icon
            puzzle = getent(self.target, "targetname");
            if(isdefined(puzzle.name)){ //overides text passed in
                text = "Press &&1 to " + puzzle.name; //kvp include pick up or place then name of part
            }//EXAMPLE name kvps: pick up coil, ride a pony, take the gun, turn on the electricity
        }
        cost = 0;
        if(isdefined(self.zombie_cost)){ //if defined update the cost in the hint string
            cost = self.zombie_cost;
        } 
        if(!(icon)){
            self setCursorHint("HINT_NOICON");
        }
        if(text ==""){//Not used for intial call, for helper functions
            text = "Press &&1 to pick up"; //Defaults if there was no text passed in and no kvp name and no target
        }
        if(cost==0){ //no cost
            self sethintstring(text); //No cost, set hint string
        }else{ //if it cost something you can mod the hint string to include it
            self sethintstring(text + " [Cost: " + cost + "]");//Added cost to hint string
        }     
    }
}
Before_Trigger(puzzle,delta,puzzle_name){
    //comment out any lines that aren't necessary for your map
    //====================delta before trigger=============================
    puzzle thread Check_Clip_Spin(puzzle_name); //checks if it has a clip or spin
    if(!(delta == "")){ //check delta before trigger activation
        //this is where you could do something different for each puzzle before triggered
        if(delta == "ee"){ //piece has clip and rotates, no after piece
            //do something if it is an ee
        }else if(delta == "buildable"){ //piece has clip on before and after but no rotate
            puzzle_place_trig = getent(puzzle_name + "_place_trig", "targetname");
            puzzle_place_trig disable_trigger();
            puzzle_place = getent(puzzle_name + "_place", "targetname");
            puzzle_place hide();
            // puzzle_place_clip = getent(puzzle_name + "_place_clip", "targetname"); //if you have clips for place parts
            // puzzle_place_clip moveZ(1000,.1); //move far away so you can't hit it right now
        }else if(delta == "doorrotate"){
            //do something if it is a doorrotate
        }else if(delta == "debris"){ //same as door but left seperate incase a difference is wanted
            //do something if it is a debris
        }else if(delta == "new"){
            //a start place for you to add your own if you wish
            iprintlnbold("You have to add something for new");
        }//etc...
    }
}
Check_Clip_Spin(puzzle_name){ //if piece has script_noteworthy check it for spin or clip
    if(isdefined(self.script_noteworthy)){
        if(issubstr(self.script_noteworthy,"clip")){
            puzzle_clip = getentarray(puzzle_name + "_clip", "targetname");
            for(c=0;c<puzzle_clip.size;c++){
                puzzle_clip[c] linkto(self); //link the clip to it
            }
               
        }
        if(issubstr(self.script_noteworthy,"spin")){
            self thread spin_piece();
        }
        if(issubstr(self.script_noteworthy,"wobble")){
            self thread wobble_piece(.1);
        }
       
    }
}
After_Trigger(puzzle_after,delta,puzzle_name, puzzle,sound,fx, player,reward){
    deletepart = true; //intially plan on deleting this
    deletetrig = true; //intially plan on deleting this
    //====================delta after trigger=============================
    if(!(sound=="")){ //if a sound was entered then play it
        if(sound=="playmysound"){ //play custom sound named puzzle_name + "_sound"
            puzzle playsound(puzzle_name + "_sound");
        }else{
            puzzle playsound(sound);
        }
    }
    if(!(fx=="")){ //if a fx was entered then play it
        location = puzzle.origin + (0,0,0); //used to adjust where the fx plays
        if(sound=="playmyfx"){ //play custom fx named puzzle_name + "_fx"
            playfx (level._effect[puzzle_name + "_fx"], location);
        }else{
            playfx (level._effect[fx], location);
        }
        // playfxontag( level._effect[ fx ], puzzle, "tag_origin" ); //or use this one
    }
    puzzle thread CheckFX(); //checks for script_fxid and script_firefx
    puzzle thread Delete_Clip(puzzle_name);
    //comment out any lines that aren't necessary for your map
    if(!(delta == "")){ //if "" then it will just delete the puzzle and puzzle_trig
        //this is where you could do something different for each puzzle after triggered
        if(delta == "ee"){ //piece has clip and rotates, no after piece
            //do something if it is an ee
        }else if(delta == "buildable"){//piece has clips and rotates

            deletepuzzletrig(puzzle_name);
            puzzle delete();
            Enable_Place_Trig(puzzle_name,player, 40, 45, 100,reward);
            deletepart = false; //this is waiting to be deleted, not now
            deletetrig = false; //these were deleted in enable_place_trig already, don't do it again
            // puzzle_place_clip = getent(puzzle_name + "_clip", "targetname"); //if applicable
            // puzzle_place_clip moveZ(-1000,.1); //bring it back
        }else if(delta == "doorrotate"){ //change how you want your door to move
            puzzle thread turn_piece(90); //rotates the part
            puzzle thread move_me(); //moves part based on script_vector kvp
            deletepart = false; // but doesn't delete it, no after needed here
        }else if(delta == "debris"){
            playfx (level._effect["poltergeist"], puzzle.origin);
            puzzle thread wobble_piece(.1); //wobble piece before deleting
            wait(1);
            puzzle thread move_me(); //moves based on script_vector kvp
            waittime = 1; //default takes 1 second
            if(isdefined(puzzle.speed)){ //if defined change it
                waittime = puzzle.speed;
            }
            wait(waittime);
        }else if(delta == 5){
            //a start place for you to add your own if you wish
            iprintlnbold("You have to add something for 5");
        }//etc...
        if(isdefined(puzzle_after)){ //if we hid it earlier, show it now
            puzzle_after show();
        }
    }
    //=============================clean up================================
    if(deletetrig){ //leaves the option to make it toggle later
        deletepuzzletrig(puzzle_name); //delete the trigger now that we picked up part
    }
    if(deletepart){ //Maybe we don't want to delete the part...
        puzzle delete(); //delete the part so we can't see it
    }
}
deletepuzzletrig(puzzle_name){
    puzzle_trig = getentarray(puzzle_name + "_trig","targetname");//example kvp: puzzle_a1_trig
    for(t=0;t<puzzle_trig.size;t++){
        puzzle_trig[t] delete();
    }
}
CheckFX(){
    if(isdefined(self.script_fxid)){
        self thread TimeFX(self.script_fxid,1);
    }
    if(isdefined(self.script_firefx)){
        self thread TimeFX(self.script_firefx,1);
    }
}
TimeFX(fx,timer){
    fx_playing = spawn("script_model",self.origin);
    fx_playing setmodel("tag_origin");
    fx_playing.angles = self.angles;
    playfxontag( level._effect[ fx ],fx_playing, "tag_origin" );
    // playfx (level._effect[fx], fx_playing.origin);
    wait(timer);
    fx_playing delete();

}
Delete_Clip(puzzle_name){ //if piece has script_noteworthy check it for clip
    if(isdefined(self.script_noteworthy)){
        if(issubstr(self.script_noteworthy,"clip")){
            puzzle_clip = getentarray(puzzle_name + "_clip", "targetname"); //if you had a clip on your ee
            for(c=0;c<puzzle_clip.size;c++){
                puzzle_clip[c] delete(); //link the clip to it
            }
        }
    }
}
Enable_Place_Trig(puzzle_name,player,size,x,y,reward){
    puzzle_place_trig = getent(puzzle_name + "_place_trig", "targetname");
    puzzle_place_trig setvisibletoplayer(player); //you got the part so you can see me
    puzzle_place = getent(puzzle_name + "_place", "targetname");
    shader = puzzle_name + "_shader";
    puzzle_place_trig enable_trigger();
    //Hud stuff
    hud = create_simple_hud( player );
    hud.foreground = true;
    hud.sort = 1;
    hud.hidewheninmenu = false;
    hud.alignX = "left";
    hud.alignY = "bottom";
    hud.horzAlign = "left";
    hud.vertAlign = "bottom";
    hud.x = player.part_hud.size * x;
    hud.y = hud.y - y;
    hud.alpha = 1;
    hud SetShader( shader, size, size );
    player.part_hud[ shader ] = hud;
    //=========set up puzzle_place_trig===========
    puzzle_place_trig thread SetHint("", 0); //Default or puzzle_place_trig.target.name kvp
    puzzle_place_trig thread Buypiece(puzzle_place); //wait for trigger
    puzzle_place waittill("triggered");
    player = puzzle_place thread getplayerfromname();
   
    puzzle_place show(); //show part after triggerred
    puzzle_place thread CheckFX();
    hud destroy_hud(); //remove the shader
    player.part_hud[ shader ] = undefined;
    puzzle_place_trig delete(); //delete the trigger
    if(issubstr(reward, "gun")){
        puzzle_place thread WaitForTake(); //don't delete this until the part is finished being built or all taken
    }
   
    if(isdefined(puzzle_place.script_noteworthy)){
        iprintlnbold(puzzle_place.script);
        if(puzzle_place.script_noteworthy == "power_switch"){
            puzzle_place thread turnhandle();
        }
    }
}
WaitForTake(){
    level waittill("gun_taken"); //wait for it
    self thread CheckFX();
    self delete();
   
}
Buypiece(puzzle){
    //============================wait===============================
    //cost something to pick up part
    cost = 0;
    if(isdefined(self.zombie_cost)){
        cost = self.zombie_cost; //checks if cost defined
    }
    player = undefined;
    afford = false;
    while(!(afford)){ //loop until player that triggesr it can afford it
        self waittill("trigger", player);
        afford = player.score >= cost; //if not defined then they can afford it, it stays 0
        if(!(afford)){
            player playsound("no_cha_ching"); //they can't afford it
        }
    }
    //============================activate===========================
    if(cost>0){ //if it cost something, subtract it from player score
        player maps\_zombiemode_score::minus_to_player_score( cost );
        player playsound("cha_ching"); //You bought it
    }
    puzzle.player = player.playername;
    puzzle notify("triggered");
    // return player;
}
RewardMe(e, reward,puzzle){
    //========================Check puzzle progress===========================
    //Set your rewards here, add others and their helper functions below
    if(level.puzzlecounts[e]==0){ //All the puzzles were found so reward them
        if(reward=="points"){
            thread RewardPoints();
        }else if(reward=="electric"){
            thread RewardElectric(puzzle);
        }else if(reward == "gun"){
            thread RewardGun(puzzle);
        }else if(reward == "secret_door"){
            thread RewardSecretDoor();
        } //... for more rewards (don't foget to add the function)
    }
    // else{
    //     //do something each time one is found, but not all
    //     iprintln(level.puzzlecounts[e] + " more to go!"); //not recommened for doors and debris
    //     //do something when specific number of puzzle is found...
    // }
}
//=================================REWARDS==================================
RewardPoints(){
    //do something when all puzzles were found
    points = 5000;
    iprintlnbold("Congratulations, here are " + points + " points!");
    players = get_players();
    for(i=0;i<players.size;i++) //reward each player
    {
        players[i] maps\_zombiemode_score::add_to_player_score( points );
    }
}
RewardElectric(puzzle){
    //do something when all puzzles were found
    //could get a trigger and enable it after something is built?
    // turnonelecpart = getent("turnonelecpart", "targetname");
    // turnonelecpart show();
    turnonelec_trig = getent("turnonelec_trig", "targetname"); //kvp for trigger to turn on power
    turnonelec_trig thread buildmodelshow();
    turnonelec_trig sethint("Turn on electric?",0);
   
    turnonelec_trig thread Buypiece( puzzle); //wait for trigger
    puzzle waittill("triggered");
    player = puzzle thread getplayerfromname();

    // thread TurnOnEverything();

    maps\dlc3_code::power_electric_switch_on();

    //flag_set("teleporter_on"); //turn on a teleporter
    turnonelec_trig delete();
    // turnonelecpart delete();
}
turnhandle(){
    flag_wait("electricity_on");
    self playsound("switch_flip");
    self rotateroll(-90,.3);
    playfx(level._effect["switch_sparks"],self.origin);
}
getplayerfromname(){
    players = get_players();
    for(i=0;i<players.size;i++) //reward each player
    {
        if(players[i].playername==self.player){
            return players[i];
        }
    }
   
}
buildmodelshow(){
    self enable_trigger();
    if(isdefined(self.target)){ //or just show the parts that you built, up to you
        model = getent(self.target,"targetname");
        model show();
    }
}
RewardGun(puzzle){
    //do something when all pieces were found
    // iprintlnbold("Congratulations, you found all of these puzzles also!");
    imadethis_trig = getent("imadethis_trig", "targetname");
    imadethis_trig thread buildmodelshow();
    if(isdefined(imadethis_trig.target)){ //if you want another part to show instead when all pieces are here
        level notify("gun_taken"); //delete the old peieces
    }
    imadethis_trig sethint("Want a gun?",0); //default hint if no imadethis_trig.target.name kvp is set
    players = get_players();
    for(i=0;i<players.size;i++){
        players[i].gotcoolgun = false;
    }
    imadethis_trig thread GiveMeAGun(players.size, puzzle);
}
RewardSecretDoor(){
    secret_doors = getentarray("secret_door", "targetname"); //get all secret doors
    for(i=0;i<secret_doors.size;i++){
        secret_doors[i] playsound("door_slide_open");
        secret_doors[i] move_me();
    }
    if(isdefined(secret_doors[i].speed)){ //puzzle.speed kvp
        wait(secret_doors[i].speed);
    }
    wait(.5); //wait a little more
    for(i=0;i<secret_doors.size;i++){
        secret_doors[i] delete(); //delete the doors so it doesn't look weird
    }
}
//====================Reward Helper Functions========================
GiveMeAGun(turns,puzzle){
    taken = 0; //initialize that none were taken yet
    while(1){
        self thread Buypiece( puzzle); //wait for trigger
        self waittill("trigger", player);
        // player.gotcoolgun = false;
        if(!(player.gotcoolgun)){ //if we haven't receieved a gun yet
             //do something when this is hit, like give weapon or turn electric on.
            taken = taken+1; //one more was taken
            gun = player getcurrentweapon();
            player thread GiveCoolWeapon(); //give a weapon and don't let them have another
            guns = player GetWeaponsListPrimaries();
           
            if(guns.size>2){
                player takeweapon(gun);
            }
            player playsound("cha_ching");
        }
        if(taken == turns){ //once each player got on delete this
            if(isdefined(self.target)){ //Don't show this anymore since everyone got a gun
                imadethis = getent(self.target,"targetname");
                imadethis thread CheckFX();
                imadethis delete(); //if there was a part shown, delete it once each player gets it
            }else{
                level notify("gun_taken");//delete the old peieces now since we didn't earlier
            }
            self delete();
            return;
        }
    }   
}
GiveCoolWeapon(){
    self.gotcoolgun = true; //you have one, no more for you
    weapons = []; //create array of guns
    weapons[weapons.size] = "ray_gun";
    weapons[weapons.size] = "tesla_gun";
    weapons[weapons.size] = "zombie_mg42";
    weapons[weapons.size] = "zombie_30cal";
    for(i=0;i<weapons.size;i++){
        if(!(self hasweapon(weapons[i]))){//don't give them something they have
            if(!(self hasweapon(weapons[i]+"_upgraded"))){
                if(!(issubstr(weapons[i],"gun"))){ //if not the ray or tesla gun
                    self giveweapon(weapons[i]+"_upgraded"); //upgrade the mg42 and 30call
                    self switchtoweapon(weapons[i]+"_upgraded");
                }else{
                    self giveweapon(weapons[i]);
                    self switchtoweapon(weapons[i]);
                }
                return;
            }
        }
    }
}
TurnOnEverything(){ //turns on electric and perk machines
    flag_set("electricity_on");
    level notify("sleight_on");
    level notify("Pack_A_Punch_on");
    level notify("juggernog_on");
    level notify("revive_on");
    level notify("doubletap_on");
    iprintlnbold("Congratulations, The electricty is now on!");
}
//=================================DELTA Movements==============================
spin_piece(){ //spin piece
    //==========================spins peiece============================
    while(1){
        speed = 1; //defaults to 1
        if(isdefined(self.speed)){
            speed = self.speed;
        }
        if (speed<1){
            speed = 1; //seem to have issues if it tries to spin faster
        }
        self rotateyaw(360,speed);
        wait(speed);
    }
}
turn_piece(turn){ //turn degrees to rotate this piece
    //==========================rotates peiece============================
    speed = 1; //defaults to 1
    if(isdefined(self.speed)){
        speed = self.speed;
    }
    self rotateyaw(turn,speed);
}
wobble_piece(speed){
    //==============================wobbles piece======================
    while(1){
        self rotateroll(15,speed);
        wait(speed+.05);
        self rotateroll(-30,speed*2);
        wait(speed*2+.05);
        self rotateroll(15,speed);
        wait(speed + .05);
    }
}
move_me(){
    //============================Moves piece==========================
    //make sure to use script_vector and select dynamicpath check box for doors and debris
    newdest = self.origin; //defaults to 0 0 0 movement
    if(isdefined(self.script_vector)){
        newdest = self.origin + self.script_vector; //kvp> script_vector: 100 0 0 for example
    }
    timeto = .5; //defaults to .5
    if(isdefined(self.speed)){
        timeto = self.speed; //adjust the speed it moves
    }
    self moveto(newdest,timeto);
}

docs
Code Snippet
Plaintext
/*
======================
by M.A.K.E C E N T S
======================
v1.1 removed default spinning of ees
v1.2 replaced redundancies, added script_noteworthy support for spin and clip
v1.3 added support for script_firefx and script_fxid for puzzle and place puzzle
v1.4 added support for multiple triggers and/or clips per puzzle piece, improved power buildable
v1.5 fixed power build from deleting itself after gun build
v1.6 fixed power build trigger
v1.7 fixed buildable gun for all players
v1.7.1 fixed givemegun again so it doesn't let same player get more than one time

These docs explain:
- KVPs for Radiant
- Parameters for Each_puzzle()
- Function Definitions
=============================KVPS===============================
    kvps used for radiant: (targetname is the only required kvp)
        targetname: puzzle_prefix + increment EXAMPLE: ee_a1
        script_vector: x y z movement from current position EXAMPLE: 0 100 0
        speed: how long should it take to get there EXAMPLE: .5
        name: overides the hint string. Inlcude pick up, or place, before name if applicable EXAMPLE: pick up part
        zombie_cost: the cost of hit trigger
    ===================EES, BUILDABLES, DOORS, DEBRIS==================
    puzzle: (the model)
        targetname (required)
        script_vector (defaults to 0 0 0)
        speed (defaults to 10 for rotate or .5 for move)
        name (defaults to Press &&1 to pick up)(and [Cost: COST], if zombie_cost is defined)
script_noteworthy: recognizes soubstrings spin or clip (spinclip works too), power_switch for buildable power
        script_firefx: string for fx
        script_fxid: string for fx
    puzzle_trig: (the trigger for the model)
        targetname
        name
        target (if defined, grabs the name from the puzzle for the hint string)
        zombie_cost (defaults to no cost)
    puzzle_after: (show after piece is triggered)
        targetname
    puzzle_clip: (links to piece)
        targetname
    ========================BUILDABLES=================================
    puzzle_place: (the model to place)
        targetname
        script_vector
        speed
        name
        script_firefx: string for fx
        script_fxid: string for fx
    puzzle_place_trig: (the trigger for the model to place)
        targetname
        name
        target
        zombie_cost
    puzzle_place_clip: (links to puzzle_place)
        targetname
    */
    /*#################################Parameters######################################
    For each set of any of these, ee, buildable, door, or debris, thread a call to Each_puzzle
    with the following arguments:
        count= how many peices/doors/debris to this puzzle
        delta = handle this differently
        puzzle_prefix =  matches what each peice will be preceded by
        hint = NOHINTS for nothing, "" for no hint with icon, or text for hint (overiden by kvp if present)
        after = 0 for no or 1 for yes to have a script_model show imediatly after trigered
        reward = the reward for completing this which threads the appropiate function
        sound = the sound to play when the trigger is activated
        fx = the fx to play when the trigger is activated
    EXAMPLE:
       
    You can have as many sets of these as you want, just remember hint strings have a low limit
    All counts set to 0 initially which means this script does little until changed


    =================== Function Definitions=============================
    init()
        - threads Each_puzzle
    Each_puzzle(count,delta,puzzle_prefix,hint,after,reward,sound,fx)
        - threads Each_piece() based on count
        count = number of pieces
        delta = what this is that will determine what happens before and after trigger
        puzzle_prefix - the prefix that goes bofore all peieces related to this peice, clips, triggers, place parts...
        hint = what hint you want to give the piece_trig
        after = boolean, whether there will be a part that shows right after or not
        reward = what the reward will be for this puzzle
        sound = what sound to play when peice is trigered, use playmysound for custom sound named puzzle_name + _sound
        fx = what fx to play when peice is trigered, use playmyfx for custom fx named puzzle_name + _fx
    Each_piece(e,i,delta,puzzle_prefix,hint,after,reward,sound,fx)
        - handles each piece and threads functions based on arguments
        e = the position of this puzzles count in level.puzzlecounts
        i = The increment to be added to each puzzle_prefix
        delta = what this is that will determine what happens before and after trigger
        puzzle_prefix - the prefix that goes bofore all peieces related to this peice, clips, triggers, place parts...
        hint = what hint you want to give the piece_trig
        after = boolean, whether there will be a part that shows right after or not
        reward = what the reward will be for this puzzle
        sound = what sound to play when peice is trigered
        fx = what fx to play when peice is trigered
    buildmodelhide()
         - disables the trigger and hides the build model if there is one
    buildmodelshow()
         - enables the trigger and shows the build model if there is one
    getplayerfromname()
        - returns the player based on playername
    SetHint(text,icon)
        - Sets the hint for the trigger that threads it
        text = what the hint will say, overidden by name kvp
        icon = boolean, whether or not to have a hand icon
    Before_Trigger(puzzle,delta,puzzle_name)
        - Links clips to pieces, hides place triggers
        puzzle = piece ent
        delta = what this is that will determine what happens before and after trigger
        puzzle_name = puzzle_prefix + i
    Check_Clip_Spin(puzzle_name)
        - Checks for the sub string clip or spin and links the clip to the puzzle and spins
        puzzle_name = puzzle_prefix + i
    After_Trigger(puzzle_after,delta,puzzle_name, puzzle_trig, puzzle,sound,fx, player, reward)
        - Activates things after the trigger is triggerred, sound, fx, deletes clips and pieces and triggers...
        puzzle_after = boolean, whether or not a piece will show right after or not
        delta = what this is that will determine what happens before and after trigger
        puzzle_name = puzzle_prefix + i
        puzzle_trig = puzzle trigger ent
        puzzle = puzzle ent
        sound = sound to play, string
        fx = fx to play, string
        player = which player ent triggered it
        reward = what the reward will be for this puzzle
    CheckFX()
        - Checks for script_fxid and script_fire fx
    TimeFX(fx,timer)
        - plays fx for a time, default 1 second
        fx = fx to play, string
        timer = time in seconds
    Delete_Clip(puzzle_name)
        - Checks for the sub string clip or spin and deletes it
        puzzle_name = puzzle_prefix + i
    Enable_Place_Trig(puzzle_name,player,size,x,y, reward)
        - Creates hud for buildable and starts place trigger functions
        puzzle_name = puzzle_prefix + i
        player = which player ent triggered it
        size = width and height of shader
        x = width to move over after each shader, size + 5 or so
        y = vertical adjustment
        reward = what the reward will be for this puzzle
    WaitForTake()
        - Function used for gun build that deletes pieces when gun taken
    BuyPiece(puzzle_trig)
        - Waits for trigger and checks if trigger cost anything and if the player can afford it
        puzzle_trig = puzzle trigger ent
    RewardMe(e, reward, puzzle)
        - Checks if all pieces are found and the reward you set and threads it
        e = the position of this puzzles count in level.puzzlecounts
        reward = what the reward will be for this puzzle
        puzzle = puzzle piece
    RewardPoints(puzzle)
        - Gives each player points (set at 5000)
    RewardElectric(puzzle)
        - Enables trigger for Electric, then threads TurnOnEverything()
    RewardGun(puzzle)
        - Enables trigger for Gun, then threads GiveMeAGun()
    RewardSecretDoor()
        - Opens all secret doors based on the script_vector of each
    GiveMeAGun(turns,puzzle)
        - Waits for trigger, then threads GiveCoolWeapon()
        turns = how many players there are
    GiveCoolWeapon()
        - Gives them a gun they don't have
    TurnOnEverything()
        - Turns on electric and perk machines
    spin_piece()
        - spins the piece, uses the speed kvp
    turn_piece(turn)
        - turns the piece, uses the speed kvp
        turn = degree to turn piece
    wobble_piece(speed)
        - wobbles the piece at passed variable speed
        speed = how long it takes to do half a wobble
    move_me()
        - moves piece based on script_vector and speed kvps

*/
Last Edit: October 13, 2014, 03:44:32 pm by MakeCents
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 3 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
Signature
×
pashan's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
looks great. Ill add it to my my on the weekend

Thank you
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Mother of commented lines.  :gusta:

 Could you make a separate one without the comments under the first one?
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
No source needs that much documentation. If you need to specify so much then make an external doc.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
looks great. Ill add it to my my on the weekend

Thank you

Cool, let me know how it works out for you.

Mother of commented lines.  :gusta:

 Could you make a separate one without the comments under the first one?

Only because you made me laugh. Here is a less commenty version, hopefully I didn' t delete anything important
Code Snippet
Plaintext
******removed and updated above******
No source needs that much documentation. If you need to specify so much then make an external doc.
is this better? I attached the intro instructions. Personally, I prefer it with it all in one place myself, but to each there own.
Last Edit: May 29, 2014, 05:26:22 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Updated with ee, weapon_base, and power prefabs to try and make it easier to understand how this script works, and how easy it is to customize and make it easier to incorporate simpler ees and buildables.

For the ee prefab, change:
Code Snippet
Plaintext
 thread Each_puzzle(0,"ee","ee_a","",0,"points","",""); //change count for ee points
to
Code Snippet
Plaintext
 thread Each_puzzle(3,"ee","ee_a","",0,"points","",""); //change count for ee points
For the power prefab, change:
Code Snippet
Plaintext
thread Each_puzzle(0,"buildable","build_a","Pick up electric part?",1,"electric","",""); //change count
to
Code Snippet
Plaintext
thread Each_puzzle(2,"buildable","build_a","Pick up electric part?",1,"electric","",""); //change count
For the weapon_base prefab, change:
Code Snippet
Plaintext
 thread Each_puzzle(0,"buildable","build_b","Pick up gun part?",1,"gun","",""); //change count
to
Code Snippet
Plaintext
 thread Each_puzzle(3,"buildable","build_b","Pick up gun part?",1,"gun","",""); //change count
Last Edit: September 20, 2014, 03:38:16 am by MakeCents

 
Loading ...