objects created by the player do not act if player acts

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

objects created by the player do not act if player acts

#1 Post by marvalis »

Right...

I noticed how certain skill effects 'lag' behind the player. If the player has faster move speed (or attack speed, or whatever), then the object does not act when the player acts, causing it to lag behind.

caused by:

Code: Select all

		Object.new{
			...
			act = function(self)
				self:useEnergy()
				...
			end,
		}
and:

Code: Select all

		-- Add a lasting map effect
		game.level.map:addEffect(...)
Solution: no idea, I am looking. Would be nice if we could add an object, effect, or particle to the player with a timer and make it act whenever the player acts.

At least this is what I think happens.. I could be wrong.

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: objects created by the player do not act if player acts

#2 Post by edge2054 »

Timed effects on the player tic when the player acts. You could probably link an object to the player like this so it goes every time the timed effect tics (on_timeout) and then disappears when the timed effect expires (deactivate). But the effect would be dependent on the player going unless you over rode it in actor (like Thunderstorm does).

Otherwise objects created by the player act on their turn, they're separate actors at this point and I don't really see how that's a bug. It's no different then summons having their own energy values.

*edit* Another idea is to borrow from the Thunderstorm code again and create a trigger that only goes when you act that forces another actor to do something, the other actor being the created object.

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: objects created by the player do not act if player acts

#3 Post by marvalis »

The timed effect hack works but the thunderstorm method is better.
/edit damned, only works for maintained skills ... got to find an way of doing it for activated skills.. damned.
/edit again: Meh nevermind I can solve it. Thanks

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: objects created by the player do not act if player acts

#4 Post by edge2054 »

What do you mean it doesn't work for an active skill?

If the active skill only lasts so long just do a dummy timed effect and have the trigger check to see if the timed effect is going.

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: objects created by the player do not act if player acts

#5 Post by marvalis »

Yeh most code would check for an active maintained skill, so I could not reuse that code.
Instead, I would have the trigger check for cooldown of the skill (then calculate the number of turns it has been in effect based on cooldown and duration to see if it is still 'active').
But then I still can't set a particle effect... and remove it after x turns.
Unless I use a timed effect for the particle effect. But I don't like that. But that is how it is until i figure out how to set a particle effect with cooldown even if that requires making a new function in the engine.
But whatever not for now, getting sleepy and I can't focus anymore lol.


/edit

What I will have to do, is put something like the code for temporary effects in player.lua, and code function for the creation of special objects that are coded different from normal objects, and only act when the code in player.lua is triggered. This would allow you to create _any_ object with whatever properties, including particle effects and whatsnot. Ideally, you would even be able to trigger actions. I think objects can do this since the player is an object? Whatever, ill have to dig deep.

And off course, the entire point of this all is to add a duration to the object, and make it act when the player acts. You could then make this object have the same x, y as the player so it looks like the effect is on the player. You could also make an object that acts when the player acts but uses a variety of spells and moves by its own, or whatever.

I just wanted to add a particle emitter and an area spell for x turns xD (centered on the player, that moves with the player).

I might do something much more simple, and just add a function for a temporary particle emitter. Also, do we have a turn counter?

Post Reply