Answered Help adding submenu in submenu

Status
Not open for further replies.

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Hey cabconmodding, I have an issue trying to add a submenu in a submenu, I seen other threads which didn't explain it that well. This is my code, I'm trying to add a submenu called rides, thanks.

Code:
    self add_menu("Spawnables", "Main Menu", "Co-Host");
    self add_option("Spawnables", "Option 1", ::test);
    self add_option("Spawnables", "Option 2", ::test);
    self add_option("Spawnables", "Option 3", ::test);
    self add_option("Spawnables", "Option 4", ::test);
    self add_option("Spawnables", "Option 5", ::test);
    self add_option("Spawnables", "Option 6", ::test);
    self add_option("Spawnables", "Option 7", ::test);
    self add_option("Spawnables", "Option 8", ::test);
    self add_option("Spawnables", "Option 9", ::test);
    self add_option("Spawnables", "Option 10", ::test);
    self add_option("Spawnables", "Option 11", ::test);
    self add_option("Spawnables", "Option 12", ::test);
    self add_option("Spawnables", "Option 13", ::test);
    self add_option("Spawnables", "Option 14", ::test);
    self add_option("Spawnables", "Option 15", ::test);
    self add_option("Spawnables", "Option 16", ::test);
    self add_option("Spawnables", "Option 17", ::test);
    self add_option("Spawnables", "Option 18", ::test);
    self add_option("Main Menu", "Rides", ::submenu, "Spawnables", "Spawnables");
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
Hey cabconmodding, I have an issue trying to add a submenu in a submenu, I seen other threads which didn't explain it that well. This is my code, I'm trying to add a submenu called rides, thanks.

Code:
    self add_menu("Spawnables", "Main Menu", "Co-Host");
    self add_option("Spawnables", "Option 1", ::test);
    self add_option("Spawnables", "Option 2", ::test);
    self add_option("Spawnables", "Option 3", ::test);
    self add_option("Spawnables", "Option 4", ::test);
    self add_option("Spawnables", "Option 5", ::test);
    self add_option("Spawnables", "Option 6", ::test);
    self add_option("Spawnables", "Option 7", ::test);
    self add_option("Spawnables", "Option 8", ::test);
    self add_option("Spawnables", "Option 9", ::test);
    self add_option("Spawnables", "Option 10", ::test);
    self add_option("Spawnables", "Option 11", ::test);
    self add_option("Spawnables", "Option 12", ::test);
    self add_option("Spawnables", "Option 13", ::test);
    self add_option("Spawnables", "Option 14", ::test);
    self add_option("Spawnables", "Option 15", ::test);
    self add_option("Spawnables", "Option 16", ::test);
    self add_option("Spawnables", "Option 17", ::test);
    self add_option("Spawnables", "Option 18", ::test);
    self add_option("Main Menu", "Rides", ::submenu, "Spawnables", "Spawnables");
change where it says
"Main Menu"
to
"Spawnables"
and after ::submenu, the 2 things are the title for the next submenu so change those to
as well, like this:
Code:
self add_option("Spawnables", "Rides", ::submenu, "Rides", "Rides");
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
change where it says to and after ::submenu, the 2 things are the title for the next submenu so change those to as well, like this:
Code:
self add_option("Spawnables", "Rides", ::submenu, "Rides", "Rides");
Thanks for your reply and how would I add like:

self add_option("Rides", "Option 1", ::testfunc);

(Would I lay it out like that underneath?^)
Inside the "Rides" submenu? Thanks.
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
Thanks for your reply and how would I add like:

self add_option("Rides", "Option 1", ::testfunc);

(Would I lay it out like that underneath?^)
Inside the "Rides" submenu? Thanks.
yes then you just make it like any other sub menu :smile:
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
yes then you just make it like any other sub menu :grinning:
I think I done something wrong I keep freezing:

Code:
    self add_menu("Spawnables", "Main Menu", "Co-Host");
    self add_option("Spawnables", "Option 1", ::test);
    self add_option("Spawnables", "Option 2", ::test);
    self add_option("Spawnables", "Option 3", ::test);
    self add_option("Spawnables", "Option 4", ::test);
    self add_option("Spawnables", "Option 5", ::test);
    self add_option("Spawnables", "Option 6", ::test);
    self add_option("Spawnables", "Option 7", ::test);
    self add_option("Spawnables", "Option 8", ::test);
    self add_option("Spawnables", "Option 9", ::test);
    self add_option("Spawnables", "Option 10", ::test);
    self add_option("Spawnables", "Option 11", ::test);
    self add_option("Spawnables", "Option 12", ::test);
    self add_option("Spawnables", "Option 13", ::test);
    self add_option("Spawnables", "Option 14", ::test);
    self add_option("Spawnables", "Option 15", ::test);
    self add_option("Spawnables", "Option 16", ::test);
    self add_option("Spawnables", "Option 17", ::test);
    self add_option("Spawnables", "Option 18", ::test);
    self add_option("Spawnables", "Rides", ::submenu, "Rides", "Rides");
        self add_menu("Rides", "Main Menu", "Co-Host");
    self add_option("Rides", "Option 1", ::test);
    self add_option("Rides", "Option 2", ::test);
    self add_option("Rides", "Option 3", ::test);
    self add_option("Rides", "Option 4", ::test);
    self add_option("Rides", "Option 5", ::test);

Any idea? Thanks.
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
I think I done something wrong I keep freezing:

Code:
    self add_menu("Spawnables", "Main Menu", "Co-Host");
    self add_option("Spawnables", "Option 1", ::test);
    self add_option("Spawnables", "Option 2", ::test);
    self add_option("Spawnables", "Option 3", ::test);
    self add_option("Spawnables", "Option 4", ::test);
    self add_option("Spawnables", "Option 5", ::test);
    self add_option("Spawnables", "Option 6", ::test);
    self add_option("Spawnables", "Option 7", ::test);
    self add_option("Spawnables", "Option 8", ::test);
    self add_option("Spawnables", "Option 9", ::test);
    self add_option("Spawnables", "Option 10", ::test);
    self add_option("Spawnables", "Option 11", ::test);
    self add_option("Spawnables", "Option 12", ::test);
    self add_option("Spawnables", "Option 13", ::test);
    self add_option("Spawnables", "Option 14", ::test);
    self add_option("Spawnables", "Option 15", ::test);
    self add_option("Spawnables", "Option 16", ::test);
    self add_option("Spawnables", "Option 17", ::test);
    self add_option("Spawnables", "Option 18", ::test);
    self add_option("Spawnables", "Rides", ::submenu, "Rides", "Rides");
        self add_menu("Rides", "Main Menu", "Co-Host");
    self add_option("Rides", "Option 1", ::test);
    self add_option("Rides", "Option 2", ::test);
    self add_option("Rides", "Option 3", ::test);
    self add_option("Rides", "Option 4", ::test);
    self add_option("Rides", "Option 5", ::test);

Any idea? Thanks.
you already created the sub menu with the line we made earlier so you don't need
self add_menu("Rides", "Main Menu", "Co-Host");
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
sorry, i was wrong. you do need that initial line at the top
Code:
self add_menu("Rides", self.menuname, "Co-Host");
Code:
self add_option("Spawnables", "Rides", ::submenu, "Rides", "Rides");
    self add_menu("Rides", self.menuname, "Co-Host");
    self add_option("Rides", "Option 1", ::test);
Like that?
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
self add_option("Spawnables", "Rides", ::submenu, "Rides", "Rides");

self add_menu("Rides", self.menuname, "Co-Host");
self add_option("Rides", "Option 1", ::test);
sure just space it out, it will be easier to manage
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
sure just space it out, it will be easier to manage
Nice! It works thanks, just one more thing (sorry) how would I call this (I'm not good at calling big things like this :disappointed:)

Code:
Spawn_Ferriswheel()
{
    level endon("Destroy_Ferris");
    level.ferrisOrg = self.origin;
    level.speed = 0;
 
    level.FerrisLegs = [];
    level.FerrisSeats = [];
    level.Ferris = [];
 
    level.FerrisAttach = modelSpawner(level.ferrisOrg + (0,0,420), "tag_origin");
    level.FerrisLink = modelSpawner(level.ferrisOrg + (0,0,60), "tag_origin");
    for(a=0;a<2;a++) for(e=0;e<30;e++)
        level.Ferris[level.Ferris.size] = modelSpawner(level.ferrisOrg + (-50+a*100,0,420) + (0,sin(e*12)*330, cos(e*12)*330), "t6_wpn_supply_drop_ally", (0,0,e*-12),.1);
    for(a=0;a<2;a++) for(b=0;b<5;b++) for(e=0;e<15;e++)
        level.Ferris[level.Ferris.size] = modelSpawner(level.ferrisOrg + (-50+a*100,0,420) + (0,sin(e*24)*40+b*65, cos(e*24)*40+b*65), "t6_wpn_supply_drop_ally", (0,0,(e*-24)-90),.1);
    for(e=0;e<15;e++)
        level.FerrisSeats[level.FerrisSeats.size] = modelSpawner(level.ferrisOrg + (0,0,420) + (0,sin(e*24)*330, cos(e*24)*330), "t6_wpn_supply_drop_axis",(e*24,90,0),.1);
    for(e=0;e<3;e++)
        level.FerrisLegs[level.FerrisLegs.size] = modelSpawner(level.ferrisOrg + (82-e*82,0,420),"t6_wpn_supply_drop_ally",(0,90,0),.1);
    for(e=0;e<2;e++) for(a=0;a<8;a++)
        level.FerrisLegs[level.FerrisLegs.size] = modelSpawner(level.ferrisOrg + (-100+e*200,-220,0) + (0,a*28,a*60),"t6_wpn_supply_drop_ally",(0,0,65),.1);
    for(e=0;e<2;e++) for(a=0;a<8;a++)
        level.FerrisLegs[level.FerrisLegs.size] = modelSpawner(level.ferrisOrg + (-100+e*200,220,0) + (0,a*-28,a*60),"t6_wpn_supply_drop_ally",(0,0,-65),.1);
 
    foreach(model in level.Ferris)
        model linkTo(level.FerrisAttach);
    foreach(model in level.FerrisSeats)
        model linkTo(level.FerrisAttach);
  
    level.FerrisAttach thread ferrisRotate(1);
    level.FerrisLink checkRidersFerris(level.FerrisSeats);
}

ferrisRotate(speed)
{
    self thread doFerrisRotate(speed);
}

resetFerrisSpeed()
{
    level.speed = 0;
    self thread doFerrisRotate(1);
}

doFerrisRotate(speed)
{
    level endon("Destroy_Ferris");
    level.speed += speed;
    if(level.speed >= 15)
        level.speed = 15;
    if(level.speed <= -15)
        level.speed = -15;
    iprintln(level.speed);
    while(true)
    {
        for(a=0;a<360;a+=level.speed)
        {
            self rotateTo((0,self.angles[1],a),.2);
            wait .05;
        }
        for(a=360;a<0;a-=level.speed)
        {
            self rotateTo((0,self.angles[1],a),.2);
            wait .05;
        }
        wait .05;
    }
}

checkRidersFerris(Array)
{
    level endon("Destroy_Ferris");
    level.ferrisTrig = spawnTrig(self.origin,250,40,"HINT_NOICON","Press &&1 To Enter / Exit The Ferris Wheel!");
    while(isDefined(self))
    {
        level.ferrisTrig waittill("trigger",i);
        if(!isDefined(i.riding) && isPlayer(i) && i useButtonPressed())
        {
            Closest = getClosest(i.origin,Array);
            Seat = modelSpawner(Closest.origin-anglesToRight(self.angles)*22,"script_origin",(0,90,0));
            Seat thread seatAngleFix(Closest);
            if(!isDefined(Closest.FerrisOccupied))
            {
                i setStance("crouch");
                i.ridingFerris = true;
                i PlayerLinkToDelta(Seat);
                i thread playerExitFerry(Closest,Seat);
                Closest.FerrisOccupied = true;
            }
        }
    }
}

seatAngleFix(seat)
{
    while(true)
    {
        for(a=0;a<360;a+=level.speed)
        {
            self.angles = (0,90,0);
            self MoveTo(seat.origin+(0,0,10),.1);
            wait .05;
        }
        wait .05;
    }
}

playerExitFerry(Seat,tag)
{
    while(isDefined(level.Ferris_Wheel))
    {
        if(self fragButtonPressed()) break;
        wait .05;
    }
    tag unLink();
    tag delete();
    self.ridingFerris = undefined;
    Seat.FerrisOccupied = undefined;
    self unlink();
}
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Nice! It works thanks, just one more thing (sorry) how would I call this (I'm not good at calling big things like this :disappointed:)

Code:
Spawn_Ferriswheel()
{
    level endon("Destroy_Ferris");
    level.ferrisOrg = self.origin;
    level.speed = 0;
 
    level.FerrisLegs = [];
    level.FerrisSeats = [];
    level.Ferris = [];
 
    level.FerrisAttach = modelSpawner(level.ferrisOrg + (0,0,420), "tag_origin");
    level.FerrisLink = modelSpawner(level.ferrisOrg + (0,0,60), "tag_origin");
    for(a=0;a<2;a++) for(e=0;e<30;e++)
        level.Ferris[level.Ferris.size] = modelSpawner(level.ferrisOrg + (-50+a*100,0,420) + (0,sin(e*12)*330, cos(e*12)*330), "t6_wpn_supply_drop_ally", (0,0,e*-12),.1);
    for(a=0;a<2;a++) for(b=0;b<5;b++) for(e=0;e<15;e++)
        level.Ferris[level.Ferris.size] = modelSpawner(level.ferrisOrg + (-50+a*100,0,420) + (0,sin(e*24)*40+b*65, cos(e*24)*40+b*65), "t6_wpn_supply_drop_ally", (0,0,(e*-24)-90),.1);
    for(e=0;e<15;e++)
        level.FerrisSeats[level.FerrisSeats.size] = modelSpawner(level.ferrisOrg + (0,0,420) + (0,sin(e*24)*330, cos(e*24)*330), "t6_wpn_supply_drop_axis",(e*24,90,0),.1);
    for(e=0;e<3;e++)
        level.FerrisLegs[level.FerrisLegs.size] = modelSpawner(level.ferrisOrg + (82-e*82,0,420),"t6_wpn_supply_drop_ally",(0,90,0),.1);
    for(e=0;e<2;e++) for(a=0;a<8;a++)
        level.FerrisLegs[level.FerrisLegs.size] = modelSpawner(level.ferrisOrg + (-100+e*200,-220,0) + (0,a*28,a*60),"t6_wpn_supply_drop_ally",(0,0,65),.1);
    for(e=0;e<2;e++) for(a=0;a<8;a++)
        level.FerrisLegs[level.FerrisLegs.size] = modelSpawner(level.ferrisOrg + (-100+e*200,220,0) + (0,a*-28,a*60),"t6_wpn_supply_drop_ally",(0,0,-65),.1);
 
    foreach(model in level.Ferris)
        model linkTo(level.FerrisAttach);
    foreach(model in level.FerrisSeats)
        model linkTo(level.FerrisAttach);
 
    level.FerrisAttach thread ferrisRotate(1);
    level.FerrisLink checkRidersFerris(level.FerrisSeats);
}

ferrisRotate(speed)
{
    self thread doFerrisRotate(speed);
}

resetFerrisSpeed()
{
    level.speed = 0;
    self thread doFerrisRotate(1);
}

doFerrisRotate(speed)
{
    level endon("Destroy_Ferris");
    level.speed += speed;
    if(level.speed >= 15)
        level.speed = 15;
    if(level.speed <= -15)
        level.speed = -15;
    iprintln(level.speed);
    while(true)
    {
        for(a=0;a<360;a+=level.speed)
        {
            self rotateTo((0,self.angles[1],a),.2);
            wait .05;
        }
        for(a=360;a<0;a-=level.speed)
        {
            self rotateTo((0,self.angles[1],a),.2);
            wait .05;
        }
        wait .05;
    }
}

checkRidersFerris(Array)
{
    level endon("Destroy_Ferris");
    level.ferrisTrig = spawnTrig(self.origin,250,40,"HINT_NOICON","Press &&1 To Enter / Exit The Ferris Wheel!");
    while(isDefined(self))
    {
        level.ferrisTrig waittill("trigger",i);
        if(!isDefined(i.riding) && isPlayer(i) && i useButtonPressed())
        {
            Closest = getClosest(i.origin,Array);
            Seat = modelSpawner(Closest.origin-anglesToRight(self.angles)*22,"script_origin",(0,90,0));
            Seat thread seatAngleFix(Closest);
            if(!isDefined(Closest.FerrisOccupied))
            {
                i setStance("crouch");
                i.ridingFerris = true;
                i PlayerLinkToDelta(Seat);
                i thread playerExitFerry(Closest,Seat);
                Closest.FerrisOccupied = true;
            }
        }
    }
}

seatAngleFix(seat)
{
    while(true)
    {
        for(a=0;a<360;a+=level.speed)
        {
            self.angles = (0,90,0);
            self MoveTo(seat.origin+(0,0,10),.1);
            wait .05;
        }
        wait .05;
    }
}

playerExitFerry(Seat,tag)
{
    while(isDefined(level.Ferris_Wheel))
    {
        if(self fragButtonPressed()) break;
        wait .05;
    }
    tag unLink();
    tag delete();
    self.ridingFerris = undefined;
    Seat.FerrisOccupied = undefined;
    self unlink();
}

Nevermind I done it had to add modelspawner stuff at the bottom, thanks for all your help man! :smile:
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
sure just space it out, it will be easier to manage
Hey, sorry that I'm blasting you with questions, how would I make the MerryGoRound a submenu, I tried doing the same as before but no submenu was created and I got connection interrupted and I froze :/

Code:
self add_menu("Rides", self.menuname, "Co-Host");
    self add_option("Rides", "Ferris Wheel", ::Spawn_Ferriswheel);
    self add_option("Rides", "Centrox", ::Spawn_Centrox);
    self add_option("Rides", "The Claw", ::Build_TheClaw);
    self add_option("Rides", "MerryGoRound", ::submenu, "MerryGoRound", "MerryGoRound");
    
    self add_menu("MerryGoRound", self.menuname, "Co-Host");
    self add_option("Rides", "Spawn MerryGoRound", ::build);
    self add_option("Rides", "Delete MerryGoRound", ::Explode);
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
Hey, sorry that I'm blasting you with questions, how would I make the MerryGoRound a submenu, I tried doing the same as before but no submenu was created and I got connection interrupted and I froze :/

Code:
self add_menu("Rides", self.menuname, "Co-Host");
    self add_option("Rides", "Ferris Wheel", ::Spawn_Ferriswheel);
    self add_option("Rides", "Centrox", ::Spawn_Centrox);
    self add_option("Rides", "The Claw", ::Build_TheClaw);
    self add_option("Rides", "MerryGoRound", ::submenu, "MerryGoRound", "MerryGoRound");
 
    self add_menu("MerryGoRound", self.menuname, "Co-Host");
    self add_option("MerryGoRound", "Spawn MerryGoRound", ::build);
    self add_option("MerryGoRound", "Delete MerryGoRound", ::Explode);
like this:
Code:
self add_menu("Rides", self.menuname, "Co-Host");
    self add_option("Rides", "Ferris Wheel", ::Spawn_Ferriswheel);
    self add_option("Rides", "Centrox", ::Spawn_Centrox);
    self add_option("Rides", "The Claw", ::Build_TheClaw);
    self add_option("Rides", "MerryGoRound", ::submenu, "MerryGoRound", "MerryGoRound");
 
    self add_menu("MerryGoRound", self.menuname, "Co-Host");
    self add_option("MerryGoRound", "Spawn MerryGoRound", ::build);
    self add_option("MerryGoRound", "Delete MerryGoRound", ::Explode);

also make sure build and explode are a real function or the game will freeze while loading a map
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
Hey, sorry that I'm blasting you with questions, how would I make the MerryGoRound a submenu, I tried doing the same as before but no submenu was created and I got connection interrupted and I froze :/

Code:
self add_menu("Rides", self.menuname, "Co-Host");
    self add_option("Rides", "Ferris Wheel", ::Spawn_Ferriswheel);
    self add_option("Rides", "Centrox", ::Spawn_Centrox);
    self add_option("Rides", "The Claw", ::Build_TheClaw);
    self add_option("Rides", "MerryGoRound", ::submenu, "MerryGoRound", "MerryGoRound");
   
    self add_menu("MerryGoRound", self.menuname, "Co-Host");
    self add_option("Rides", "Spawn MerryGoRound", ::build);
    self add_option("Rides", "Delete MerryGoRound", ::Explode);
you will also freeze if you call a function with an infinite loop btw
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
like this:
Code:
self add_menu("Rides", self.menuname, "Co-Host");
    self add_option("Rides", "Ferris Wheel", ::Spawn_Ferriswheel);
    self add_option("Rides", "Centrox", ::Spawn_Centrox);
    self add_option("Rides", "The Claw", ::Build_TheClaw);
    self add_option("Rides", "MerryGoRound", ::submenu, "MerryGoRound", "MerryGoRound");
 
    self add_menu("MerryGoRound", self.menuname, "Co-Host");
    self add_option("MerryGoRound", "Spawn MerryGoRound", ::build);
    self add_option("MerryGoRound", "Delete MerryGoRound", ::Explode);

also make sure build and explode are a real function or the game will freeze while loading a map

Yeah, Explode is a part of the script, I don't know how to delete stuff after I add them, I'm not good with spawnables.

Code:
build(){
    self endon("death");
    self endon("game_ended");
    for(;;){
        if(level.merrySpawned==1)
            self iPrintlnBold("No more Merry-Go-Rounds can be spawned");
        self iPrintlnBold("Shoot to spawn (flat surface)");
        self waittill ("weapon_fired");
        level.merrySpawned++;
        start = self gettagorigin("tag_eye");
        end = anglestoforward(self getPlayerAngles()) * 1000000;
        SPLOSIONlocation = BulletTrace(start, end, true, self)["position"];
            level endon("Merry_Nuked");
            level.Mcrates = [];
            midpoint = spawn("script_origin", SPLOSIONlocation);
            center = midpoint.origin;
            level.center = midpoint.origin;
            h = 0;
                LOLCATS = 0;
                for(j=0;j<2;j++){
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center+(i,0,LOLCATS));
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++;}
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center-(i,0,0-LOLCATS));
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++;}
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center-(0,i,0-LOLCATS));
                           level.Mcrates[h].angles = (0,90,0);
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++;}
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center+(0,i,LOLCATS));
                           level.Mcrates[h].angles = (0,90,0);
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++; }
                   foreach(Mcrates in level.Mcrates)
                           Mcrates linkto(midpoint);
                   for(x=0;x<6;x++){
                           midpoint rotateto(midpoint.angles+(0,11.25,0),0.05);
                           wait 0.1;
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center-(0,i,0-LOLCATS));
                                   level.Mcrates[h].angles = (0,90,0);
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center+(0,i,LOLCATS));
                                   level.Mcrates[h].angles = (0,90,0);
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center-(i,0,0-LOLCATS));
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center+(i,0,LOLCATS));
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           foreach(Mcrates in level.Mcrates){
                                   Mcrates linkto(midpoint);}}
                LOLCATS=180;
                wait 0.2;}
        for(x=30;x<180;x+=30){
                for(i=0;i<6;i++){
                        level.Mcrates[h] = spawn("script_model", center+(0,0,x));
                        level.Mcrates[h].angles = (0,i*22.5,0);
                        level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                        h++;}
                wait 0.02;}
        level.MerrySeat = [];
        level.MerrySeat[0] = spawn("script_model", center+(-22,100,30));
        level.MerrySeat[0] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[0].angles = (90,0,0);
        level.MerrySeat[1] = spawn("script_model", center+(-22,-100,30));
        level.MerrySeat[1] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[1].angles = (90,0,0);
        level.MerrySeat[2] = spawn("script_model", center+(-100,-22,30));
        level.MerrySeat[2] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[2].angles = (90,90,0);
        level.MerrySeat[3] = spawn("script_model", center+(100,-22,30));
        level.MerrySeat[3] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[3].angles = (90,90,0);
        level.MerrySeat[4] = spawn("script_model", center+(-122,100,30));
        level.MerrySeat[4] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[4].angles = (90,45,0);
        level.MerrySeat[5] = spawn("script_model", center+(122,-100,30));
        level.MerrySeat[5] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[5].angles = (90,-135,0);
        level.MerrySeat[6] = spawn("script_model", center+(-100,-122,30));
        level.MerrySeat[6] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[6].angles = (90,135,0);
        level.MerrySeat[7] = spawn("script_model", center+(100,122,30));
        level.MerrySeat[7] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[7].angles = (90,-45,0);
        level.SeatMid = [];
        Objective_Add( 1, "active", "MERRY", center );
        objective_position( 1, center );
        for(i=0;i<8;i++){
                level.SeatMid[i] = spawn("script_origin", SPLOSIONlocation);
                wait 0.01;}
        level.FakeSeat = [];
        for(i=0;i<8;i++){
                level.FakeSeat[i] = spawn("script_origin", level.MerrySeat[i].origin-(0,0,37));
                level.FakeSeat[i].num = i;
                level.FakeSeat[i].InUse = false;
                wait 0.01;}
        i = 0;
        foreach(FakeSeat in level.FakeSeat){
                FakeSeat linkto(level.MerrySeat[i]);
                FakeSeat thread ManageDistance();
                i++;
                wait 0.01;}
        i = 0;
        foreach(MerrySeat in level.MerrySeat){
                MerrySeat linkto(level.SeatMid[i]);
                level.SeatMid[i] thread MoveAbout();
                i++;
                wait 0.01;}
        wait 0.01;
        for(;;){
                midpoint rotateyaw(-720, 8);
                foreach(SeatMid in level.SeatMid){
                        SeatMid rotateyaw(-720, 8);
                       wait 0.01;}
                wait 7;}}}
MerryNuke(){
        level endon("nuked");
        level.Detonator = spawn("script_model", level.center+(60,-355,0));
        level.Detonator setmodel("prop_suitcase_bomb");
        level.Detonator.angles = (0,90,0);
        level.Bomb = spawn("script_model", level.center+(60,-340,6));
        level.Bomb setmodel("projectile_hellfire_missile");
        Detonator = level.Detonator;
        Collision = [];
        Collision[0] = spawn("script_model", level.center+(0,-320,14));
        Collision[1] = spawn("script_model", level.center+(0,-320,42));
        Collision[2] = spawn("script_model", level.center+(0,-280,42));
        Collision[3] = spawn("script_model", level.center+(0,-280,14));
        Collision[4] = spawn("script_model", level.center+(55,-320,14));
        Collision[5] = spawn("script_model", level.center+(55,-320,42));
        Collision[6] = spawn("script_model", level.center+(55,-280,42));
        Collision[7] = spawn("script_model", level.center+(55,-280,14));
        Collision[8] = spawn("script_model", level.center+(110,-320,14));
        Collision[9] = spawn("script_model", level.center+(110,-320,42));
        Collision[10] = spawn("script_model", level.center+(110,-280,42));
        Collision[11] = spawn("script_model", level.center+(110,-280,14));
        Collision[12] = spawn("script_model", level.center+(145,-320,14));
        Collision[13] = spawn("script_model", level.center+(145,-320,42));
        Collision[14] = spawn("script_model", level.center+(145,-280,42));
        Collision[15] = spawn("script_model", level.center+(145,-280,14));
        Collision[16] = spawn("script_model", level.center+(60,-330,0));
        Collision[17] = spawn("script_model", level.center+(60,-330,0));
        Collision[17].angles = (0,90,0);
        level.MerryNuke = false;
        for(;;){
                foreach(player in level.players){
                        if(distance(Detonator.origin, player gettagorigin("j_head")) <30 && level.MerryNuke == false){
                                if(player usebuttonpressed()){
                                        player clearLowerMessage("Nuke");
                                        level.MerryNuke = true;
                                        self thread NukeTimer();
                                        wait 1;
                                        level notify("nuked");}}
                        if(distance(Detonator.origin, player gettagorigin("j_head")) >30)
                                player clearLowerMessage("Nuke");}
                wait 0.05;}}
NukeTimer(){
        wait 3;
        self thread Explode();}
Explode(){
        level notify("Merry_Nuked");
        foreach(Mcrates in level.Mcrates){
                Mcrates unlink();
                Mcrates delete();}
        foreach(ControlPanel in level.ControlPanels)
                ControlPanel delete();
        foreach(MerrySeat in level.MerrySeat)
                MerrySeat delete();
        level.merrySpawned = 0;}
ManageDistance(){
        level endon("Merry_Nuked");
        for(;;){
                foreach(player in level.players){
                        if(distance(self.origin, player.origin) <100 && self.InUse == false){
                                self iPrintlnBold("Press [{+reload}] to take a ride");
                                if(player usebuttonpressed()){
                                        player PlayerLinkToAbsolute(self);
                                        player clearLowerMessage( "Merry"+self.num );
                                        self.InUse = true;
                                        wait 1;}}
                        else if(distance(self.origin, player.origin) <100 && self.InUse == true && player usebuttonpressed()){
                                player unlink();
                                self.InUse = false;
                                player setorigin(level.center+(0,0,200));
                                wait 1;}
                        if(distance(self.origin, player.origin) >100)
                                player clearLowerMessage("Merry "+self.num);}
                wait 0.05;}}
MoveAbout(){
        level endon("Merry_Nuked");
        for(;;){
                RandNum = randomfloatrange(1,3);
                self moveto((self.origin[0],self.origin[1],self.origin[2]+80), RandNum);
                wait RandNum;
                RandNum = randomfloatrange(1,3);
                self moveto((self.origin[0],self.origin[1],self.origin[2]-80), RandNum);
                wait RandNum;}}
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
339
Points
953
Yeah, Explode is a part of the script, I don't know how to delete stuff after I add them, I'm not good with spawnables.

Code:
build(){
    self endon("death");
    self endon("game_ended");
    for(;;){
        if(level.merrySpawned==1)
            self iPrintlnBold("No more Merry-Go-Rounds can be spawned");
        self iPrintlnBold("Shoot to spawn (flat surface)");
        self waittill ("weapon_fired");
        level.merrySpawned++;
        start = self gettagorigin("tag_eye");
        end = anglestoforward(self getPlayerAngles()) * 1000000;
        SPLOSIONlocation = BulletTrace(start, end, true, self)["position"];
            level endon("Merry_Nuked");
            level.Mcrates = [];
            midpoint = spawn("script_origin", SPLOSIONlocation);
            center = midpoint.origin;
            level.center = midpoint.origin;
            h = 0;
                LOLCATS = 0;
                for(j=0;j<2;j++){
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center+(i,0,LOLCATS));
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++;}
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center-(i,0,0-LOLCATS));
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++;}
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center-(0,i,0-LOLCATS));
                           level.Mcrates[h].angles = (0,90,0);
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++;}
                   for(i=60;i<240;i+=60){
                           level.Mcrates[h] = spawn("script_model", center+(0,i,LOLCATS));
                           level.Mcrates[h].angles = (0,90,0);
                           level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                           h++; }
                   foreach(Mcrates in level.Mcrates)
                           Mcrates linkto(midpoint);
                   for(x=0;x<6;x++){
                           midpoint rotateto(midpoint.angles+(0,11.25,0),0.05);
                           wait 0.1;
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center-(0,i,0-LOLCATS));
                                   level.Mcrates[h].angles = (0,90,0);
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center+(0,i,LOLCATS));
                                   level.Mcrates[h].angles = (0,90,0);
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center-(i,0,0-LOLCATS));
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           for(i=60;i<240;i+=60){
                                   level.Mcrates[h] = spawn("script_model", center+(i,0,LOLCATS));
                                   level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                                   h++;}
                           foreach(Mcrates in level.Mcrates){
                                   Mcrates linkto(midpoint);}}
                LOLCATS=180;
                wait 0.2;}
        for(x=30;x<180;x+=30){
                for(i=0;i<6;i++){
                        level.Mcrates[h] = spawn("script_model", center+(0,0,x));
                        level.Mcrates[h].angles = (0,i*22.5,0);
                        level.Mcrates[h] setModel("t6_wpn_supply_drop_ally");
                        h++;}
                wait 0.02;}
        level.MerrySeat = [];
        level.MerrySeat[0] = spawn("script_model", center+(-22,100,30));
        level.MerrySeat[0] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[0].angles = (90,0,0);
        level.MerrySeat[1] = spawn("script_model", center+(-22,-100,30));
        level.MerrySeat[1] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[1].angles = (90,0,0);
        level.MerrySeat[2] = spawn("script_model", center+(-100,-22,30));
        level.MerrySeat[2] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[2].angles = (90,90,0);
        level.MerrySeat[3] = spawn("script_model", center+(100,-22,30));
        level.MerrySeat[3] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[3].angles = (90,90,0);
        level.MerrySeat[4] = spawn("script_model", center+(-122,100,30));
        level.MerrySeat[4] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[4].angles = (90,45,0);
        level.MerrySeat[5] = spawn("script_model", center+(122,-100,30));
        level.MerrySeat[5] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[5].angles = (90,-135,0);
        level.MerrySeat[6] = spawn("script_model", center+(-100,-122,30));
        level.MerrySeat[6] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[6].angles = (90,135,0);
        level.MerrySeat[7] = spawn("script_model", center+(100,122,30));
        level.MerrySeat[7] setmodel("t6_wpn_supply_drop_trap");
        level.MerrySeat[7].angles = (90,-45,0);
        level.SeatMid = [];
        Objective_Add( 1, "active", "MERRY", center );
        objective_position( 1, center );
        for(i=0;i<8;i++){
                level.SeatMid[i] = spawn("script_origin", SPLOSIONlocation);
                wait 0.01;}
        level.FakeSeat = [];
        for(i=0;i<8;i++){
                level.FakeSeat[i] = spawn("script_origin", level.MerrySeat[i].origin-(0,0,37));
                level.FakeSeat[i].num = i;
                level.FakeSeat[i].InUse = false;
                wait 0.01;}
        i = 0;
        foreach(FakeSeat in level.FakeSeat){
                FakeSeat linkto(level.MerrySeat[i]);
                FakeSeat thread ManageDistance();
                i++;
                wait 0.01;}
        i = 0;
        foreach(MerrySeat in level.MerrySeat){
                MerrySeat linkto(level.SeatMid[i]);
                level.SeatMid[i] thread MoveAbout();
                i++;
                wait 0.01;}
        wait 0.01;
        for(;;){
                midpoint rotateyaw(-720, 8);
                foreach(SeatMid in level.SeatMid){
                        SeatMid rotateyaw(-720, 8);
                       wait 0.01;}
                wait 7;}}}
MerryNuke(){
        level endon("nuked");
        level.Detonator = spawn("script_model", level.center+(60,-355,0));
        level.Detonator setmodel("prop_suitcase_bomb");
        level.Detonator.angles = (0,90,0);
        level.Bomb = spawn("script_model", level.center+(60,-340,6));
        level.Bomb setmodel("projectile_hellfire_missile");
        Detonator = level.Detonator;
        Collision = [];
        Collision[0] = spawn("script_model", level.center+(0,-320,14));
        Collision[1] = spawn("script_model", level.center+(0,-320,42));
        Collision[2] = spawn("script_model", level.center+(0,-280,42));
        Collision[3] = spawn("script_model", level.center+(0,-280,14));
        Collision[4] = spawn("script_model", level.center+(55,-320,14));
        Collision[5] = spawn("script_model", level.center+(55,-320,42));
        Collision[6] = spawn("script_model", level.center+(55,-280,42));
        Collision[7] = spawn("script_model", level.center+(55,-280,14));
        Collision[8] = spawn("script_model", level.center+(110,-320,14));
        Collision[9] = spawn("script_model", level.center+(110,-320,42));
        Collision[10] = spawn("script_model", level.center+(110,-280,42));
        Collision[11] = spawn("script_model", level.center+(110,-280,14));
        Collision[12] = spawn("script_model", level.center+(145,-320,14));
        Collision[13] = spawn("script_model", level.center+(145,-320,42));
        Collision[14] = spawn("script_model", level.center+(145,-280,42));
        Collision[15] = spawn("script_model", level.center+(145,-280,14));
        Collision[16] = spawn("script_model", level.center+(60,-330,0));
        Collision[17] = spawn("script_model", level.center+(60,-330,0));
        Collision[17].angles = (0,90,0);
        level.MerryNuke = false;
        for(;;){
                foreach(player in level.players){
                        if(distance(Detonator.origin, player gettagorigin("j_head")) <30 && level.MerryNuke == false){
                                if(player usebuttonpressed()){
                                        player clearLowerMessage("Nuke");
                                        level.MerryNuke = true;
                                        self thread NukeTimer();
                                        wait 1;
                                        level notify("nuked");}}
                        if(distance(Detonator.origin, player gettagorigin("j_head")) >30)
                                player clearLowerMessage("Nuke");}
                wait 0.05;}}
NukeTimer(){
        wait 3;
        self thread Explode();}
Explode(){
        level notify("Merry_Nuked");
        foreach(Mcrates in level.Mcrates){
                Mcrates unlink();
                Mcrates delete();}
        foreach(ControlPanel in level.ControlPanels)
                ControlPanel delete();
        foreach(MerrySeat in level.MerrySeat)
                MerrySeat delete();
        level.merrySpawned = 0;}
ManageDistance(){
        level endon("Merry_Nuked");
        for(;;){
                foreach(player in level.players){
                        if(distance(self.origin, player.origin) <100 && self.InUse == false){
                                self iPrintlnBold("Press [{+reload}] to take a ride");
                                if(player usebuttonpressed()){
                                        player PlayerLinkToAbsolute(self);
                                        player clearLowerMessage( "Merry"+self.num );
                                        self.InUse = true;
                                        wait 1;}}
                        else if(distance(self.origin, player.origin) <100 && self.InUse == true && player usebuttonpressed()){
                                player unlink();
                                self.InUse = false;
                                player setorigin(level.center+(0,0,200));
                                wait 1;}
                        if(distance(self.origin, player.origin) >100)
                                player clearLowerMessage("Merry "+self.num);}
                wait 0.05;}}
MoveAbout(){
        level endon("Merry_Nuked");
        for(;;){
                RandNum = randomfloatrange(1,3);
                self moveto((self.origin[0],self.origin[1],self.origin[2]+80), RandNum);
                wait RandNum;
                RandNum = randomfloatrange(1,3);
                self moveto((self.origin[0],self.origin[1],self.origin[2]-80), RandNum);
                wait RandNum;}}
call "MerryNuke" instead of "Explode" to destroy it
 
Status
Not open for further replies.
Top