Delayed action states

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Delayed action states

Post by Jabantiz » Mon Dec 02, 2013 7:39 pm

Working on knockbacks I noticed it is actually a group of 3 visual states to get every thing looking right, 1 going off as soon as the previous one finishes. I ran into a similar issue with loot chests but was able to cheat with out it looking to bad, can't cheat in this case.

There is a new struct TimedAction

Code: Select all

struct TimedAction {
	int32 spawn_id;
	int32 action_id;
};
spawn_id = the spawn to apply the action state to
action_id = the action to apply (from the visual_states table in the DB)

Finally you will call ZoneServer::AddTimedAction(TimedAction* action, int32 time), time is when you want the action to go off in milliseconds, so if you want the action to go off in 1 sec you would pass 1000.

Here is an example for knockdown

Code: Select all

			Spawn* spawn = client->GetPlayer()->GetTarget();
			if (spawn) {
				// Start the knockdown animation
				spawn->SetTempActionState(11767);

				// After 1 sec switch to the idle
				TimedAction* act1 = new TimedAction();
				act1->spawn_id = spawn->GetID();
				act1->action_id = 11769;
				client->GetCurrentZone()->AddTimedAction(act1, 1000);

				// After 1 sec in idle switch to get up (2 seconds from now)
				TimedAction* act2 = new TimedAction();
				act2->spawn_id = spawn->GetID();
				act2->action_id = 11768;
				client->GetCurrentZone()->AddTimedAction(act2, 2000);

				// After 3 sec for the get up animation clear the action states (5 seconds from now)
				TimedAction* act3 = new TimedAction();
				act3->spawn_id = spawn->GetID();
				act3->action_id = -1;
				client->GetCurrentZone()->AddTimedAction(act3, 5000);

			}
Last edited by Jabantiz on Mon Dec 02, 2013 8:00 pm, edited 1 time in total.
Reason: Fixed typo

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Delayed action states

Post by alfa » Thu Dec 05, 2013 2:59 pm

Jab, that mean KB annim cannot have more than 5 seconds ? Or should be 5 sec timer all the time ?
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Delayed action states

Post by Jabantiz » Thu Dec 05, 2013 3:02 pm

It can be as long as you want, that was just an example, the idle animation can be anything, it is just laying on the ground motionless, to be knocked on to the back needs at least 4 seconds though, 1 second for the knocked back animation and 3 seconds for the get up animation. The Knockback lua function will determine animation times for you just set the time parameter properly.

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Delayed action states

Post by alfa » Thu Dec 05, 2013 3:05 pm

Ok, and what about KB control ?? It's client side ? And water cancellation for KB ?
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Delayed action states

Post by Jabantiz » Thu Dec 05, 2013 3:16 pm

Haven't tested it but it should be client side, only found the 1 packet related to knockback so far.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Delayed action states

Post by John Adams » Fri Dec 06, 2013 7:19 am

Curious (again), if the spell_visual for the Guardian "Bash" is 1231 (knockdown), why does LUA need to handle the visual? There are many different forms of Knockback/Knockdown if you go to the Lookup Visual and search for the words, so hard-coding it to a specific effect may not be best.

Shouldn't the spell_visual handle the visual effect of knocking them down? The function Knockback() actually handling the fact they cannot continue fighting if they are currently knocked down?

Edit: Let me be precise, I mean Knockback() function does far more than stifle combat :) but I mean, it shouldn't handle the spell's visual effect. I should be able to pass any visual i want.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Delayed action states

Post by Jabantiz » Fri Dec 06, 2013 8:22 am

Doing it with visual_states allows this to be used anywhere, I can easily change it so that visual_states are not used if the function was called from a spell script.

And no this function does not handle stifle/stun components, just the animation and packets.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Delayed action states

Post by John Adams » Fri Dec 06, 2013 8:52 am

Hmm, if the spell's visual ID also handles the visual effect, I'm not seeing the point.

I was under the impression this magical new packet handled throwing people around the terrain :) Maybe that was another discussion. :oops:

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Delayed action states

Post by Jabantiz » Fri Dec 06, 2013 8:58 am

It does toss the player around, if you provide the right params. Again this is not a spell only function you can put it in a spawn script for AI or just when they are hailed

Example, this will toss the player back and play the animation when they hail the NPC

Code: Select all

function hailed(NPC, Spawn)
	Knockback(NPC, Spawn, 5000, -8, 15)
end
I can have the animation portion only function when not in a spell script though, allowing the spell visual to do the animation.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Delayed action states

Post by John Adams » Fri Dec 06, 2013 9:17 am

Jabantiz wrote:I can have the animation portion only function when not in a spell script though, allowing the spell visual to do the animation.
That will probably be best, since the spell visual needs to be whatever I choose it to be, and not something selected in code. Specifically, for spells. We also do not want 2 animations going off at once; one for the spell cast and one for the effect.

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Delayed action states

Post by Zcoretri » Fri Dec 06, 2013 9:40 am

I thought the spell_visual is for caster only? It is a visual animation the caster does when casting the spell/combat art, it has nothing to do with a 'knockback' animation landing on the NPC, that would be handled by visual_states. Or am I confused now, lol :mrgreen:

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Delayed action states

Post by Jabantiz » Fri Dec 06, 2013 12:29 pm

spell_visual can effect both the caster and target

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Delayed action states

Post by John Adams » Fri Dec 06, 2013 12:57 pm

My Bash spell has that ID in the spell, and when I Bash an Orc, he falls back, lands on the ground, sits up, shakes his head and gets up even more pissed off than he was before.

I am pretty sure "spell_visual" id's, found in reference_spell_effects, probably cross-ref to `visual_states` data in some way, just never spent the time comparing the tables. They are both separate .dat files in the .vpl, so I concluded they were different.

Code: Select all

app_state.dat  - `visual states`
appearance.dat - `appearances`
spellcast.dat  - `reference_spell_effects`

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Delayed action states

Post by Jabantiz » Fri Dec 06, 2013 4:33 pm

Committed code so Knockdown will not do animations if used in a spell script

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests