SAYS it is multiplying so why is there no clone?

Have a really dumb question? Ask it here to get help from the experts (or those with too much time on their hands)

Moderator: Moderator

Post Reply
Message
Author
xnd
Archmage
Posts: 307
Joined: Sat Mar 21, 2015 7:33 pm

SAYS it is multiplying so why is there no clone?

#1 Post by xnd »

I give the enemy the talent, even force it to use it, and it SAYS it uses it, and no error popup messages in game, yet there is no effect.

actor:learnTalent(actor.T_MULTIPLY, true)
actor:forceUseTalent(actor.T_MULTIPLY, {ignore_energy=true})


yet if I do,
actor:learnTalent(actor.T_PARADOX_CLONE, true)
actor:forceUseTalent(actor.T_PARADOX_CLONE, {ignore_energy=true})

it makes infinite clones (game ruined) because each makes another, unlike multiply code that apparently is written to prevent that.

And if I give them the paradox clone or multiply but don’t force them to use it, they do not use it.

(This is put in the hunted code I have adapted, listed after
actor:setEffect(actor.EFF_HUNTER_PLAYER, 100, {src=self})
where all the hunters can get buffed with effects and talents, or supposedly….)

So, why the heck does the multiply code make no clones yet says it is used and gives no error? How do I make it work?

Log shows:

orb spinner 17379 dumb ai talents can use Multiply T_MULTIPLY
dumb ai uses T_MULTIPLY
[LOG] Orb spinner uses Multiply.
no more multiply
[LOG] Orb spinner uses Multiply.
no more multiply
no more multiply
[LOG] #00ff00##UID:65:0#Talent Infusion: Wild is ready to use.
[LOG]
[LOG] Orb spinner uses Multiply.
no more multiply
no more multiply


but I will be watching the screen, fight after fight, and there is no more enemy appearing. If I inspect an enemy it always has the talent and the number next to it increases each turn, which I think is the cooldown number but going the wrong direction???


fate weaver 17352 dumb ai talents can use Multiply T_MULTIPLY
fate weaver 17352 dumb ai talents can use Attack T_ATTACK
fate weaver 17352 dumb ai talents can use Rethread T_RETHREAD
dumb ai uses T_ATTACK
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
fate weaver 17352 dumb ai talents can use Multiply T_MULTIPLY
fate weaver 17352 dumb ai talents can use Rethread T_RETHREAD
fate weaver 17352 dumb ai talents can use Webs of Fate T_WEBS_OF_FATE
dumb ai uses T_MULTIPLY
[LOG] Fate weaver uses Multiply.
no more multiply
[LOG] Fate weaver uses Multiply.
no more multiply



okay this looks like error but in the game itself no lua popup:


[LOG] Rested for 75 turns (stop reason: all resources and life at maximum).
[LOG]
no more multiply
Astar fail: destination unreachable
no more multiply
Astar fail: destination unreachable
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
[TARGET] Passing target weaver hatchling from fate spinner to asd
[TARGET] Passing target weaver hatchling from fate spinner to asd
Astar fail: destination unreachable
fate weaver 17369 dumb ai talents can use Webs of Fate T_WEBS_OF_FATE
dumb ai uses T_WEBS_OF_FATE
Astar fail: destination unreachable
Astar fail: destination unreachable
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
Astar fail: destination unreachable
Astar fail: destination unreachable
Astar fail: destination unreachable
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
[TARGET] Passing target weaver hatchling from weaver hatchling to asd
[TARGET] Passing target weaver hatchling from weaver hatchling to asd
[TARGET] Passing target weaver hatchling from weaver hatchling to asd
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
no more multiply
fate weaver 17369 dumb ai talents can use Webs of Fate T_WEBS_OF_FATE
dumb ai uses T_WEBS_OF_FATE
[LOG] Orb spinner uses Multiply.
no more multiply
no more multiply
[LOG] Ran for 5 turns (stop reason: hostile spotted to the southeast (orb spinner)).
[LOG]
[PROFILE] Thread connecting to profiles.te4.org on ports 2257 2258
[LOG] Orb spinner uses Multiply.
no more multiply
[LOG] Orb weaver uses Multiply.
no more multiply
[LOG]
[PROFILE] Thread connecting to profiles.te4.org on ports 2257 2258
orb spinner 17377 dumb ai talents can use Temporal Bolt T_TEMPORAL_BOLT
orb spinner 17377 dumb ai talents can use Multiply T_MULTIPLY
orb spinner 17377 dumb ai talents can use Attack T_ATTACK
dumb ai uses T_ATTACK


This is the multiply talent code, unaltered in npcs.lua:

-- Multiply!!!
newTalent{
name = "Multiply",
type = {"other/other", 1},
cooldown = 3,
range = 10,
requires_target = true,
tactical = { ATTACK = 3 },
action = function(self, t)
if not self.can_multiply or self.can_multiply <= 0 then print("no more multiply") return nil end

-- Find space
local x, y = util.findFreeGrid(self.x, self.y, 1, true, {[Map.ACTOR]=true})
if not x then print("no free space") return nil end

-- Find a place around to clone
self.can_multiply = self.can_multiply - 1
local a
if self.clone_base then a = self.clone_base:clone() else a = self:clone() end
a.can_multiply = a.can_multiply - 1
a.energy.val = 0
a.exp_worth = 0.1
a.inven = {}
a.x, a.y = nil, nil
a:removeAllMOs()
a:removeTimedEffectsOnClone()
if a.can_multiply <= 0 then a:unlearnTalent(t.id) end

print("[MULTIPLY]", x, y, "::", game.level.map(x,y,Map.ACTOR))
print("[MULTIPLY]", a.can_multiply, "uids", self.uid,"=>",a.uid, "::", self.player, a.player)
game.zone:addEntity(game.level, a, "actor", x, y)
a:check("on_multiply", self)
return true
end,
info = function(self, t)
return ([[Multiply yourself!]])
end,
}

What have I missed this time?

twas Brillig
Wyrmic
Posts: 279
Joined: Sun Nov 30, 2014 9:06 pm

Re: SAYS it is multiplying so why is there no clone?

#2 Post by twas Brillig »

Per the source for multiply:
if not self.can_multiply or self.can_multiply <= 0 then print("no more multiply") return nil end
This debug statement will print if something tries to use the talent when its can_multiply value is non-existent or <=0. This is the sort of logic you'd want to include in paradox clone to keep it from growing out of control (slightly modified depending on whether you want the clones to multiply at all).

xnd
Archmage
Posts: 307
Joined: Sat Mar 21, 2015 7:33 pm

Re: SAYS it is multiplying so why is there no clone?

#3 Post by xnd »

yeah i know that, but what if that's causing the problem?

If I cant get the Multiply talent to work when it SAYS it is working and I have not altered it at all, and it additionally spams the log with "no more multiply", then putting that it in paradox clone is copying a problem?

the Multiply should be making clones and not doing whatever weird bug is happening.

==>> When it says "[LOG] Orb spinner uses Multiply.", that is a lie! no clones happen! and why the talent cooldown keeps increasing instead of decreasing, if that is what that number means, something is wrong here.

Frumple
Sher'Tul Godslayer
Posts: 1517
Joined: Sat May 15, 2010 9:17 pm

Re: SAYS it is multiplying so why is there no clone?

#4 Post by Frumple »

... as brill notes, you'd put "can_multiply = X,", where X is whatever number of clones you want to allow, in the orb spinner's code. Check the vermin npc and the worms to see how it works.

twas Brillig
Wyrmic
Posts: 279
Joined: Sun Nov 30, 2014 9:06 pm

Re: SAYS it is multiplying so why is there no clone?

#5 Post by twas Brillig »

fakeedit: Frumps got in ahead of me before I could post this, but to expand on that a little:

Sorry, I'm not sure I understand what you're doing so I'm going to try and restate that: that line will trigger, printing the "no more multiply line" and stopping the function before the entity can multiply, if and only if one of two things is true. Either:
  • "not self.can_multiply" : can_multiply is an integer if it has been defined for an object. Otherwise it is nil, a non-value, which will evaluate to false. "not self.can_multiply" will be true, triggering the line, if a creature hasn't had self.can_multiply defined. Do you ever give the spiders a value for can_multiply?
  • "self.can_multiply <= 0" : if can_multiply has been defined, then successfully multiplying will decrement it for the original monster and the clone. If you are defining can_multiply, are you setting it to a value greater than or equal to 1? (side note: you probably don't want to use this code directly, because you'll have weird interactions when cloning creatures that can use the multiply talent)
"Using" multiply would more accurately be "tries to use multiply" or something similar, but it's just the default log line. It is unusual that the talent will let itself be used when it will fail (contrast trying to use a weapon talent when unarmed), but it isn't saying it's working just that the spiders are trying to use the talent. The issue isn't that you haven't altered the multiply talent, but that you haven't also modified the spiders to be able to multiply.

In general, if a function doesn't do what you expect it to do, it's good to step through the documentation and make sure all your assumptions are correct, and it has all the conditions it needs to work properly. Most libraries will have documentation pages, wikis, help files, etc. Since ToME doesn't have that, to my knowledge, you'll often need to go the function's source code and check the logic (and hopefully comments) directly.

Dienes
Wayist
Posts: 27
Joined: Wed Jan 07, 2015 7:51 pm

Re: SAYS it is multiplying so why is there no clone?

#6 Post by Dienes »

xnd wrote:yeah i know that, but what if that's causing the problem?

If I cant get the Multiply talent to work when it SAYS it is working and I have not altered it at all, and it additionally spams the log with "no more multiply", then putting that it in paradox clone is copying a problem?

the Multiply should be making clones and not doing whatever weird bug is happening.

==>> When it says "[LOG] Orb spinner uses Multiply.", that is a lie! no clones happen! and why the talent cooldown keeps increasing instead of decreasing, if that is what that number means, something is wrong here.
There is no bug with multiply. And the debug statement is not a lie. It used Multiply. The log says
[LOG] Orb spinner uses Multiply.
no more multiply
So it uses multiply and then the first line of the talent is

Code: Select all

if not self.can_multiply or self.can_multiply <= 0 then print("no more multiply") return nil end
Orb spinners don't have can_multiply defined so it defaults to 0. When the talent is called it evaluates that to true and returns without creating a copy. When you add Multiply to the orb spinner also set can_multiply to a number greater than 0 so it can actually make copies.

Edit: Failed to see I was beaten twice.

xnd
Archmage
Posts: 307
Joined: Sat Mar 21, 2015 7:33 pm

Re: SAYS it is multiplying so why is there no clone?

#7 Post by xnd »

thanks, well i'll see if I can add it.


i did look in vermin and saw like


newEntity{ base = "BASE_NPC_WORM",
name = "white worm mass", color=colors.WHITE,
level_range = {1, 15}, exp_worth = 1,
rarity = 1,
max_life = resolvers.rngavg(5,9),
combat = { dam=1, atk=0, apr=100 },

resolvers.talents{ [Talents.T_CRAWL_POISON]=1, [Talents.T_MULTIPLY]=1 },
}

but failed to notice it was put up in the

newEntity{
define_as = "BASE_NPC_WORM",
type = "vermin", subtype = "worms",
display = "w", color=colors.WHITE,
can_multiply = 4,


--

so re:
"(side note: you probably don't want to use this code directly, because you'll have weird interactions when cloning creatures that can use the multiply talent)"

if something is cloned then it multiplies, or multiplies then gets cloned, wouldn't it just stop the multiplying, as usual? Like if the worm mass got cloned, that could happen in the game as is already, right? like inner demons or something could do it?


---

well this doesnt do it, just sticking it in like this:

actor:setEffect(actor.EFF_HEROISM, getAnomalyDuration(self, t)*1000000, {power=getAnomalyEffectPower(self, t)})
actor:setEffect(actor.EFF_DEFENSIVE_MANEUVER, getAnomalyDuration(self, t)*1000000, {power=getAnomalyEffectPower(self, t)})
can_multiply = 4
actor:learnTalent(actor.T_MULTIPLY, true)
actor:forceUseTalent(actor.T_MULTIPLY, {ignore_energy=true})

but trying some other things i get errors saying the = should be a function. this way loads but they still think they are multiplying while not doing so.

how do I insert the can_multiply in a list like this?

--

and with the paradox clone option, would this line i see in temporal fugue be enough to shut down the infinite series?
remove_on_clone = true,

xnd
Archmage
Posts: 307
Joined: Sat Mar 21, 2015 7:33 pm

Re: SAYS it is multiplying so why is there no clone?

#8 Post by xnd »

yeah, just adding
remove_on_clone = true,
does not remove it from the clone, dont know what it does, if only it were that simple.


so what does that line do in fugue, or what needs to be added with it?

instead of
on_pre_use = function(self, t, silent) if self:hasEffect(self.EFF_TEMPORAL_FUGUE) then return false end return true end,
can I add some designator, like a password, set onto the clone and if on_pre_use checks and sees that, it wont use the clone talent, itself?

i suppose I could make an effect which could be handy but ha everything i try seems to open its own can of worms....

xnd
Archmage
Posts: 307
Joined: Sat Mar 21, 2015 7:33 pm

Re: SAYS it is multiplying so why is there no clone?

#9 Post by xnd »

i've tried this, with the code, in red below, or versions of it, but they seem to not do anything. inspect creature still shows the talent there and it still gets used.


newTalent{
name = "Second Self",
short_name = "SECOND_SELF",
type = {"chronomancy/other", 1},
points = 5,
paradox = function (self, t) return getParadoxCost(self, t, 50) end,
cooldown = 50,
tactical = { ATTACK = 1, DISABLE = 2 },
remove_on_clone = true,
range = 2,
requires_target = true,
no_pc_use = true,
getDuration = function(self, t) return math.floor(self:combatTalentLimit(t, 50, 50, 50)) end, -- Limit <50
getModifier = function(self, t) return rng.range(t.getDuration(self,t)*2, t.getDuration(self, t)*4) end,
--on_pre_use = function(self, t, silent) if self:hasEffect(self.EFF_SECOND_SELF) then return false end return true end,
action = function (self, t)
local tg = self:getTalentTarget(t)
local x, y = util.findFreeGrid(self.x, self.y, 3, true, {[Map.ACTOR]=true})
if not x then
return
end

local sex = game.player.female and "she" or "he"
local m = require("mod.class.NPC").new(self:cloneFull{
no_drops = true, keep_inven_on_death = false,
faction = self.faction,
summoner = self, summoner_gain_exp=true,
exp_worth = 1,
summon_time = t.getDuration(self, t),
ai_target = {actor=nil},
ai = "summoned", ai_real = "tactical",
ai_tactic = resolvers.tactic("ranged"), ai_state = { talent_in=1, ally_compassion=10},
desc = [[The real one... or so ]]..sex..[[ says.]]
})
m:removeAllMOs()
m:unlearnTalent(self.T_SECOND_SELF)
m.make_escort = nil
m.on_added_to_level = nil

m.energy.value = 0
m.player = nil
m.puuid = nil
m.max_life = m.max_life
m.life = util.bound(m.life, 0, m.max_life)
m.forceLevelup = function() end
m.die = nil
m.on_die = nil
m.on_acquire_target = nil
m.seen_by = nil
m.can_talk = nil
m.on_takehit = nil
m.no_inventory_access = true
m.clone_on_hit = nil
m.remove_from_party_on_death = true

-- Remove some talents
local tids = {}
for tid, _ in pairs(m.talents) do
local t = m:getTalentFromId(tid)
if t.no_npc_use then tids[#tids+1] = t end
end
for i, t in ipairs(tids) do
m.talents[t.id] = nil
end

game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "temporal_teleport")
game:playSoundNear(self, "talents/teleport")

if game.party:hasMember(self) then
game.party:addMember(m, {
control="no",
type="minion",
title="Paradox Clone",
orders = {target=true},
})
end


end,
info = function(self, t)
local duration = t.getDuration(self, t)
return ([[A temporal clone of yourself joins you in battle.]]):format(duration)
end,
}


--
when this talent makes a clone, i want the talent to make this talent unlearned on the clone, and I looked at some code where talents are told to be unlearned but I seem to be missing something of course.

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

Re: SAYS it is multiplying so why is there no clone?

#10 Post by HousePet »

Don't use unlearnTalent.

Use m.talents[self.T_SECOND_SELF] = nil instead.
My feedback meter decays into coding. Give me feedback and I make mods.

xnd
Archmage
Posts: 307
Joined: Sat Mar 21, 2015 7:33 pm

Re: SAYS it is multiplying so why is there no clone?

#11 Post by xnd »

thanks, but actually I made good progress by doing this:


in second self talent added:

on_pre_use = function(self, t, silent) if self:hasEffect(self.EFF_HUNTER_PLAYER) then return false end return true end,

and in the hunter talent added the unlearn right after the learn and forceuse:


newTalent{
name = "They Call Others To Help Them",
short_name = "X_HUNTED",
type = {"race/Chrono_Xorn", 3},
image = "talents/skirmisher_sling_sniper.png",
mode = "passive",
no_unlearn_last = true,
getHaste = function(self, t) return 1 - 1 / (1 + (getAnomalyEffectPower(self, t)) / 100) end,
callbackOnActBase = function(self, t)
if not rng.percent(100 + self.level / 7) then return end

local rad = math.ceil(10 + self.level / 5)
for i = self.x - rad, self.x + rad do for j = self.y - rad, self.y + rad do if game.level.map:isBound(i, j) then
local actor = game.level.map(i, j, game.level.map.ACTOR)
if actor and self:reactionToward(actor) < 0 and not actor:attr("hunted_difficulty_immune") then
actor:learnTalent(actor.T_SECOND_SELF, true)
actor:forceUseTalent(actor.T_SECOND_SELF, {ignore_energy=true})
actor:unlearnTalent(actor.T_SECOND_SELF)
-- must be before hunter effect is added because second self talent looks for that effect to not clone again if has that
end
end end end
local rad = math.ceil(10 + self.level / 5)
for i = self.x - rad, self.x + rad do for j = self.y - rad, self.y + rad do if game.level.map:isBound(i, j) then
local actor = game.level.map(i, j, game.level.map.ACTOR)
if actor and self:reactionToward(actor) < 0 and not actor:attr("hunted_difficulty_immune") then
actor:setEffect(actor.EFF_HUNTER_PLAYER, 100, {src=self})
actor:setEffect(actor.EFF_SPEED, getAnomalyDuration(self, t)*1000000, {power=t.getHaste(self, t)})
actor:setEffect(actor.EFF_REGENERATION, getAnomalyDuration(self, t)*1000000, {power=getAnomalyEffectPower(self, t)})
actor:setEffect(actor.EFF_PAIN_SUPPRESSION, getAnomalyDuration(self, t)*1000000, {power=getAnomalyEffectPower(self, t)})
actor:setEffect(actor.EFF_HEROISM, getAnomalyDuration(self, t)*1000000, {power=getAnomalyEffectPower(self, t)})
actor:setEffect(actor.EFF_DEFENSIVE_MANEUVER, getAnomalyDuration(self, t)*1000000, {power=getAnomalyEffectPower(self, t)})

end
end end end
end,
info = function(self, t) return ([[The enemy responds to your intimidating arsenal by calling for help. They will try to take you down together!
There is a %d%% chance each turn that all foes in a %d radius get a glimpse of your position for 100 turns. Straddling two timelines with your dual-self causes you to fight two of each opponent! They come prepared!]]):
format(100 + self.level / 7, 10 + self.level / 5, getAnomalyDuration(self, t))
end,
}

so, it finds them, adds the talent, forces its use, unlearns it from them, then searches then adds the hunter player effect to all it finds, the originals plus the clones, then next round when the hunter talent searches, any who second_self sees already have hunter will not get cloned. This seems to have solved the issue so that everyone is only cloned once and it stops at that.

The problem remaining is the hunter talent searches each round and I can feel it lagging, it adds the buff effects each time to those who already have it, so i need to make it so it doesn't.

thats one concern with my codes is even if i get stuff to work, i may be doing it in such a clunky manner that is more ram or cpu use.

Post Reply