Page 1 of 1
Delayed action states
Posted: Mon Dec 02, 2013 7:39 pm
by Jabantiz
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);
}
Re: Delayed action states
Posted: Thu Dec 05, 2013 2:59 pm
by alfa
Jab, that mean KB annim cannot have more than 5 seconds ? Or should be 5 sec timer all the time ?
Re: Delayed action states
Posted: Thu Dec 05, 2013 3:02 pm
by Jabantiz
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.
Re: Delayed action states
Posted: Thu Dec 05, 2013 3:05 pm
by alfa
Ok, and what about KB control ?? It's client side ? And water cancellation for KB ?
Re: Delayed action states
Posted: Thu Dec 05, 2013 3:16 pm
by Jabantiz
Haven't tested it but it should be client side, only found the 1 packet related to knockback so far.
Re: Delayed action states
Posted: Fri Dec 06, 2013 7:19 am
by John Adams
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.
Re: Delayed action states
Posted: Fri Dec 06, 2013 8:22 am
by Jabantiz
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.
Re: Delayed action states
Posted: Fri Dec 06, 2013 8:52 am
by John Adams
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.

Re: Delayed action states
Posted: Fri Dec 06, 2013 8:58 am
by Jabantiz
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.
Re: Delayed action states
Posted: Fri Dec 06, 2013 9:17 am
by John Adams
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.
Re: Delayed action states
Posted: Fri Dec 06, 2013 9:40 am
by Zcoretri
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

Re: Delayed action states
Posted: Fri Dec 06, 2013 12:29 pm
by Jabantiz
spell_visual can effect both the caster and target
Re: Delayed action states
Posted: Fri Dec 06, 2013 12:57 pm
by John Adams
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`
Re: Delayed action states
Posted: Fri Dec 06, 2013 4:33 pm
by Jabantiz
Committed code so Knockdown will not do animations if used in a spell script