- Home /
Need help with a proficiency system(experience system)
Hello there! So I have been trying to think of ways to implement this idea of a proficiency system for while. Basically I wanna have a system where if you damage an enemy it send back the damage amount to the proficiency and acts as experience. Although I want it set up through weapons. So if I am using an AK-47, and damage an enemy it send that amount of damage to the Assault Rifle Proficiency. Or if I am using an Pump Shotgun it send the damage amounts to the Shotgun Proficiency. If any of you have played the first Borderlands you will have already experienced this, and that is what I am trying to make. Any ideas on how I would go about actually doing this? Any help or guidance would be extremely helpful as I love to learn! Thank you in advance and hope you have a great day! :)
Answer by newb_quest · Dec 05, 2013 at 05:22 AM
I am a newb, so take this with a grain of salt, but I think your problem is pretty solvable. You should be able to know the amount of damage caused, inside the weapon script that calculates damage to apply to your enemy.
If you spawn a AK47 bullet prefab and send that at an enemy you will likely have to make a decision about what is the damage amount associated with getting shot by an AK47. I would assume that that logic is in the script for your weapon or bullet.
Then you could OnCollisionEnter or OnTriggerEnter when the bullet hits the enemy and have the bullet damage variable of the projectile or gun decrement a health variable on your enemy.
Since you will probably be doing some passing of variables from one script to another and between scripts on different gameobjects you will probably need to familiarize yourself with GetComponent. This is a really useful functionality that will allow you to access and change variables in other scripts. Combining this with OnTriggerEnter you can do things like 'When this hits something, change variable X in script Y of that something"
The larger point is that unless there's some complicated calculation or damage modification happening inside the enemy health script (because of armor maybe, or taking different damage for diff body parts) then you should know your damage amount from the start and be able to take that same number and add it to your proficiency tracking script.
Good luck!
Your answer
![](https://koobas.hobune.stream/wayback/20220613122430im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Simple EXP Script In Javascript 0 Answers
A node in a childnode? 1 Answer
PlayerPrefs reset error 0 Answers
Experience System 1 Answer
Borderlands Style Proficiencies 0 Answers