Help with Party.lua modding

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Kothyxaan
Posts: 4
Joined: Sat Jan 31, 2015 9:13 am

Help with Party.lua modding

#1 Post by Kothyxaan »

I havent played this game in ages, but one of the things I did in my own addon was to modify the party.lua file in the mod/ai folder.
It was basically to make all party member warp to the party leader (ie your character) when they were outside of their "leash" (i think its 10 by default) this worked for necromancers minions and alchemists golem etc. But it does not work anymore. I used the thought-forms warping code with minor alterations and had came up with this:

-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org

newAI("party_member", function(self)
local anchor = self.ai_state.tactic_leash_anchor

-- Stay close to the leash anchor
if anchor and self.ai_state.tactic_leash and anchor.x and anchor.y then
local leash_dist = core.fov.distance(self.x, self.y, anchor.x, anchor.y)
if self.ai_state.tactic_leash < leash_dist then
--was not here below
local Map = require "engine.Map"
local x, y = util.findFreeGrid(anchor.x, anchor.y, 5, true, {[engine.Map.ACTOR]=true})
if not x then
return
end
-- Clear it's targeting on teleport
self:setTarget(nil)
self:move(x, y, true)
game.level.map:particleEmitter(x, y, 1, "generic_teleport", {rm=225, rM=255, gm=225, gM=255, bm=225, bM=255, am=35, aM=90}) --was not here to above
-- print("[PARTY AI] leashing to anchor", self.name)
--was here -> return self:runAI("move_anchor")
end
end
-- Unselect friendly targets
if self.ai_target.actor and self:reactionToward(self.ai_target.actor) >= 0 then self:setTarget(nil) end

-- Run normal AI
local ret = self:runAI(self.ai_state.ai_party)

if not ret and anchor and not self.energy.used then
-- print("[PARTY AI] moving towards anchor", self.name)
return self:runAI("move_anchor")
else
return ret
end
end)

newAI("move_anchor", function(self)
local anchor = self.ai_state.tactic_leash_anchor
if anchor and anchor.x and anchor.y then
local a = engine.Astar.new(game.level.map, self)
local path = a:calc(self.x, self.y, anchor.x, anchor.y)
if not path then
return self:moveDirection(anchor.x, anchor.y)
else
local moved = self:move(path[1].x, path[1].y)
if not moved then return self:moveDirection(anchor.x, anchor.y) end
end
end
end)


As I said it does not seem to work anymore, is there something im missing?

Help much appreciated.
Last edited by Kothyxaan on Sun Feb 08, 2015 8:24 am, edited 1 time in total.

Kothyxaan
Posts: 4
Joined: Sat Jan 31, 2015 9:13 am

Re: Help with Party.lua modding

#2 Post by Kothyxaan »

nobody able to help with this at all?

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Help with Party.lua modding

#3 Post by HousePet »

You could try posting the whole addon.
My feedback meter decays into coding. Give me feedback and I make mods.

Kothyxaan
Posts: 4
Joined: Sat Jan 31, 2015 9:13 am

Re: Help with Party.lua modding

#4 Post by Kothyxaan »

Well HousePet, its more of a personal use addon/tinkering project. I just make a few adaptations for my own personal use/play style. I did debate about where to post this, "general discussion" or "dumb questions" were the only 2 other options (shame there is no "modding help" section, hint hint?).

I have made all the other alterations I wanted to (so far) it is just having all party members warp to the pc when they are out of their leash distance. I had it working before (using the code provided, unless this was a WIP one, but I did have a version that worked), but honestly cant remember how I set it up or if I'm missing a step.

So there is no point in posting my addon, since it personal preference/experimentation addon, I dont think anyone would be interested in my addon.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Help with Party.lua modding

#5 Post by HousePet »

Well okay, but the problem might not be in the above code.
My feedback meter decays into coding. Give me feedback and I make mods.

Kothyxaan
Posts: 4
Joined: Sat Jan 31, 2015 9:13 am

Re: Help with Party.lua modding

#6 Post by Kothyxaan »

Ah ok, I dont think I have changed anything else that would affect it, ah well, back to the drawing board, thanks anyway :)

Post Reply