Posts
144
Respect
27Add +1
Forum Rank
Pack-a-Puncher
Primary Group
Community Scripter
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
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:
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:
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:
So my second trigger's KVP would look like:
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:
underneath
Next, at the bottom of your .GSC file, add your function:
NOTE: Make sure all of your targetnames in your script match the ones in your radiant file
KVPs.
This code
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
Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |