Here's another example of a function to grant experience that makes use of variables.
Code: Select all
function grantExp(amount)
for i = 1,4 do
party:getChampion(i):gainExp(amount)
end
end
place this in a script entiy (say called global_scripts) and whenever you want to award the party some experience, as part of another script, call the function with the amount you want to give.
e.g.
if you are calling it from a different script entity, be sure to include the name of the script where the experience function is stored, as I have done in the example above.
Note this will not work with connectors, only with scripts, because you cannot pass the variable "amount" from a connector.