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

Shootable teddy bears [UNORDERED] (for EE)

broken avatar :(
Created 6 years ago
by isaacscott935
0 Members and 1 Guest are viewing this topic.
4,968 views
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 24 September 2016
Last active: 3 years ago
Posts
144
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
ZombieSlayerr115
Signature
Please. Save me.
×
isaacscott935's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
isaacscott935's Contact & Social LinksZombieSlayerr115isaac935
Hey guys

Yesterday I put up a tutorial on how to add a shootable model easter egg, so you can activate a door or play a song. That script only worked if you did the bears in order, which means you have to memorise where you placed the first, second and so on bears when testing it.
Today, I bring you my own unordered shootable bears/any other model tutorial, which makes it a lot better. I was thinking about how to do this and I realised you must have different functions for each of the bears (this is the only way I could work out how to do it).

The first part of this tutorial (the radiant part) will just be copy&pasted from the tutorial I put up yesterday because there's no need for me to rewrite it.

PART 1: RADIANT

 First, let's start off in radiant. Right click on your 2D window, and click script -> model. Find the zombie teddybear model. You can actually have this as any model, but I'll just use it (the model name for the bear is "zombie_teddybear"). You can place this anywhere in your map, as long as your player can see it.

Give this bear the KVP:
Code Snippet
Plaintext
targetname         teddy1

You can then duplicate the script_model to have as many as you like, but make sure you change the KVP each time:

So, my second one would look like:

Code Snippet
Plaintext
targetname       teddy2 
     etc.

Right click on your 2D window again and select trigger -> damage. Cover the bear with this trigger and hit N on your keyboard to give it KVPs. First, tick the box MELEE_NO (because we don't want to knife our bear). Then, add:

Code Snippet
Plaintext
targetname       bear1

So my second trigger's KVP would look like:

Code Snippet
Plaintext
targetname         bear2 
      etc.

Make sure you cover all of your bears with the trigger_damage and make sure all the KVPs are different.

PART 2: SCRIPTING

As I said, this scripting part is different.

Go to your mapname\maps\mapname.gsc file and open it.

About line 130, you'll find:

Code Snippet
Plaintext
level thread DLC3_threadCalls2();

Underneath that, put in:

Code Snippet
Plaintext
level thread bear1();
level thread bear2();
level.BearNumberShot = 0;

This calls all of the functions that we are going to create.

Now, at the bottom of your file, paste:

Code Snippet
Plaintext
bear1()
{
teddy_1_trigger = getEnt("bear1","targetname");
teddy_1_model = getEnt("teddy1","targetname");
teddy_1_trigger waittill("trigger");
teddy_1_trigger Delete();
teddy_1_model Delete();

level.BearNumberShot ++;

iPrintLnBold("Poor Teddy 1 has been shot."); // iPrintLn prints in top left corner, iPrintLnBold prints in centre.
if ( level.BearNumberShot == 2 )
{
level thread bears_complete();

}

}

and underneath that, paste:

Code Snippet
Plaintext
bear2()
{
teddy_2_trigger = getEnt("bear2","targetname");
teddy_2_model = getEnt("teddy2","targetname");
teddy_2_trigger waittill("trigger");
teddy_2_trigger Delete();
teddy_2_model Delete();

level.BearNumberShot ++;

iPrintLnBold("Teddy 2 has been shot, also.");
if ( level.BearNumberShot == 2 )
{
level thread bears_complete();

}

}

You may notice that each function contains an IF statement, which contains
Code Snippet
Plaintext
level thread bears_complete();
. We have not defined that function yet, so that's what we're going to do.
So, paste this underneath your other functions:

Code Snippet
Plaintext
bears_complete() // Function which displays the text when both of the bears/triggers have been shot, no matter the order. 
{
iPrintLnBold("Both bears have been killed. Well done!");

players = get_players();
for(i=0;i<players.size;i++)
players[i] playsound( "insert_sound_here" ); // Plays music once both bears have been shot.

}
This code is finished. Check that your targetnames are the same in the script as they are in the radiant triggers/models.

Again, this code:

Code Snippet
Plaintext
players = get_players();
for(i=0;i<players.size;i++)
players[i] playsound( "insert_sound_here" ); // Plays music once both bears have been shot.


allows a song to be played once all bears have been shot. You can add your own music; there are plenty of tutorials on that.

Enjoy. If there are any mistakes please mention it :D
<31
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 June 2018
Last active: 17 hours ago
Posts
110
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
×
cpt_johnson1's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
cpt_johnson1's Contact & Social Links
So I did everything and I made it give me a gun instead of a song, but right when I load up my map, it says that I shot the teddy bears and it gives me the gun. Do you know how to fix this?

Never mind, I got it working, I messed up the targetnames. I'll make sure to give you credit when my map releases
Last Edit: October 22, 2018, 07:08:49 pm by cpt_johnson1
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 28 June 2019
Last active: 4 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
killadumb's Groups
killadumb's Contact & Social LinksEDP455
The finished bears_complete() thread triggers when I start the game. Not after I do what I setup. Any help?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 June 2018
Last active: 17 hours ago
Posts
110
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
×
cpt_johnson1's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
cpt_johnson1's Contact & Social Links
The finished bears_complete() thread triggers when I start the game. Not after I do what I setup. Any help?
This happened to me, and it was because I messed up the targetnames on the bears. Make sure you check all of the kvp's carefully
Last Edit: July 12, 2019, 06:43:08 pm by cpt_johnson1
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 18 March 2020
Last active: 4 years ago
Posts
1
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Stiffy's Groups
Stiffy's Contact & Social Links
How do i use this to open a door?
broken avatar :(
×
broken avatar :(
Location: grgreece
Date Registered: 8 May 2020
Last active: 2 years ago
Posts
6
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
bonse2000's Groups
bonse2000's Contact & Social Links
i need help when i run build a take error MODSound -pc -ignore_orphans  error2057

please i need help i have make your teddy bear shootable script it is work thank you but i want put music haow can i do it  have see tutorials but nothing please help
broken avatar :(
×
broken avatar :(
Location: alDurrës
Date Registered: 6 June 2017
Last active: 9 months ago
Posts
222
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
My published cod maps:

Mansion of the Undead
Buros Der Toten
Minions by k3nt
×
klevi's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
i need help when i run build a take error MODSound -pc -ignore_orphans  error2057

please i need help i have make your teddy bear shootable script it is work thank you but i want put music haow can i do it  have see tutorials but nothing please help
since the script is works then only the sound remains to be correctly added, literally convert your sound properly in audacity at unsigned 8bit PC or signed 16bit PC. Then put your sound in sound_assets/raw/sound/ there or make a folder there, and make sure that you properly call that sound it its soundalias, then just open launccher, click build mod ff and build sounds, and after building these go and grab your converted sound in raw/sound folder(if i remember correctly) and put it in your mod folder. Build your mod normally as you would do after that, FF and IWD and make sure you tick the new files in launcher on the right side, Done! krimp
broken avatar :(
×
broken avatar :(
Location: deMunich
Date Registered: 19 January 2019
Last active: 7 months ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GimmCity's Groups
GimmCity's Contact & Social Links
So I did everything and I made it give me a gun instead of a song, but right when I load up my map, it says that I shot the teddy bears and it gives me the gun. Do you know how to fix this?

Never mind, I got it working, I messed up the targetnames. I'll make sure to give you credit when my map releases
can u tell me how ? or how i can make a door opens when i shoot the teddys... ?
Last Edit: July 23, 2020, 10:26:12 pm by InsaneTV
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 June 2018
Last active: 17 hours ago
Posts
110
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
×
cpt_johnson1's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
cpt_johnson1's Contact & Social Links
can u tell me how ? or how i can make a door opens when i shoot the teddys... ?
Code Snippet
Plaintext


bears_complete() // Function which displays the text when both of the bears/triggers have been shot, no matter the order.
{
 
    door = getEnt("shootable_door", "targetname");  //this will be the door that opens
    pap_door_trigger = getEnt("pap_door", "targetname");
   
 play_sound_at_pos("door_slide_open", door.origin);
        //door MoveZ (200, 2);
        //door MoveY (100, 5);
        door MoveX (-100, 5);
    self.gate_is_moving = "true";
    door delete();
    pap_door_trigger Delete();
    flag_set( "zone3_to_pap_zone" );

    iPrintLn("You have unlocked a door");

 
        wait 1;
             
}



To open a door, you could use this script. Just fyi, the flag_set is if you want to activate a zone when the door opens.
Last Edit: July 24, 2020, 02:07:21 pm by cpt_johnson1
broken avatar :(
×
broken avatar :(
Location: deMunich
Date Registered: 19 January 2019
Last active: 7 months ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GimmCity's Groups
GimmCity's Contact & Social Links
Code Snippet
Plaintext


bears_complete() // Function which displays the text when both of the bears/triggers have been shot, no matter the order.
{
 
    door = getEnt("shootable_door", "targetname");  //this will be the door that opens
    pap_door_trigger = getEnt("pap_door", "targetname");
   
 play_sound_at_pos("door_slide_open", door.origin);
        //door MoveZ (200, 2);
        //door MoveY (100, 5);
        door MoveX (-100, 5);
    self.gate_is_moving = "true";
    door delete();
    pap_door_trigger Delete();
    flag_set( "zone3_to_pap_zone" );

    iPrintLn("You have unlocked a door");

 
        wait 1;
             
}



To open a door, you could use this script. Just fyi, the flag_set is if you want to activate a zone when the door opens.
thanks ! but for what is this pap_door in the script ?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 June 2018
Last active: 17 hours ago
Posts
110
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
×
cpt_johnson1's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
cpt_johnson1's Contact & Social Links
thanks ! but for what is this pap_door in the script ?
Its the trigger for the door, which I used for a hintstring and to activate the zone. It may be kinda sloppy as I am not a scripter, but it works lol
broken avatar :(
×
broken avatar :(
Location: deMunich
Date Registered: 19 January 2019
Last active: 7 months ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GimmCity's Groups
GimmCity's Contact & Social Links
Its the trigger for the door, which I used for a hintstring and to activate the zone. It may be kinda sloppy as I am not a scripter, but it works lol
nice :Dcan u add me on discord ? maybe we can write there :D do u maybe know how i can import an animatet model in radiant that works, maybe an hanging cloth thats animated..... like in the map clinic  of evil..
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 June 2018
Last active: 17 hours ago
Posts
110
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
×
cpt_johnson1's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
cpt_johnson1's Contact & Social Links
nice :Dcan u add me on discord ? maybe we can write there :D do u maybe know how i can import an animatet model in radiant that works, maybe an hanging cloth thats animated..... like in the map clinic  of evil..
Sorry but I can't help you there. I dont really know much about porting and animating stuff haha
broken avatar :(
×
broken avatar :(
Location: deMunich
Date Registered: 19 January 2019
Last active: 7 months ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GimmCity's Groups
GimmCity's Contact & Social Links
Sorry but I can't help you there. I dont really know much about porting and animating stuff haha
ok thanks, no problem :Di added u on discord
:thumbsup-smiley:2

 
Loading ...