I’m having trouble wrapping my head around the logic in this lecture. I’m sure it’s totally me. Why are we using an “instigator” to determine xp? Does it really matter who started the fight? Isn’t xp normally awarded only to the player for killing enemies regardless of who started the fight (e.g. I walk within range of an enemy, he’s the “instigator”, but I get xp for killing him… if I target an enemy, I am the “instigator”. What am I missing here?
The instigator only applies to who did the direct damage… so if I swing a sword and hit you, I’m the instigator. If you hit me back, you are now the instigator.
As you’re the player, and I’m the NPC, if I hit you and kill you, as the Instigator, I have no Experience component, and will not get credit for slaying you. If, however, you hit me and kill me, now you’re the Instigator, who in this case is the player, and you have an Experience Component. Therefore you get experience for destroying my dream of being a winning NPC.
Other uses: In multiplayer games (we’re not doing a multiplayer game, but the groundwork is here in the instigator), you can use the instigator to determine aggro… In this case we’re both players, bashing our swords into that big nasty dragon on the course landing page (that we conveniently don’t actually use in the course). If you are doing more damage to the dragon than I am, then the dragon would have more aggro towards you and direct his attacks at you instead of me. (lucky me!)
I think maybe my lack of comprehension has to do with the word “instigator”. Maybe I just need to watch this lecture for a 3rd time
“if I hit you and kill you, as the instigator…”. I get that. But what if I walk within attack range of an enemy. Am I the instigator or is that poor mob I’m about to kill the instigator?
I guess I need to run through the code and see how it works for different scenarios. Otherwise, this just isn’t going to gel in my brain.
Whenever one character damages another, the one doing the damage (the one with the Fighter component, calling the other’s Health component is the instigator. A better word for the variable would probably be damageDealer. As the combat continues, the characters will take turns being the instigator until one or both characters are lying on the ground.
OOOOOH. Yeah, changing the variable name makes a difference in how I’m thinking about this. Thanks
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.