GornoDD Posted October 2, 2015 Posted October 2, 2015 In one of skyrims quests I found a function that seems very useful to my modding project (its form glenmoril witch quest) As someone who has only minor prior progamming knowlege I need some help comprehending this Bethsoft made Function. int Property WitchesKilled auto int Property TotalWitches auto Function KilledHagraven() WitchesKilled += 1 if (WitchesKilled >= TotalWitches) SetObjectiveCompleted(25, 1) endif So this is to track the count of witches killed already for the quest. It seems like the purpose of the function is, that whenever it is called, it adds +1 to the count of killed witches. If the number of killed witches matches the number of total witches, the quest objective (25 it is) will be completed. So what I dont understand is the mathematical idea behind "WitchesKilled += 1". What is this +=. I have never heard of something like this in school. Also when the name of the Function is defined. What is possible to be set inside its expression (). I have seen "float" variables being put there, that can individually been be definded for mathematical purposes withing the "function code" itself. Id be grateful for some shed knowledge
Menesh Posted October 2, 2015 Posted October 2, 2015 "n += 1" is just a shorter version of "n == n+1"
mybrainhurts Posted October 2, 2015 Posted October 2, 2015 An operator reference (including +=) is available here.
Guest Posted October 2, 2015 Posted October 2, 2015 "n += 1" is just a shorter version of "n == n+1" Actually is equivalent to: n = n + 1 The short addition operator is a pretty common operator in many recent languages. In Papyrus VM you can use the short operate and assign operators: += (add the value) -= (subtract the value) *= (multiply) /= (divide) %= (modulus) The first one works on int, float, and strings. The others work only on int and float. (Not sure about the modulus operator...)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.