ACP and ASA

User avatar
DanteMccloud
Posts: 25
Joined: Wed May 04, 2016 10:53 pm

Re: ACP and ASA

Post by DanteMccloud » Wed Jun 01, 2016 7:08 pm

kjLotus wrote:npc:timer
oh nice I didn't know that was even a thing haha. I'll have to look around and see if I can find anything using it so i can get a better idea of how it works thank you ^.^
Expedition Gaming
IP Address: expeditiongaming.ddns.net
Server Forums: https://expeditiongaming.ga/forum/index.php
Discord: https://discord.gg/5kJbxCF
Facebook is https://www.facebook.com/groups/1749730585295430
I host an array of game servers from FFXI (pre Abyssea), Tera, Arma3, FFXIV, SWG (pre-CU), BDO (v491)

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: ACP and ASA

Post by kjLotus » Wed Jun 01, 2016 7:31 pm

i don't think anything is using it.. but it just takes time (in ms) as the first param and the function (probably a closure) as the second param

User avatar
DanteMccloud
Posts: 25
Joined: Wed May 04, 2016 10:53 pm

Re: ACP and ASA

Post by DanteMccloud » Wed Jun 01, 2016 9:47 pm

kjLotus wrote:i don't think anything is using it.. but it just takes time (in ms) as the first param and the function (probably a closure) as the second param
haha I think I'm using it majorly wrong or something as every variation I've tried just crashes the server :oops: I'll keep playing with it though.

I was hoping to find something using it as then I could pick it apart and learn how that works and such,

Code: Select all

local MandyTest = SpawnMob(-----)

    npc:timer(10000,MandyTest); --This would spawn that monster in 10seconds? 
Or am I way off haha?

so sorry for bugging you with these questions kjLotus, ty for all the help so far though I can't wait to have it working and share ^.^ having a delay/wait function like this will open SO many doors for projects I've been working on in the server. All tiny things but things none the less haha.

Does DSP support LUA 5.2 ? Or any of the windower lua handles?
Last edited by DanteMccloud on Thu Jun 02, 2016 2:09 pm, edited 1 time in total.
Expedition Gaming
IP Address: expeditiongaming.ddns.net
Server Forums: https://expeditiongaming.ga/forum/index.php
Discord: https://discord.gg/5kJbxCF
Facebook is https://www.facebook.com/groups/1749730585295430
I host an array of game servers from FFXI (pre Abyssea), Tera, Arma3, FFXIV, SWG (pre-CU), BDO (v491)

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: ACP and ASA

Post by kjLotus » Thu Jun 02, 2016 12:03 am

Code: Select all

local trader = player
npc:timer(1000, function(npc) 
    SpawnMob(whatever):updateClaim(trader) 
end )
no to 5.2 or windower stuff (our lua was around long before windowers)

User avatar
DanteMccloud
Posts: 25
Joined: Wed May 04, 2016 10:53 pm

Re: ACP and ASA

Post by DanteMccloud » Thu Jun 02, 2016 4:02 pm

kjLotus wrote:

Code: Select all

local trader = player
npc:timer(1000, function(npc) 
    SpawnMob(whatever):updateClaim(trader) 
end )
Thanks Mate!! you are a life saver that seems to be working well, now to just fine tune what i have to work right 100% of the time ^.^

fun note this function HATES :updateClaim() it dies and crashes the server something about line 6081 in Lua_baseentity.cpp way beyond me on why but thought I'd let you know in case you happened to see or know why haha.

"Unhandled exception at 0x01021D4C in DSGame-server.exe: 0xC0000005: Access violation reading location 0xCCCCCCD8."

Code: Select all

/************************************************************************
*                                                                       *
*  updates enmity and claims monster                                    *
*                                                                       *
************************************************************************/

inline int32 CLuaBaseEntity::updateClaim(lua_State *L)
{
    DSP_DEBUG_BREAK_IF(m_PBaseEntity == NULL);
    DSP_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_MOB);

    //DSP_DEBUG_BREAK_IF(lua_gettop(L) > 1);
    DSP_DEBUG_BREAK_IF(lua_isnil(L, 1) || !lua_isuserdata(L, 1));

    CLuaBaseEntity* PEntity = Lunar<CLuaBaseEntity>::check(L, 1);

    if (PEntity != NULL &&    /*-----------------BREAKS HERE when running debug-----------------*/
        PEntity->GetBaseEntity()->objtype != TYPE_NPC)
    {
        battleutils::ClaimMob((CMobEntity*)m_PBaseEntity, (CBattleEntity*)PEntity->GetBaseEntity());
    }
    return 0;
}
Expedition Gaming
IP Address: expeditiongaming.ddns.net
Server Forums: https://expeditiongaming.ga/forum/index.php
Discord: https://discord.gg/5kJbxCF
Facebook is https://www.facebook.com/groups/1749730585295430
I host an array of game servers from FFXI (pre Abyssea), Tera, Arma3, FFXIV, SWG (pre-CU), BDO (v491)

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: ACP and ASA

Post by kjLotus » Thu Jun 02, 2016 7:54 pm

oh yeah, i was hoping the assignment to a local would get around that but I guess not (you can't use a parameter passed into the on(whatever) functions in a closure since it gets destructed immediately after)

normally you could use getTarget or something like that to get it back...
anyways, you'll have to instantiate a new CLuaBaseEntity instead of that assignment - i think you might be able to do local target = CLuaBaseEntity.new(trader), but i have never tried that, and the syntax might be wrong (or entirely impossible)

it's a common use case so i'll have to look into it later if it doesn't work

User avatar
DanteMccloud
Posts: 25
Joined: Wed May 04, 2016 10:53 pm

Re: ACP and ASA

Post by DanteMccloud » Thu Jun 02, 2016 8:54 pm

kjLotus wrote:oh yeah, i was hoping the assignment to a local would get around that but I guess not (you can't use a parameter passed into the on(whatever) functions in a closure since it gets destructed immediately after)

normally you could use getTarget or something like that to get it back...
anyways, you'll have to instantiate a new CLuaBaseEntity instead of that assignment - i think you might be able to do local target = CLuaBaseEntity.new(trader), but i have never tried that, and the syntax might be wrong (or entirely impossible)

it's a common use case so i'll have to look into it later if it doesn't work
I think I need to also add timer2 timer3 timer4 etc as when you try to call npc:timer more than once for multiple waves it just sets all previously called timers to the last called ones time. This fight requires several waves of Seed mandragora starts low and adds in more every 1-3 mins until the player has kill 30 of them. I couldn't find a way to make npc:timer work for multiple cases of the timer. Was hopeful that I could get it by use separate local's but that didn't really work either haha.

would likely be easier to just put the timer into the mandy's onMobDeath rather than in the function for the ???'s fight spawn lol.

so that worked in the onmobdeath but they spawn invisible then lol
Expedition Gaming
IP Address: expeditiongaming.ddns.net
Server Forums: https://expeditiongaming.ga/forum/index.php
Discord: https://discord.gg/5kJbxCF
Facebook is https://www.facebook.com/groups/1749730585295430
I host an array of game servers from FFXI (pre Abyssea), Tera, Arma3, FFXIV, SWG (pre-CU), BDO (v491)

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: ACP and ASA

Post by kjLotus » Thu Jun 02, 2016 9:17 pm

i'd have to see your code, but it shouldn't be doing that

User avatar
DanteMccloud
Posts: 25
Joined: Wed May 04, 2016 10:53 pm

Re: ACP and ASA

Post by DanteMccloud » Fri Jun 03, 2016 12:35 am

kjLotus wrote:i'd have to see your code, but it shouldn't be doing that
Thank you so much for all the guidance kjLotus!! I got it working, I'm still fine tuning it to be as close to retail as i can get. They continue to spawn in waves now until the player kills 30 of them ^.^ then they stop respawning. I'm so happy to have this close to done so i can move on in the story arc and get all of ACP ready to play. ended up putting it in the Seed Mandy's onMobDeath function and used

Code: Select all

mob:timer(30000, function(npc) SpawnMob(17293643,240000) end);
the first batch spawns with updateClaim(player) to start the fight, the rest spawn without hate but they link so it works out. The invisible issue I found has to due with them just respawning too fast as I had it set to 15sec for testing now put up to 30sec and it only happened a few times but ideally it will be random using

Code: Select all

local wait = math.random(60000,180000);
I'll be sure to share the files once it's all working.
Expedition Gaming
IP Address: expeditiongaming.ddns.net
Server Forums: https://expeditiongaming.ga/forum/index.php
Discord: https://discord.gg/5kJbxCF
Facebook is https://www.facebook.com/groups/1749730585295430
I host an array of game servers from FFXI (pre Abyssea), Tera, Arma3, FFXIV, SWG (pre-CU), BDO (v491)

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: ACP and ASA

Post by TeoTwawki » Sun Jun 05, 2016 12:44 pm

For the seed mandragora I was just going try having the handling of their spawns in onTick() in a status effect when I had time to look at it. I had no idea I could timer() it.

Besides them there is also the sneak attack mechanic on the seed globlin to do, the dulkfutt tower climb (which I have had sitting on my local copy for awhile), and then the final battlefield mechanics (clones etc).

Also eventually need to redo the tenshodo coffer into need tables, but wasn't going to even bother with it till more of its data was filled in.

...And then ACP will finally be finished. I just haven't had free time nor motivation do get-er-done. Juts moved to a new house and got my internet back on now I need to fix the electrical here so I can use my desktop. I just can't get work done on this laptop, wrecks my flow.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

Post Reply