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 [ORDERED] (for EE)

broken avatar :(
Created 6 years ago
by isaacscott935
0 Members and 1 Guest are viewing this topic.
1,813 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

I created this script earlier today. This allows you to be able to shoot teddy bears in the map.
NOTE:You must shoot the teddies in the order it is in the script. Make sure to remember where you put Bear1,bear2 etc in radiant so you can test 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

Go into mapname\maps\mapname.gsc.

I have created a function called shootable_bears(), so you need to write:

Code Snippet
Plaintext
level thread shootable_bears();

underneath

Code Snippet
Plaintext
level thread DLC3_threadCalls2();

Next, at the bottom of your .GSC file, add your function:

Code Snippet
Plaintext
shootable_bears() //Shootable teddy bears in map. Make sure you add a trigger_multiple and add the KVPs. 
{
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();
iPrintLnBold("Poor Teddy 1 has been shot.");

//The first teddy has now been shot. You can now shoot the second one. When each one is shot, text will appear.

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();
iPrintLnBold("Teddy 2 has been shot, also.");

//Both teddies have now been shot.

players = get_players();
for(i=0;i<players.size;i++)
players[i] playsound( "insert_sound_here" );

}


NOTE: Make sure all of your targetnames in your script match the ones in your radiant file
KVPs.

This code

Code Snippet
Plaintext
players = get_players();
for(i=0;i<players.size;i++)
players[i] playsound( "insert_sound_here" );

is to add music once your teddies have been shot. I have not added music, hence the "insert_sound_here", but you can add a song to your map and play it using this code.

Enjoy
If there are any mistakes please let me know
Last Edit: June 12, 2018, 05:33:20 pm by isaacscott935
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 4 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
Signature
My published cod maps:

Subzero
Djinncaves
Enclosed (a.k.a baconcube)
Bayern
Snowblind
Furtrelock

Black Ops Perks: https://www.ugx-mods.com/forum/scripts/55/call-of-duty-world-at-war-black-ops-perks/22180/
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Hey guys

I created this script earlier today. I am just learning scripting, so it might not be the most exciting/complex tutorial but here we are. This basically allows you to be able to shoot teddy bears in the map.

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

Go into mapname\maps\mapname.gsc.

I have created a function called shootable_bears(), so you need to write:

Code Snippet
Plaintext
level thread shootable_bears();

underneath

Code Snippet
Plaintext
level thread DLC3_threadCalls2();

Next, at the bottom of your .GSC file, add your function:

Code Snippet
Plaintext
shootable_bears() //Shootable teddy bears in map. Make sure you add a trigger_multiple and add the KVPs. 
{
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();
iPrintLnBold("Poor Teddy 1 has been shot.");

//The first teddy has now been shot. You can now shoot the second one. When each one is shot, text will appear.

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();
iPrintLnBold("Teddy 2 has been shot, also.");

//Both teddies have now been shot.

players = get_players();
for(i=0;i<players.size;i++)
players[i] playsound( "insert_sound_here" );

}


NOTE: Make sure all of your targetnames in your script match the ones in your radiant file
KVPs.

This code

Code Snippet
Plaintext
players = get_players();
for(i=0;i<players.size;i++)
players[i] playsound( "insert_sound_here" );

is to add music once your teddies have been shot. I have not added music, hence the "insert_sound_here", but you can add a song to your map and play it using this code.

Enjoy
If there are any mistakes please let me know

I think this tutorial is working fine but I see a problem there, you really need to shoot the first teddybear before you can shoot the second.
It can't be done otherwise.
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
×
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
Yes, I forgot to mention that. I’ll edit the original post. You have to remember which order you put them in the script and where you put them in radiant to test them.

 
Loading ...