Page 3 of 4

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 1:04 am
by elcapitan
Thanks for looking into these.
I am aware that some may be of low priority / not yet to be looked, just reporting from a progression point of view and hopefully thoroughly :)
Feel free to pick and choose the more important notes first. :D

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 10:21 am
by Moldew
Hehe, no worries. Was a fun distraction, with a possible stopgap! Thanks! :)

Now back to the gnomes...they always got something going on...

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 10:53 am
by Jakkal
I was actually hoping that the devs would make a better animation function, something that loops them easier (like we set the time the animation takes from start to finish) and it automatically loops them. And then we can start/stop it as need be.

I just feel like alternatives are a kludge that will end up needing replaced down the line. Though I might be a little timid on this subject since I've spent the last couple of years replacing/fixing kludge scripts.

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 10:59 am
by OncaLupe
I don't remember what causes the DEBUG - Error, I'd have to see the exact error to try and track it down.
Jakkal wrote: Mon Mar 05, 2018 6:15 pmBut it seems like the problem was that once combat turned off callbacks, all callbacks would be off from then on until the mob respawned. This was trouble for any mob that had to do something when it died or if it was leashed, or the player died.
What was happening was if a mob was in combat, any callbacks that were on that mob were removed. It didn't disable callbacks completely, but without any running callbacks there was no real way to restart them. I removed that a month or so ago, so callbacks work as expected now and the Lua script has to check if the mob is in combat if needed.
Moldew wrote: Mon Mar 05, 2018 10:27 pm My thought was to instead of putting NPC_01 into a loop like we've been doing with multiple callbacks, only do an animation if NPC is not in combat then callback to spawn().
Please do NOT call spawn() yourself. The point of that function is that it's only called once when the mob actually spawns. If you need something to happen on spawn as well as later, put that into another function and call that instead.
Moldew wrote: Mon Mar 05, 2018 11:10 pmNote: I tested with InCombat() instead of IsInCombat(). Don't think InCombat() is written, or even will be.
InCombat() is a function to change the NPCs combat state, it's not a check. If a function doesn't have a wiki page, please check with a dev before trying to use it.

As for the animation cycling and avoiding it in combat, I did some testing on my local server. This works perfectly for the Hobgoblin mobs taunting Koi Le. I didn't duplicate the debug error, but I'm not sure if that's from this setup not causing it, or something else:

Code: Select all

local ANIMATION_TEASE = 400145
local ANIMATION_LAUGH = 400074
local ANIMATION_NEENER = 400080
local ANIMATION_TAUNT = 400027

function spawn(Npc)
    AddSpawnCallback(Npc, "Animate", 3.0)
end

function Animate(Npc)
    if not IsInCombat(Npc) then
        choice = math.random(1,4)
        if choice == 1 then
            PlayNonCombatAnimation(Npc, ANIMATION_TEASE)
        elseif choice == 2 then
            PlayNonCombatAnimation(Npc, ANIMATION_LAUGH)
        elseif choice == 3 then
            PlayNonCombatAnimation(Npc, ANIMATION_NEENER)
        elseif choice == 4 then
            PlayNonCombatAnimation(Npc, ANIMATION_TAUNT)
        end
    end
	
    local timer = math.random(2,6)
    AddSpawnCallback(Npc, "Animate", timer)
end

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 12:52 pm
by Jakkal
Great, now the world knows I named that Animation "NEENER".

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 1:02 pm
by Moldew
Hmmm, that's how I did it the first attempt. (if not IsInCombat then do some animations stuff else don't) I still got the error eventually, just not as frequently. However, I did have the clears in, maybe should take them out?

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 1:53 pm
by Moldew
I redid my tester gnome and removed the clears. Works like a charm. No errors yet, but she does sneak in an animation once in a while in the first seconds of the fight. Sometimes need to get 3-6 secs into the fight for them to stop. I think that's fine personally. Also, got a "you cannot cancel that effect" message well after the fight was over.

Re: Checking Through Starter Towns

Posted: Tue Mar 06, 2018 7:24 pm
by OncaLupe
I don't know why you're setting a new callback within the Animate() function. You're controlling the delay with the Animate callback, so adding another one instead of just directly calling the function is just extra work on the server. And that accounts for the NPC playing animations within the first few seconds of combat, as that callback is already running.

However that's a moot point now as I've made functions to setup animation loops on the server, so just one line is now needed:
https://www.vgoemulator.net/phpBB3/view ... =26&t=4261

Re: Checking Through Starter Towns

Posted: Wed Mar 07, 2018 10:03 pm
by Moldew
Good enough. I'll just check out of this thread.

Re: Checking Through Starter Towns

Posted: Fri Mar 09, 2018 4:14 am
by elcapitan
Minor Issues
- Harvesting a tree does this weird fast tiny shakes that persist for a bit after finishing. Gives your screen a buzz feel :P
- Quest 7539 it is meant to give you a pet veteran but it doesn't :P
- Slappy's Whistle, animation is delayed. Probably more than one song cycle would be nice when you activate it :)
- Quest 7510 I remember Taejin being hard, but I have tried different strategies, can't get past his card set :( nvm, finally got him :)
- Quest 7814 the monks set out to attack the ulvari, they simulate combat on the ulvari in the burned village. but the ulvari just stand there take no damage :P