Co8 5.0.0 Beta - The Big 3; A poll

Discussion in 'General Modification' started by Kalshane, May 11, 2006.

Remove all ads!
?

I think the encounter should be handled like this...

Poll closed May 24, 2006.
  1. They show up with moathouse brigands

    1 vote(s)
    3.2%
  2. They show up with moathouse brigands only after Lareth is dead

    10 vote(s)
    32.3%
  3. They show up with temple tower troops

    0 vote(s)
    0.0%
  4. They show up with temple tower troops only after Lareth is dead

    9 vote(s)
    29.0%
  5. They show up with Nulb pirates

    0 vote(s)
    0.0%
  6. They show up with Nulb pirates only after Lareth is dead

    0 vote(s)
    0.0%
  7. They show up on thier own

    0 vote(s)
    0.0%
  8. They show up on their own only after Lareth is dead

    4 vote(s)
    12.9%
  9. What the hell is this poll all about?

    7 vote(s)
    22.6%
  1. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Re: ToEE FAQ and references

    @Sitra -

    The only thing I see in random_encounter.py regarding Wonnilon is this:

    Code:
    	elif (game.leader.map == 5066):	# wonnilon hideout
    		#if game.global_flags[404] == 1:
    		#	return SLEEP_SAFE
    		#else:
    			return SLEEP_DANGEROUS
    
     
  2. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    Re: ToEE FAQ and references

    The relevant code is actually further up, in the encounter_create function.

    Specifically:
    Code:
                    if game.leader.map == 5066:
                        legit_list = []
                        barney = 0
                        for moe in game.party:
                            xx, yy = location_to_axis(moe.location)
                            if xx > 423 or xx < 410 or yy > 390 or yy < 369:
                                barney = 1
                                legit_list.append(moe.location)
                        if barney == 0:
                            location = game.party[0].location
                        else:
                            xxx = game.random_range(0, len(legit_list) - 1)
                            location = legit_list[xxx]
                    spawn_loc = location
    

    A slightly more up to date code is:

    Code:
                if (encounter.id >= 4000):
                    numP = len(game.party) - 1
                    xxx = game.random_range(0, numP)
                    target = game.party[xxx]
                    location = target.location
                    if (target == OBJ_HANDLE_NULL):
                        target = game.party[0]
                        location = game.party[0].location
                    if game.leader.map == 5066:
                    #scripting wonnilon's hideout
                        legit_list = []
                        barney = 0
                        for moe in game.party:
                            xx, yy = location_to_axis(moe.location)
                            if xx > 423 or xx < 410 or yy > 390 or yy < 369:
                                barney = 1
                                legit_list.append(moe.location)
                        if barney == 0:
                            location = game.party[0].location
                        else:
                            xxx = game.random_range(0, len(legit_list) - 1)
                            for moe in game.party:
                                if moe.location == legit_list[xxx]:
                                    target = moe
                            location = legit_list[xxx]
                    spawn_loc = location
    
    The principle is simple: check for all the party memebers' x,y coordiantes, and see if those coordinates fall within the acceptable range (a rectangle defined by the x,y coordinates of its corners). Using the loc() command you can find the relevant coordinates inside the game.
     
  3. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Re: ToEE FAQ and references

    Okay, thanks Sitra. I finally got this working after a fashion, although in the end I had to limit the coordinates to a single x and y value. I selected the jump point location for that (where the party automatically appears if you exit via the Moathouse interior to the courtyard), surmising that that particular coordinate would always get landed on by the party leader. It seems to work for parties of 1 all the way to 8 PCs, although I haven't checked for animal companions, summoned creatures, commanded undead, etc.

    Having anything more than a single coordinate for some reason spawned multiple Zerts, Turukos, and Koborts, as well as all the rest - a veritable ambush army, as it were. It was actually kind of funny, although as is the norm with ToEE, I had to cry first before I could see the humor. ;)

    I'll post something to be tested here shortly, once I figure out what to add as the dampener for the old 'come back later and get the ambush' problem.
     
  4. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Re: ToEE FAQ and references

    Alright. It is finished.

    The end solution I employed was to stage yet another ambush at the secret door exit using Sitra's coordinates script, so now you're not getting out of the Moathouse no way no how without running into the Big 3. And therefore, being as you'll have dealt with them one way or another, no other provisions are necessary. Thank god!

    Please give this a spin and try out any possible scenario you can think of - day, night, go to Hommlet and come back, go out front then go out back, lots of PCs, few PCs, NPCs, etc. etc.

    A few things I added or changed:

    • changed a Turuko line so he doesn't mention the Moathouse like some distant thing. (That worked for the cave exit but not for the courtyard.)
    • added some alternative PC responses geared toward not-so-goody-goody types. These don't change the outcome, but at least they might further the choices/variability illusion.
    • did some re-sectoring on the cave exit map so those two big rocks in the battlefield can't be walked over.
    • slightly repositioned the combatants on the cave exit map.
    • added 2 new Kobort intros reflective of where you are (the discriptive part, not his line).
    Also note: it occurred to me when I wrote "you're not getting out of the Moathouse without running into the Big 3" above that we might be force-feeding this whole thing on people now, being as it's inescapable. This isn't really true though. The greater likelihood is still that you won't get the ambush at all, due to all the original constraints that remain - Big 3 alive, Big 3 not in party, etc. Given this, I think I'm quite satisfied with it all at last. :)

    If this can pass a little internal testing, I'll slip it into the CMF straightaway.

    Extract to root with Co8 active and overwrite as usual.

    [link can be found in CMF thread as of 07.23.2008]
     

    Attached Files:

    Last edited: Jul 23, 2008
  5. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    I've moved the recent FAQ and references-originated big 3 discussion over here to the original ambush thread so all related discussion can be found in one place and we don't dominate the other thread with this stuff.

    btw, I've thought of another possible problem: what if players don't get the ambush originally because they have one of the big 3 in the party at the time, then they go on to play the game up to the Moathouse Respawn part, then come back to the Moathouse without a big 3 member and satisfy the conditions again? The ambush would probably occur. :smarty:

    We still need to terminate the conditions in some way.

    [edit]

    Okay I think I've finally fixed this damn thing. I broke down and added a flag (I still have an aversion to them for some reason) that gets set if you arrive on the Hommlet exterior map and Lareth is dead. Then I added the condition of said flag not being set to the ambush encounter. So in essence, if you've killed Lareth and left the Moathouse and the conditions were such that you didn't get the ambush encounter at that time (Zert in the party or whatever), once you set foot back in Hommlet the conditions will be nullified. So even if you get back to Hommlet, dump Zert, and go back to the Moathouse (thus satisfying the other conditions again), nothing's gonna happen at that point. The only timeframe in which you'll get ambushed is before you go back to Hommlet after killing Lareth.

    I suppose I should add every other exterior location in the game too in case players go to those places instead of Hommlet. Will test later and post the fixed-fixed-fixes if they actually work.
     
    Last edited: Jul 21, 2008
  6. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Update: it was a tortured hellbus ride, but I finally got this going. The ambush effectively 'times out' now after you leave the Moathouse maps. Still have to provide for other possible destinations, and there's the next problem - the Moathouse bandits in the courtyard. If you don't go through them on your way in (enter via back door or whatever), they screw up the ambush later if you exit into the courtyard. :(

    btw, did you know that having two or more similarly named .py files in data\scr (such as py00334generic_spawner and py00334generic_spawner.bak) causes the scripts not to compile? I didn't either. :blegh:
     
  7. Badger-ude

    Badger-ude The nonPnP gamer PoV

    Joined:
    Mar 11, 2006
    Messages:
    83
    Likes Received:
    0
    Using the latest CMF, I enterred the moathouse, killed Lareths guards, left to rest and recover before returning and slaying Lareth, but not before he called to Llolth;. AFter fighting the spiders I left via the cave exit to find... no ambush... This is the only time I haven't encountered the ambush so it kinda confused me... Does the variable for the ambush start AFTER lareths death or upon instigating the assault upon his men? It would make more sense to be the former, but seeing as I hadn't read the diary the story state shouldn't have changed... althoug hactually come to think of it, maybe this has something to do with the bug I found with Burne accepting your story that you've cleared the moathouse even before you have entered the MH dungeon (and thus upgrading the story state)....
     
  8. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Okay, it is done. See the CMF for the files. Please god let this be the end.

    @Badger-ude, were all the other conditions satisfied? I've tried the spider routine and it works for me.
     
  9. Badger-ude

    Badger-ude The nonPnP gamer PoV

    Joined:
    Mar 11, 2006
    Messages:
    83
    Likes Received:
    0
    Yep... the only mitigating factor could be that I had stripped zert and kobort after winning the drinking contest, but had dumped their stuff on the floor rather than seeling (recycling) it.... could this cause a conflict?

    It's nothing that i'm personally bothered about.... just giving an account of my own experience :)
     
  10. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    i think this has been brought up before. The mobs in the ambush aren't the same ones that are in the Wench, so there could be inconsistencies like that one: but its common sense that they would reequip themselves before doing the ambush. Zert would just have to fetch his lance from his war horse :)
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    I like how you spaced out the ambushers. It's harder to get them all with a single web spell now.

    Also, don't be afraid to use flags, or vars in particular. There's plenty to go around, and I doubt we'll ever run out of them. Just make sure to state what range you're workin in. I personally use the flags and variables in the 400 range (though I've recently crept into the 500 territory with the variables). It should be safe to claim the 600-650 range.
     
  12. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    Re: 5.0.x Cumulative Mods & Fixes (CMF) Bug Reports and Discussion Thread

    Gaear, don't pull out your hair, but I think there's a bug in the new ambush script.

    It stems from the self-destruct command (attachee.destroy() ) being executed under the wrong conditions. The script object's heartbeat script is currently:

    Code:
    if (attachee.map == 5002):    # Moathouse Courtyard & Back Door
            for leader in game.party:
                xx, yy = location_to_axis(leader.location)
                if (xx == 462) and (yy == 447):        # Courtyard
                    banditcheck = find_npc_near(attachee,14070)
                    if (banditcheck == OBJ_HANDLE_NULL):
                        if not(is_follower(8002) or is_follower(8004) or is_follower(8005) or is_follower(8010) or game.party_alignment == LAWFUL_EVIL):
                            if ((game.global_flags[44] != 1) and (game.global_flags[45] != 1) and (game.global_flags[700] != 1) and (game.global_flags[37] == 1) and (game.global_flags[283] == 0)):
                                Big_Three_Ambush_2(attachee)
                            attachee.destroy()
                elif (xx == 437) and (yy == 445):    # Back Door
                    if not(is_follower(8002) or is_follower(8004) or is_follower(8005) or is_follower(8010) or game.party_alignment == LAWFUL_EVIL):
                        if ((game.global_flags[44] != 1) and (game.global_flags[45] != 1) and (game.global_flags[700] != 1) and (game.global_flags[37] == 1) and (game.global_flags[283] == 0)):
                            Big_Three_Ambush_3(attachee)
                        attachee.destroy()
    
    The problem is, if the party emerges from the Moathouse to the courtyard/secret exit without having killed Lareth yet (e.g. going back to rest in the Tower or sell stuff in Hommlet), then the script finds a PC in the correct position, but since Lareth isn't dead yet, only the attachee.destroy() command is executed.

    This should be changed to this:

    Code:
        if (attachee.map == 5002):    # Moathouse Courtyard & Back Door
            for leader in game.party:
                xx, yy = location_to_axis(leader.location)
                if (xx == 462) and (yy == 447):        # Courtyard
                    banditcheck = find_npc_near(attachee,14070)
                    if (banditcheck == OBJ_HANDLE_NULL):
                        if not(is_follower(8002) or is_follower(8004) or is_follower(8005) or is_follower(8010) or game.party_alignment == LAWFUL_EVIL):
                            if ((game.global_flags[44] != 1) and (game.global_flags[45] != 1) and (game.global_flags[700] != 1) and (game.global_flags[37] == 1)):
                                 if (game.global_flags[283] == 0):
                                    Big_Three_Ambush_2(attachee)
                                else:
                                    attachee.destroy()
                elif (xx == 437) and (yy == 445):    # Back Door
                    if not(is_follower(8002) or is_follower(8004) or is_follower(8005) or is_follower(8010) or game.party_alignment == LAWFUL_EVIL):
                        if ((game.global_flags[44] != 1) and (game.global_flags[45] != 1) and (game.global_flags[700] != 1) and (game.global_flags[37] == 1)):
                             if (game.global_flags[283] == 0):
                                Big_Three_Ambush_3(attachee)
                            else:
                                attachee.destroy()
    
    So that once the full conditions for the encounter are met, it will check flag 283, and create the ambush or not, accordingly. If the flag is set, the spawner will self destruct.

    same goes for the cave exit:
    Code:
        if (cur_map == 5091):    # Moathouse Cave Exit
            game.areas[8] = 1
            if (game.story_state >= 2 and not(is_follower(8002) or is_follower(8004) or is_follower(8005) or is_follower(8010) or game.party_alignment == LAWFUL_EVIL)):
                if ((game.global_flags[44] != 1) and (game.global_flags[45] != 1) and (game.global_flags[700] != 1) and (game.global_flags[37] == 1) ):
                    if (game.global_flags[283] == 0):
                        Big_Three_Ambush_1(attachee)
                    else:
                        attachee.destroy()
    
    edit: accidentally replaced big_three_ambush_3 with big_three_ambush_2, which fubared the back entrance ambush.
     
    Last edited: Jul 25, 2008
  13. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Re: 5.0.x Cumulative Mods & Fixes (CMF) Bug Reports and Discussion Thread

    Thanks for the heads-up, Sitra. I'll try to work up your alternate scripts and repost them later. btw, I've never seen the 'if (cur_map == xxxx)' thing before - is that preferable to 'if (attachee.map == xxx)' in this case?

    Also, I assume you don't intend for the story_state check to be re-introduced in the case of the cave exit ...?

    Let me just say too that I appreciate it when you scripting gurus check this stuff out. :thumbsup: It's kind of like speaking a foreign language for me, so I'm always afraid that I've got something wrong.
     
  14. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Speaking of that, didn't Cerulean or somebody declare that there was a limit to the number of flags/variables that the engine could handle at one time? I thought there was some concern that we were approaching the ceiling with flags specifically.
     
  15. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    The limit is 999 flags and 999 variables, from game.global_flags[1] to game.global_flags[999] and vars[1] through vars[999]. We're using roughly 40% of the flags right now, but the variables are almost totally unused (and they can be used as simple flags of course, or even bitwise flags using binary operations).
     
Our Host!