Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
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!This should be pretty simple for you to implement. What you'll need to do is setup some trigger_damage brushes around the teddy bear models and monitor when players shoot them.
Here is code that will do that for you:
In the main function add:
This will allow you to use on_player_spawned within your file.
And this, which checks your map for any triggers with the "teddy_trigger" targetname and sets up the logic for them:
Add the on_player_spawned function. This sets a variable to monitor how many teddies the player has shot, and ties the not shot/shot state to the player, meaning progress towards the perk is personal for each player.
Add the logic for the teddy triggers:
This monitors the trigger for any damage events, and once one happens, checks that it comes from player. If the player hasn't shot the teddy before, it will set that teddy to true for the player, and check the player's progress.
Add the checkTeddyProgress function:
This is called when the player hits any of the teddies, so once they've hit all of them they will be granted the perk.
Not sure amount the first error, but for the one that occurs during linking, you need to add above the main function.
Here is a full script that you should be able to use more easily: