Modme Forums

How would I make this script loop?

Game Modding | Call of Duty: Black Ops 3 | Scripting


blink-420:

So I'm using these two functions I scripted to make a uh... useable gravity bong. I dont have all that much scripting knowledge as you can probably tell from the functions but I can't figure out how to make it where after its done moving the models it will reset so you can do it over and over again. Any help would be greatly appreciated!

Heres a picture of how it looks in-game
https://prnt.sc/vbiawu


function gravity_bong()
{
torch = GetEnt( "lighter", "targetname" );
torch_trigger = GetEnt("lighter_trigger", "targetname");
torch_trigger SetHintString("Press ^3&&1^7 to pickup torch");
gb_trigger = GetEnt("gb_trigger", "targetname");
gb_trigger hide();


torch_trigger waittill( "trigger", player );
torch delete();
torch_trigger delete();
gb_trigger show();

}

function gravity_bong2()
{
gb = GetEnt("gb", "targetname");
gb_cap = GetEnt("gb_cap", "targetname");
gb_trigger = GetEnt("gb_trigger", "targetname");
gb_trigger SetHintString("Press ^3&&1^7 to hit gravity bong");

gb_trigger waittill("trigger", player );
PlaySoundAtPosition( "gravity_bong", player.origin );
gb moveZ(6,2);
gb_cap movez(6,2);
wait 2;
gb moveZ(-6,2);
gb_cap movez(-6,2);
}


Spiki:

So I'm using these two functions I scripted to make a uh... useable gravity bong. I dont have all that much scripting knowledge as you can probably tell from the functions but I can't figure out how to make it where after its done moving the models it will reset so you can do it over and over again. Any help would be greatly appreciated!

Heres a picture of how it looks in-game
https://prnt.sc/vbiawu


function gravity_bong()
{
torch = GetEnt( "lighter", "targetname" );
torch_trigger = GetEnt("lighter_trigger", "targetname");
torch_trigger SetHintString("Press ^3&&1^7 to pickup torch");
gb_trigger = GetEnt("gb_trigger", "targetname");
gb_trigger hide();


torch_trigger waittill( "trigger", player );
torch delete();
torch_trigger delete();
gb_trigger show();

}

function gravity_bong2()
{
gb = GetEnt("gb", "targetname");
gb_cap = GetEnt("gb_cap", "targetname");
gb_trigger = GetEnt("gb_trigger", "targetname");
gb_trigger SetHintString("Press ^3&&1^7 to hit gravity bong");

gb_trigger waittill("trigger", player );
PlaySoundAtPosition( "gravity_bong", player.origin );
gb moveZ(6,2);
gb_cap movez(6,2);
wait 2;
gb moveZ(-6,2);
gb_cap movez(-6,2);
}

while(1)
    {
    gb_trigger waittill("trigger", player );
    PlaySoundAtPosition( "gravity_bong", player.origin );
    gb moveZ(6,2);
    gb_cap movez(6,2);
    wait 2;
    gb moveZ(-6,2);
    gb_cap movez(-6,2);
    wait 2;
    }


blink-420:

while(1)
    {
    gb_trigger waittill("trigger", player );
    PlaySoundAtPosition( "gravity_bong", player.origin );
    gb moveZ(6,2);
    gb_cap movez(6,2);
    wait 2;
    gb moveZ(-6,2);
    gb_cap movez(-6,2);
    wait 2;
    }

Thanks homie, Spiki always coming in clutch with the help <3