UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Big-Beautiful on November 03, 2016, 04:15:04 am

Title: custom script not teleporting players
Post by: Big-Beautiful on November 03, 2016, 04:15:04 am
Hello, ive created this script that gets triggered when you shoot a trigger_damage:

Code Snippet
Plaintext
function jug_tele(player)
{
self SetOrigin(GetEnt("jug_tele","targetname").origin);
IPrintLn("bonka");
wait(30);
self SetOrigin(GetEnt("bar_tele","targetname").origin);
level.jug_tele--;
}

I am able to see the bonka, but I am not teleported? Does anyone know if im using the setorigin correctly?
Title: Re: custom script not teleporting players
Post by: BluntStuffy on November 03, 2016, 04:22:13 am
depends on how you called/threaded this function, but self is not the player prob?

Code Snippet
Plaintext
function jug_tele(player)
{
player SetOrigin(GetEnt("jug_tele","targetname").origin);
IPrintLn("bonka");
wait(30);
player SetOrigin(GetEnt("bar_tele","targetname").origin);
level.jug_tele--;
}

Title: Re: custom script not teleporting players
Post by: Big-Beautiful on November 04, 2016, 04:13:43 am
Thank you for replying. player doesn't seem to work either. The function is called by this here:

Code Snippet
Plaintext
function shootable_perk_jug(player)
{
    trig_jug = GetEnt("perktrig_jug", "targetname");
    model_jug = GetEnt("perkmod_jug", "targetname");

    trig_jug SetHintString("");
    trig_jug SetCursorHint("HINT_NOICON");
    level.shoot_juggernog=0;


    while(1)
    {
        trig_jug waittill("trigger", player);

        if (player laststand::player_is_in_laststand())
{
break;
}
else
{
if(level.shoot_juggernog == 0)
{
IPrintLn("It's not unlocked yet ya snort snort");
}
else
{
playfx(level._effect["powerup_grabbed"] ,GetEnt("perkmod_jug","targetname").origin);
level.jug_tele++;
        thread jug_tele();
player playsound("Chinese_1");

break;
}

}
    }
}

I'm pretty sure that since bonka is shown, the function is being called correctly. I feel its the SetOrigins themselves or the entities I have in radiant. I gave a script struct the jug_tele targetname and another script struct bar_tele.
Title: Re: custom script not teleporting players
Post by: reckfullies on November 04, 2016, 05:05:09 am
Thank you for replying. player doesn't seem to work either. The function is called by this here:

Code Snippet
Plaintext
function shootable_perk_jug(player)
{
    trig_jug = GetEnt("perktrig_jug", "targetname");
    model_jug = GetEnt("perkmod_jug", "targetname");

    trig_jug SetHintString("");
    trig_jug SetCursorHint("HINT_NOICON");
    level.shoot_juggernog=0;


    while(1)
    {
        trig_jug waittill("trigger", player);

        if (player laststand::player_is_in_laststand())
{
break;
}
else
{
if(level.shoot_juggernog == 0)
{
IPrintLn("It's not unlocked yet ya snort snort");
}
else
{
playfx(level._effect["powerup_grabbed"] ,GetEnt("perkmod_jug","targetname").origin);
level.jug_tele++;
        thread jug_tele();
player playsound("Chinese_1");

break;
}

}
    }
}

I'm pretty sure that since bonka is shown, the function is being called correctly. I feel its the SetOrigins themselves or the entities I have in radiant. I gave a script struct the jug_tele targetname and another script struct bar_tele.

In my portal script i made a while back I use SetOrigin and it works fine, if you want a look at my function heres a screenshot:
(https://i.gyazo.com/2ea492c82ed4b2e7beb1f19df70fea1e.png)

Using player instead of self would also be the right thing to do.

EDIT:
Instead of doing
Code Snippet
Plaintext
thread jug_tele(); 
do
Code Snippet
Plaintext
thread jug_tele(player);
Title: Re: custom script not teleporting players
Post by: Big-Beautiful on November 04, 2016, 06:49:34 am
i used thread jug_tele(player);, but it still does not work. I thought that maybe changing up the function a bit would work:

Code Snippet
Plaintext
function juggers(player)
{
jugport = GetEnt("jug_tele","targetname");
barport = GetEnt("bar_tele","targetname");

player SetOrigin(jugport.origin);
IPrintLn("bonka");
wait(30);
player SetOrigin(barport.origin);
level.jug_tele--;

}

still, nothing. :(

Just in case, here is what i put in radiant. The trigger_damage is targeting that struct with its targetname as jug_tele. The other targeted struct has the targetname bar_tele.


(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FixbdCur.png&hash=f7db20fc21472ab57f0ff94cfafe42032418af8f)
Title: Re: custom script not teleporting players
Post by: reckfullies on November 04, 2016, 07:49:09 am
i used thread jug_tele(player);, but it still does not work. I thought that maybe changing up the function a bit would work:

Code Snippet
Plaintext
function juggers(player)
{
jugport = GetEnt("jug_tele","targetname");
barport = GetEnt("bar_tele","targetname");

player SetOrigin(jugport.origin);
IPrintLn("bonka");
wait(30);
player SetOrigin(barport.origin);
level.jug_tele--;

}

still, nothing. :(

Just in case, here is what i put in radiant. The trigger_damage is targeting that struct with its targetname as jug_tele. The other targeted struct has the targetname bar_tele.


(http://i.imgur.com/ixbdCur.png)

If you already did this, it must be a problem with the way you setup your structs in radiant.

Make sure you are using exact targetnames and that you setup the trigger right.

I am not the one who set them up so I can't really tell you what is wrong unless I tried it myself.
Title: Re: custom script not teleporting players
Post by: Big-Beautiful on November 04, 2016, 09:50:35 am
hmm, there has been an interesting development. Instead of using a script_struct, I used a script_model as the target. For some reason, it worked and I was teleported. I'll just use models instead of the structs now.

The teleporting script now works, but I have a question about activating the zone that contains the teleporter's target. I added the script_flag kvp to the trigger like you would on doors, but didn't work and i died. How can I go about this in script?
Title: Re: custom script not teleporting players
Post by: reckfullies on November 04, 2016, 11:35:43 am
hmm, there has been an interesting development. Instead of using a script_struct, I used a script_model as the target. For some reason, it worked and I was teleported. I'll just use models instead of the structs now.

The teleporting script now works, but I have a question about activating the zone that contains the teleporter's target. I added the script_flag kvp to the trigger like you would on doors, but didn't work and i died. How can I go about this in script?

The thing about script_flag is, its just an empty kvp without a script. The only reason it activates zones for doors is because inside the door script it sees that it has that kvp and activates the specified zone inside the script.

You would just need to find the code that does that and apply it in your script somehow.

Look around inside _zm_blockers.gsc and if you can't find anything I'm sure someone would help you.

EDIT: There is a function inside _zm_zonemgr.gsc that allows you to activate a zone, I haven't tried this so don't take my word for it but here is how I would assume you would use it:
Code Snippet
Plaintext
#using scripts\zm\_zm_zonemgr; // Must include this script so that you can use it's functions!

function somefunctionname() // This would be your function you are already using.
{
zm_zonemgr::zone_init(<zone_name>, <zone_tag>); // Change <zone_name> to the targetname of your zone eg: "start_zone". I don't know what zone_tag does but I would assume it isn't required.
}