ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Fri Oct 19, 2018 12:11 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Jan 17, 2013 4:01 am 
Offline
Archmage

Joined: Fri Feb 18, 2011 6:15 am
Posts: 300
hey guys, i really suck at coding and need some help. the talent shouldn't be all that difficult to get working, and i have most of it in place, but it just doesn't work. there are a couple of things i think i'm doing wrong, but i just can't figure out exactly what is the proper format to put stuff in. everything i've done so far has been figured out by editing the standard lua files, and i'm just at the point where i'm over my head

it is a sustain
it is supposed to modify a number of basic attributes; size_category, physpower, and health regen positively. movement speed, accuracy, and stamina regen negatively.
if possible, i'd like it to trigger itself to activate on any bleed damage
(it will probably also get a +20 cut immunity per level but this is not important for now)
(it will also get its own player sprite when active, but i can get that code from lichform)

i've tried to keep it simple in the way it modifies stats, and tried to keep it contained in just the mutations.lua file without using actor.lua or combat.lua . this hasn't worked so far

here's what i have so far:

Code:
newTalent{
   name = "Hulk Mode",
   type = {"wild-gift/mutations", 3},
   mode = "sustained",
   points = 5,
   require = barbgift_highreq1,
   cooldown = 30,
   sustain_stamina = 50,
   tactical = { BUFF = 2 },
   activate = function(self, t)

      return {
         size = self:addTemporaryValue("size_category", 0.5 * self:getTalentLevel(t)),
         dam = self:addTemporaryValue("combat_dam", 15 * self:getTalentLevel(t)),
         atk = self:addTemporaryValue("combat_atk", - 0.05 * self:getTalentLevel(t)),
         movespeed = self:addTemporaryValue("movement_speed", - 0.05 * self:getTalentLevel(t)),
         liferegen = self:addTemporaryValue("life_regen", 2 * self:getTalentLevel(t)),
         stamregen = self:addTemporaryValue("stamina_regen", - 1 * self:getTalentLevel(t)),      
      }
   end,
   deactivate = function(self, t, p)
      self:removeTemporaryValue("size_category", p.size)
      self:removeTemporaryValue("combat_dam", p.dam)
      self:removeTemporaryValue("combat_atk", p.atk)
      self:removeTemporaryValue("movement_speed", p.movespeed)
      self:removeTemporaryValue("life_regen", p.liferegen)
      self:removeTemporaryValue("stamina_regen", p.stamregen)

      return true
   end,
   info = function(self, t)
      return ([[Turn into the Hulk. Greatly increase your size, strength, health regen, and cut immunity. Lose some accuracy, global speed, and drain stamina while active due to your massive bulk.
      
      *Gain 1 size category for every two points in the skill. (First huge, then gargntuan)
      
      +%d Physical Power
      +%d Health Regeneration
      
      -%d Stamina Regeneration
      -%d Accuracy
      -%d Movement Speed]]):format(15 * self:getTalentLevel(t), 2 * self:getTalentLevel(t), self:getTalentLevel(t), 5 * self:getTalentLevel, 5 * self:getTalentLevel(t))
   end,
}


now i've just recently noticed that some of these basic stats use self, like self.movement_speed or self.combat_atk. others use t, like r t.health_regen and t.stamina_regen. i don't know what this means. i have a feeling this is why my talent won't work though.

can someone point me in the right direction? thanks in advance!


Top
 Profile  
 
PostPosted: Thu Jan 17, 2013 5:07 am 
Offline
Higher

Joined: Fri Oct 01, 2010 11:15 pm
Posts: 60
Code:
format(15 * self:getTalentLevel(t), 2 * self:getTalentLevel(t), self:getTalentLevel(t), 5 * self:getTalentLevel, 5 * self:getTalentLevel(t))


Should be:

Code:
format(15 * self:getTalentLevel(t), 2 * self:getTalentLevel(t), self:getTalentLevel(t), 5 * self:getTalentLevel(t), 5 * self:getTalentLevel(t))


I didn't test it extensively, but aside from that it seemed to work. One thing I'm not sure about is how ToME handles size categories. If you want to make sure the size category is an integer you could do:

Code:
size = self:addTemporaryValue("size_category", math.floor(0.5 * self:getTalentLevel(t))),


Top
 Profile  
 
PostPosted: Thu Jan 17, 2013 5:17 am 
Offline
Archmage

Joined: Fri Feb 18, 2011 6:15 am
Posts: 300
thank you BDota!


Top
 Profile  
 
PostPosted: Fri Jan 18, 2013 12:56 am 
Offline
Wyrmic

Joined: Wed Aug 22, 2012 12:16 am
Posts: 200
While it won't make things any more likely to work, changing your addTemporaryValue() calls to talentTemporaryValue() calls will make the engine clean up after you, simplifying your talent definition, like so (w/BDota's suggestions integrated):
Code:
newTalent{
   name = "Hulk Mode",
   type = {"wild-gift/mutations", 3},
   mode = "sustained",
   points = 5,
   require = barbgift_highreq1,
   cooldown = 30,
   sustain_stamina = 50,
   tactical = { BUFF = 2 },
   activate = function(self, t)
      self:talentTemporaryValue("size_category", 0.5 * math.floor(0.5 * self:getTalentLevel(t))),
      self:talentTemporaryValue("combat_dam", 15 * self:getTalentLevel(t)),
      self:talentTemporaryValue("combat_atk", - 0.05 * self:getTalentLevel(t)),
      self:talentTemporaryValue("movement_speed", - 0.05 * self:getTalentLevel(t)),
      self:talentTemporaryValue("life_regen", 2 * self:getTalentLevel(t)),
      self:talentTemporaryValue("stamina_regen", - 1 * self:getTalentLevel(t)),     
   end,
   deactivate = function(self, t, p)
      return true
   end,
   info = function(self, t)
      return ([[Turn into the Hulk. Greatly increase your size, strength, health regen, and cut immunity. Lose some accuracy, global speed, and drain stamina while active due to your massive bulk.
     
      *Gain 1 size category for every two points in the skill. (First huge, then gargantuan)
     
      +%d Physical Power
      +%d Health Regeneration
     
      -%d Stamina Regeneration
      -%d Accuracy
      -%d Movement Speed]]):format(15 * self:getTalentLevel(t), 2 * self:getTalentLevel(t), self:getTalentLevel(t), 5 * self:getTalentLevel, 5 * self:getTalentLevel(t))
   end,
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group