Modme Forums
Menu:

[Help] A “door” that opens when touching

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


ModmeBot:

Thread By: soul-toktzt

Can anyone help me out with this?

I'm making platforms on the ground with only a certain route / path that's solid and i'd like to have that once you jump on a non-solid one, it'll disappear.

(i'm probably wrong with this but can i just use trigger use_touch with this?)

Thanks in advance :) .


ModmeBot:

Reply By: mathfag

You need a trigger_multiple

You can use brushes instead of models

function dissapearing_platform()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    trig_2 = GetEnt("platform_trig_2", "targetname");
    trig_3 = GetEnt("platform_trig_3", "targetname"); //as many as you have platforms

    model_1 = GetEnt("platform_model_1", "targetname");
    model_2 = GetEnt("platform_model_2", "targetname");
    model_3 = GetEnt("platform_model_3", "targetname"); //you see where this is going...

    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
    trig_2 SetHintString("");
    trig_2 SetCursorHint("HINT_NOICON");
    trig_3 SetHintString("");
    trig_3 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_1 waittill("trigger", player);
        trig_1 Delete();
        model_1 Delete();
        
        break;
    }
 
    while(1)
    {
        trig_2 waittill("trigger", player);
        trig_2 Delete();
        model_2 Delete();
        
        break;
    }


    while(1)
    {
        trig_3 waittill("trigger", player);
        trig_3 Delete();
        model_3 Delete();
        
        break;
    }
}



I never tested this but here it is just to give you an idea about how it should be


ModmeBot:

Reply By: soul-toktzt

mathfag

You need a trigger_multiple

You can use brushes instead of models

function dissapearing_platform()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    trig_2 = GetEnt("platform_trig_2", "targetname");
    trig_3 = GetEnt("platform_trig_3", "targetname"); //as many as you have platforms

    model_1 = GetEnt("platform_model_1", "targetname");
    model_2 = GetEnt("platform_model_2", "targetname");
    model_3 = GetEnt("platform_model_3", "targetname"); //you see where this is going...

    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
    trig_2 SetHintString("");
    trig_2 SetCursorHint("HINT_NOICON");
    trig_3 SetHintString("");
    trig_3 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_1 waittill("trigger", player);
        trig_1 Delete();
        model_1 Delete();
        
        break;
    }
 
    while(1)
    {
        trig_2 waittill("trigger", player);
        trig_2 Delete();
        model_2 Delete();
        
        break;
    }


    while(1)
    {
        trig_3 waittill("trigger", player);
        trig_3 Delete();
        model_3 Delete();
        
        break;
    }
}



I never tested this but here it is just to give you an idea about how it should be

oooeh, i'll try it after i've finished this zombies game. :)

If i use brushes instead of model, i have to change model_1 to brush_1, right?

also wouldn't i be possible to use a FOR? Because i have around 30 non-solid platforms.

or something like count++;


ModmeBot:

Reply By: mathfag

soul-toktzt
mathfag

You need a trigger_multiple

You can use brushes instead of models

function dissapearing_platform()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    trig_2 = GetEnt("platform_trig_2", "targetname");
    trig_3 = GetEnt("platform_trig_3", "targetname"); //as many as you have platforms

    model_1 = GetEnt("platform_model_1", "targetname");
    model_2 = GetEnt("platform_model_2", "targetname");
    model_3 = GetEnt("platform_model_3", "targetname"); //you see where this is going...

    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
    trig_2 SetHintString("");
    trig_2 SetCursorHint("HINT_NOICON");
    trig_3 SetHintString("");
    trig_3 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_1 waittill("trigger", player);
        trig_1 Delete();
        model_1 Delete();
        
        break;
    }
 
    while(1)
    {
        trig_2 waittill("trigger", player);
        trig_2 Delete();
        model_2 Delete();
        
        break;
    }


    while(1)
    {
        trig_3 waittill("trigger", player);
        trig_3 Delete();
        model_3 Delete();
        
        break;
    }
}



I never tested this but here it is just to give you an idea about how it should be

oooeh, i'll try it after i've finished this zombies game. :)

If i use brushes instead of model, i have to change model_1 to brush_1, right?

also wouldn't i be possible to use a FOR? Because i have around 30 non-solid platforms.

or something like count++;

to be honest with you i dont know jack shit about scripting but i'm learning form this site and i try to help where i can.

You don't need to change model_1 to brush_1, you can call it potato if you want (it says model_1 in my script because i copied it from 1 of my scripts). That's just the name you'll be using in the script for example:

potato_1 Delete();



Also note that you can't have 2 models or brushes with the same targetname or nothing will happen. I learned this the hard way

also i suggest you add text everytime something is supposed to happen

iprintinbold("text");


ModmeBot:

Reply By: soul-toktzt

mathfag
soul-toktzt
mathfag

You need a trigger_multiple

You can use brushes instead of models

function dissapearing_platform()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    trig_2 = GetEnt("platform_trig_2", "targetname");
    trig_3 = GetEnt("platform_trig_3", "targetname"); //as many as you have platforms

    model_1 = GetEnt("platform_model_1", "targetname");
    model_2 = GetEnt("platform_model_2", "targetname");
    model_3 = GetEnt("platform_model_3", "targetname"); //you see where this is going...

    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
    trig_2 SetHintString("");
    trig_2 SetCursorHint("HINT_NOICON");
    trig_3 SetHintString("");
    trig_3 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_1 waittill("trigger", player);
        trig_1 Delete();
        model_1 Delete();
        
        break;
    }
 
    while(1)
    {
        trig_2 waittill("trigger", player);
        trig_2 Delete();
        model_2 Delete();
        
        break;
    }


    while(1)
    {
        trig_3 waittill("trigger", player);
        trig_3 Delete();
        model_3 Delete();
        
        break;
    }
}



I never tested this but here it is just to give you an idea about how it should be

oooeh, i'll try it after i've finished this zombies game. :)

If i use brushes instead of model, i have to change model_1 to brush_1, right?

also wouldn't i be possible to use a FOR? Because i have around 30 non-solid platforms.

or something like count++;

to be honest with you i dont know jack shit about scripting but i'm learning form this site and i try to help where i can.

You don't need to change model_1 to brush_1, you can call it potato if you want (it says model_1 in my script because i copied it from 1 of my scripts). That's just the name you'll be using in the script for example:

potato_1 Delete();



Also note that you can't have 2 models or brushes with the same targetname or nothing will happen. I learned this the hard way

also i suggest you add text everytime something is supposed to happen

iprintinbold("text");

oooh okay ;o i'm (trying) to implement it right now, i'll let you know if something happens.

edit: i Don't think it works, named the trigger "platform_trig_1" and brush "platform_model_1", but the brush doesn't disappears.

This is a dumb question, but am i supposed to add something in the main? I feel like i need to.

edit 1: I got it working :) Thank you very much for the script. :D

(i added

level thread dissapearing_platform();

under

zm_usermap::main();


ModmeBot:

Reply By: soul-toktzt

Well i did alot of testing and it works. But only in order from 1 to 54 (for me).

Is there a way so the platforms dissappear randomly?

I mean, i found out that you have to touch the triggers in order from 1 to 54. You can't just jump on the 9th one to make it go away. It HAS to be 1 then 2 then 3 then 4 etc.


ModmeBot:

Reply By: mathfag

soul-toktzt

Well i did alot of testing and it works. But only in order from 1 to 54 (for me).

Is there a way so the platforms dissappear randomly?

I mean, i found out that you have to touch the triggers in order from 1 to 54. You can't just jump on the 9th one to make it go away. It HAS to be 1 then 2 then 3 then 4 etc.

idk if theres an easier way but you can put each trigger and model in a separate function

function dissapearing_platform1()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    model_1 = GetEnt("platform_model_1", "targetname");


    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");

 
    while(1)
    {
        trig_1 waittill("trigger", player);
        trig_1 Delete();
        model_1 Delete();
        
        break;
    }
}


function dissapearing_platform2()
{
    trig_2 = GetEnt("platform_trig_2", "targetname");
    model_2 = GetEnt("platform_model_2", "targetname");


    trig_2 SetHintString("");
    trig_2 SetCursorHint("HINT_NOICON");

 
    while(1)
    {
        trig_2 waittill("trigger", player);
        trig_2 Delete();
        model_2 Delete();
        
        break;
    }
}


ModmeBot:

Reply By: soul-toktzt

mathfag
soul-toktzt

Well i did alot of testing and it works. But only in order from 1 to 54 (for me).

Is there a way so the platforms dissappear randomly?

I mean, i found out that you have to touch the triggers in order from 1 to 54. You can't just jump on the 9th one to make it go away. It HAS to be 1 then 2 then 3 then 4 etc.

idk if theres an easier way but you can put each trigger and model in a separate function

function dissapearing_platform1()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    model_1 = GetEnt("platform_model_1", "targetname");


    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");

 
    while(1)
    {
        trig_1 waittill("trigger", player);
        trig_1 Delete();
        model_1 Delete();
        
        break;
    }
}


function dissapearing_platform2()
{
    trig_2 = GetEnt("platform_trig_2", "targetname");
    model_2 = GetEnt("platform_model_2", "targetname");


    trig_2 SetHintString("");
    trig_2 SetCursorHint("HINT_NOICON");

 
    while(1)
    {
        trig_2 waittill("trigger", player);
        trig_2 Delete();
        model_2 Delete();
        
        break;
    }
}

This works!

I went instantly to number 9, it disappeared, then to 5, disappeared, then 1, then 4,... :)

Tyvm :)

(Now i can make 54 functions xD)