- Home /
Experience system help (easy)
hey guys, im still stuck on my dumb old XP stuff for my FPS, and none of my questions have been answered so i come to you with 1 more question, one i think should be easily answered. since i could not manage new script i read over and over again the ones i found here. the closest i came was w/ this
http://answers.unity3d.com/questions/18589/how-can-i-make-it-give-u-a-certain-xp-everytime-u-kill-someone any way, it still didnt work. so all i ask for is for someone to explain to me how to go about putting these scripts into action, because clearly im dong something WRONG
waiting patiently,
PathKiller29
Answer by jlocke · Sep 22, 2010 at 06:48 AM
One way to accomplish what it sounds like you're trying to accomplish is to use 2 scripts. One script would apply to your character/player. That one would be like the one you linked to from the other question. It would handle how much xp the character has, how much is needed to level and what level the player currently is.
The second script would attach to each enemy. That script would hold a value for how much xp killing this particular enemy is worth (we'll say xpValue) (you'll probably want that to be an exposed variable for easy editing / balancing). When the enemy dies (where you determine the hp <= 0), you'll want to add its xpValue to the variable from the first of these two scripts (the one that tells how much xp the character has).
Here are instructions for exactly this method: http://answers.unity3d.com/questions/10505/variables-acesssed-by-other-scripts-and-change-int-values First set it up as written, even if that's not quite what you need. Then you can make small changes, testing each time, until it does what you want.
uhh i tried adding them in these places and i feel like im an inch away but im getting a script error saying "unknown identifier 'xp'" from my experience system script co$$anonymous$$g from the line "xp += addedXP"
so what do i do?
ohh never $$anonymous$$d i got it. thanks a LOT!! one more thing though, how can i make it show my XP, display points earned on kill, and make a GUI animation i guess.
well never$$anonymous$$d that previous comment i was being slow. all i ask for now is since you know what im heading at here, if you could just look at my other question here http://answers.unity3d.com/questions/21068/gui-text-grow-animation
Your answer