Jump to content

How do you make an inception/modifier get destroyed the moment the player ends their turn?


Playr10

Recommended Posts

I've been messing around with

[ EVENT.END_TURN ] = function( self, minigame, negotiator )
                if negotiator == self.negotiator then
                    self.anti_negotiator:RemoveModifier("PANG", 99, self)
                end

and several other different variations, but I can't get the inception to disappear before the enemy's turn starts

Weird question, just checking because I fell prey to this mistake before, but if the file is loading with no crashes yet the event function isn't showing any signs of working... did you remember to put the event_handlers = { } wrapper around your event functions?

Also, if you want to make all of a specific modifier go away, instead of putting in 99 for the stacks (which I don't actually know if it will cause unintended behavior or not) you can instead plug self.anti_negotiator:GetModifierStacks("PANG") into the function.

EDIT: Or is the issue that it's not happening fast enough? I don't know why it wouldn't. Tried [ EVENT.END_PLAYER_TURN ] = function( self, minigame )?

This is with

[ EVENT.END_TURN ] = function( self, minigame, negotiator )
                if negotiator == self.negotiator then
                    self.negotiator:RemoveModifier("PANG", 99, self)
                end
            end,
underneath PANG

This is with
[ EVENT.END_PLAYER_TURN ] = function( self, minigame, negotiator )
                if negotiator == self.negotiator then
                    self.anti_negotiator:RemoveModifier("PANG", 99, self)
                end
            end,
under Core Argument, but it did nothing and Pang's code removed itself instead
through testing, it seems that END_PLAYER_TURN doesn't work at all in either spots, and won't remove Pang no matter what.

If you put that code under pang, since it is an inception, the negotiator of it is the opponent rather than you. However, you want it to remove it at the end of player turn, so you need to do something like this:

[EVENT.END_TURN] = function(self, minigame, negotiator)
  if negotiator == self.anti_negotiator then
    self.negotiator:RemoveModifier(self)
  end
end

and put it under the pang code.

note: RemoveModifier can take a modifier instance instead of a string, and it will remove that modifier instance by the amount of stacks provided, or remove all stacks on that modifier, removing it completely in the process.

You can add a priority so that it is executed the last. Something like

event_priorities =
{
    [ EVENT.END_TURN ] = 99,
},

under the modifier def. If you want it executed first, then set it to -99 or some low values.

however, if you want it only apply to cards, you can do something like this:

[ EVENT.CALC_PERSUASION ] = function( self, source, persuasion )
	if is_instance( source, Negotiation.Card ) then
		-- something happens
	end
end,

 

So I'll need my arguments to also be based off an event to move it's priority below removing Pang right? When I replaced OnEndTurn with

[EVENT.END_TURN] = function(self, minigame )
                self:ApplyPersuasion()
end,

it doesn't even activate anymore and I'm not sure why

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...