Повысить уровень

I_Explorer

Друзья CG
30 Июл 2016
318
16
Проект
Жизнь в тюрьме
Почему лвл повышается на 2, а не на 1? где ошибка?
Код:
function GiveExp(data)
local hero = data.activator
local level = hero:GetLevel()
local Constants = require('consts')
	local need_exp = Constants.XP_PER_LEVEL_TABLE[level+1]
	local old_exp = Constants.XP_PER_LEVEL_TABLE[level]
	if not need_exp then need_exp = 0 end
	if not old_exp then old_exp = 0 end
	
	hero:AddExperience(need_exp - old_exp, false, false)
end
Код:
local Consts = {}

-- EXP Needed for each level
Consts.XP_PER_LEVEL_TABLE = {
		0, -- 1
   300, -- 2 +200
   750, -- 3 +300
   1350, -- 4 +400
   2100, -- 5 +500
   3000, -- 6 +600
   3750, -- 7 +500
   4350, -- 8 +400
   5250, -- 9 +600
   6450, -- 10 +800
   7950, -- 11 +1000
   9750, -- 12 +1200
  10500, -- 13 +500
  11400, -- 14 +600
  12750, -- 15 +900
  14550, -- 16 +1200
  16800, -- 17 +1500
  19500, -- 18 +1800
   20250, -- 19 +500
   21450, -- 20 +800
   23250, -- 21 +1200
   25650, -- 22 +1600
   28650, -- 23 +2000
   32250, -- 24 +2400
   33000, -- 25 +500
   34000, -- 26 +22000
   35000, -- 27 +500
   36500, -- 28 +2000
   37500, -- 29 +2000
   41000, -- 30 +2000
   45000, -- 31 +2000
   49500, -- 32 +2000
   54500, -- 33 +2000
   60000, -- 34 +2000
   62000, -- 35 +2000
   64000, -- 36 +2000
   66000, -- 37 +2000
   68000, -- 38 +2000
   70000, -- 39 +2000
   72000, -- 40 +2000
   74000, -- 41 +2000
   76000, -- 42 +2000
   78000, -- 43 +2000
   80000, -- 44 +2000
   82000, -- 45 +2000
   84000, -- 46 +2000
   86000, -- 47 +2000
   88000, -- 48 +2000
   90000, -- 49 +2000
   90500, -- 50 +500
   1000000 -- 51 +909500
}

return Consts
 
Проблема решена, оказывается у меня стояло два триггера, а не один...
 
Реклама: