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

Help with making models appear after something happens

HOT
broken avatar :(
Created 10 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
5,355 views
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
Signature
"Deleted code is debugged code." - Jeff Sickel
"Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Untested and made in a rush cause I have to get off my pc:
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
init()
{
precacheModel("bo2_p6_dogtags_friend");
dogtags = getEntArray("dogtags_ee", "targetname");

for(i=0;i<dogtags.size;i++)
dogtags[i] Hide();

thread button_press();
}

//Function that handles the button pressing
button_press()
{
button = getEnt("button","targetname");
button_trig = getEnt("button_trig","targetname");
button_trig setCursorHint("HINT_NOICON");
button_trig sethintstring("Press &&1 to do something exciting");
button_trig waittill("trigger", player);
button_trig disable_trigger();
button hide();
IPrintLnBold("Let the Games Begin");
thread dogtags();
thread model_spin();
}

//Function that handles the dog tags appearing
dogtags()
{
dogtags = getEntArray("dogtags_ee","targetname");
for(i=0;i<dogtags.size;i++)
{
trig = Spawn("trigger_radius", dogtags[i].origin, 60, 32, 60);
trig linkto(dogtags[i]);

trig setCursorHint("HINT_NOICON");
trig setHintString("Press &&1 to collect Dog Tags");

trig thread init_dogtag_events(dogtags[i]);
}
}

init_dogtag_events(model)
{
thread dogtags_trig(model, self);
model Show();
model thread model_spin();
}

dogtags_trig(model, trig)
{
while(1)
{
players = get_players();
for(i=0;i<players.size;i++)
{
if( players[i] isTouching(trig) && players[i] UseButtonPressed() )
                        {
model Hide();
                                trig Delete();
                        }
}
wait .01;
}
}

//Time to make it spin
model_spin()
{
while(1)
{
self rotateyaw(360,5);
wait(5);
}
}

As you can see I spawned the triggers via script. ;)

Edit: Forgot to remove the trigger once triggered, edited. (I must be tired, lol.)
Last Edit: May 14, 2014, 08:45:43 pm by JR-Imagine
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
well i can finally collect them but the text is a bit off to the side, if im right on top of the dog tags it has a hand symbol but lets me collect them, and i noticed the text comes if i go off to the side of it
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
well i can finally collect them but the text is a bit off to the side, if im right on top of the dog tags it has a hand symbol but lets me collect them, and i noticed the text comes if i go off to the side of it
You still have the original triggers in radiant? If so, that's why, remove them and recompile the map. I spawned the triggers via script so it's easier to control. ^
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
JR-Image's way is awesome. I didn't know you could do it that way without it triggering all the dog tags.  :rainbow:


i know you asked me that before but i thought you meant multiple for just 1 dog tag not multiple as in all triggers the same

It is simpler for me, as a beginner scripter, to do things one at a time though. This is just FYI, definitely not as good as JR's

If you are trying to trigger 1 dog tag out of several then you can set up unique targetnames per dog tag as well as unique names per trigger. (dog_tag1, dog_tag1_trig, etc...) Then getent on both for each set of dog_tag and triggers and then call or thread something that will wait for the trig, once the button is hit. You could even use a flag or something if you wanted and have each wait for the flag before the enable trigger, model show, and wait trigger.
Last Edit: May 14, 2014, 08:30:05 pm by MakeCents
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic

If you are trying to trigger 1 dog tag out of several then you can set up unique targetnames per dog tag as well as unique names per trigger. (dog_tag1, dog_tag1_trig, etc...) Then getent on both for each set of dog_tag and triggers and then call or thread something that will wait for the trig, once the button is hit. You could even use a flag or something if you wanted and have each wait for the flag before the enable trigger, model show, and wait trigger.

Thats the way i wanted at first but then i figured my script would be too long because 10 dog tags 10 different functions, this way is easier to handle
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
Thats the way i wanted at first but then i figured my script would be too long because 10 dog tags 10 different functions, this way is easier to handle

Well it would be 10 sets of getent but only one function. You would call thread this function for each set.

Edit:
I see you have an answer now, but I wanted to share anyway, if you were to have individual triggers and dog tags. Maybe it will work/help someone.

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
init()
{
  precachemodel("bo2_p6_dogtags_friend");
  level.numberoftags = 10;
  thread button_press();
}


//Function that handles the button pressing
button_press()
{
    //hide all the tags
    thread handletags(0);

    //get ready for the button
    button = getent("button","targetname");
    button_trig = getent("button_trig","targetname");
    button_trig setCursorHint("HINT_NOICON");
    button_trig sethintstring("Press &&1 to do something exciting");

    //wait for trigger
    button_trig waittill("trigger", player);
    button_trig disable_trigger();
    button hide();

    //begin the game for the tags
    thread handletags(1);

    IPrintLnBold("Let the Games Begin");
}
handletags(see){
    for(i=0;i<level.numberoftags;i++){
        thread eachtag(i,see);
    }
   
}   

eachtag(i,see){
        tag = getent("dt" + i, "targetname");
        tag_trig = getent(tag.targetname + "_trig","targetname");
        if(see){
            //what to do when button hit
            tag show();
            tag thread model_spin();
            tag_trig sethintstring("Press &&1 to collect Dog Tags");
            tag_trig wait("trigger", player);
            tag_trig disable_trigger();
            tag delete();
        }else{
            //what to do if button not hit yet
            tag_trig setCursorHint("HINT_NOICON");
            tag hide();
        }

}

//Time to make it spin
model_spin()
{
    while(1)
    {
        self rotateyaw(360,5);
        wait(5);
    }
}
Last Edit: May 16, 2014, 03:57:31 pm by MakeCents
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
well after deleting the triggers in radiant, it still doesnt show the hintstring but i can still pick it up also the models still doesnt spin

Post Merge: May 14, 2014, 08:35:10 pm
Well it would be 10 sets of getent but only one function. You would call thread this function for each set.

ya i meant thread not function

Post Merge: May 14, 2014, 08:55:43 pm
Just now realized you edited the post and it completely fixed the problem. thanks jr!!

Post Merge: May 14, 2014, 09:04:12 pm
one thing though, the model still doesnt spin? how do i fix that
Last Edit: May 14, 2014, 09:04:12 pm by thezombiekilla6
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
one thing though, the model still doesnt spin? how do i fix that

It might be the thread model_spin() line in button press? Might need to delete that.
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
It might be the thread model_spin() line in button press? Might need to delete that.
Oh wow... I seriously left that thread there? Derpedyderpderp. Idk if it'll fix the problem but you should indeed delete the model_spin thread from the button_press function.
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
Oh wow... I seriously left that thread there? Derpedyderpderp. Idk if it'll fix the problem but you should indeed delete the model_spin thread from the button_press function.

I deleted it and it fixed the problem. thanks again for your help, also for yours makecents!

 
Loading ...