ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Jun 04, 2020 11:00 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jul 27, 2014 6:47 pm 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 886
I have a spell where the design is intended to fire a slow moving orb, and each turn the orb will in turn fire out multiple projectiles. Currently it almost works, but the projectiles originate from the player, rather than the orb itself. Is this possible to do? I've included my draft code below.

Code:
newTalent{
   name = "Cold Flames", short_name = "COLD_FLAMES_2",
   type = {"spell/grave",3},
   require = spells_req3,
   points = 5,
   random_ego = "attack",
   mana = 18,
   cooldown = 6,
   tactical = { ATTACKAREA = { COLD = 2 } },
   range = 10,
   proj_speed = 2,
   getDamage = function(self, t) return self:combatTalentSpellDamage(t, 12, 100) end,
   on_learn = function(self, t)
      self:learnTalent(self.T_COLD_FLAMES_DETONATE, nil, nil, {no_unlearn=true})
   end,
    on_unlearn = function(self, t)
      self:unlearnTalent(self.T_COLD_FLAMES_DETONATE)
    end,
   action = function(self, t)
      local tg = {type="beam", range=self:getTalentRange(t), talent=t, display={particle="bolt_ice"}}
      local x, y = self:getTarget(tg)
      if not x or not y then return nil end
      local _ _, x, y = self:canProject(tg, x, y)
      local dam = self:spellCrit(t.getDamage(self,t))
      self:projectile(tg, x, y, function(px, py, tg, self)
         name = "Frozen Orb"
         local tgts = {}
         local grids = core.fov.circle_grids(self.x, self.y, self:getTalentRange(t), true)
         for x, yy in pairs(grids) do for y, _ in pairs(grids[x]) do
         local a = game.level.map(x, y, Map.ACTOR)
         if a and self:reactionToward(a) < 0 then
            tgts[#tgts+1] = a
         end
         end end
         

         local tg = {type="bolt", range=self:getTalentRange(t), talent=t, friendlyfire=false, display={particle="bolt_ice"}}
         for i = 1, 5 do
         if #tgts <= 0 then break end
         local a, id = rng.table(tgts)
         table.remove(tgts, id)

         self:projectile(table.clone(tg), a.x, a.y, DamageType.COLD, self:spellCrit(t.getDamage(self, t)), {type="freeze"})
         end         
      end)
      return true
   end,
   info = function(self, t)
   local dam = t.getDamage(self, t)
      return ([[Conjure a sphere of cold fire that slowly drifts outwards, dealing %0.2f cold damage to adjacent targets each turn. While the sphere is active, you gain the ability to detonate it.
      The damage will increase with your Spellpower.]]):format(damDesc(self, DamageType.COLD, dam))
   end,
}


Top
 Profile  
 
PostPosted: Sun Jul 27, 2014 6:53 pm 
Offline
Retired Ninja

Joined: Fri May 28, 2010 4:38 pm
Posts: 3756
the target table can accept start_x, start_y parameters

Here's an example from a talent I did recently,

Code:
{type="cone", range=0, radius=self:getTalentRadius(t), start_x=a.x, start_y=a.y, selffire=false, talent=t}


Hopefully that will help :)

_________________
Jack's Cheese and Bread Snack


Top
 Profile  
 
PostPosted: Sun Jul 27, 2014 6:54 pm 
Offline
Uruivellas

Joined: Wed Apr 30, 2008 5:55 pm
Posts: 708
Try this for the tg in the middle.
Code:
local tg = {type="bolt", range=self:getTalentRange(t), talent=t, friendlyfire=false, display={particle="bolt_ice"}, start_x = px, start_y = py,}

_________________
Addons: Arcane Blade Tweaks, Fallen Race, Monk Class, Weapons Pack
Currently working on Elementals. It's a big project, so any help would be appreciated. :)


Top
 Profile  
 
PostPosted: Sun Jul 27, 2014 7:04 pm 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 886
Awesome, that line did exactly what I wanted. Thanks guys.


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 1 guest


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