Understated Ur-Drakon Celtic Minstrel Posted August 11, 2010 Share Posted August 11, 2010 I want to make someone offer to join your party after being defeated, but putting the relevant code in the DEAD_STATE doesn't seem to work. The trouble, I'm guessing, is that add_char_to_party() doesn't work because the character is dead. So, if I'm right, I need to revive it in the DEAD_STATE. Any idea how that could be done? Or any other suggestions? Quote Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Mea Tulpa Posted August 11, 2010 Share Posted August 11, 2010 Without knowing much about Avernumscript, it seems like it would be easier to have a second character who is hidden and then joins (or appears and offers to join, or whatever) on a cue triggered by the first (hostile) character's death state. That also allows you to make their stats different if appropriate. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 11, 2010 Share Posted August 11, 2010 Are you sure that the problem isn't that you're calling add_char_to_party from a creature script? I can't find the reference now, but I've been working on similar things today, and had issues with a call that could only be used from a town or dialogue script. I'm not sure whether there's a good way to deal with the creature being (sort of) dead already in the DEAD_STATE. In general spawn_creature() can be used to resurrect preset town creatures, but it may not be applicable in your situation. There is a low level sneaky way to bring things back to life, which is what I've found I need for what I'm doing, but I assume you want to avoid that if possible. (In addition to the fact that I still need to research the right magic numbers to use on Windows.) One way that you might work around this entire problem is that if you have exactly one case where you need to do this, you could just have a duplicate of the creature hidden 'off stage', and join that one to the party when the original dies. (You could do this for multiple cases as well, but it would get tedious for obvious reasons.) If you felt like being a little elaborate you could use place_monster to generate the double on the fly, but this way has multiple possible failure modes, and is probably easier to avoid if you don't need it. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 11, 2010 Author Share Posted August 11, 2010 Actually, I was calling add_char_to_party from a dialog script invoked upon death. I tried spawn_creature, but that didn't seem to work either. Duplicating the creature would work if I hadn't reached the quota of creatures in a town. On the other hand, I can probably find a creature to delete to make way for it, so I guess I'll go with that one. Thanks. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 11, 2010 Share Posted August 11, 2010 Quote: Duplicating the creature would work if I hadn't reached the quota of creatures in a town. On the other hand, I can probably find a creature to delete to make way for it, so I guess I'll go with that one. This might make you actually want to use place_monster(), then, since it lets you used a summon slot rather than a preset monster slot. You have to be careful, however, that it really does get summoned, as large fights can quickly summon enough creatures to fill all 34 slots. Of course you can always check to see if there are any summon slots free, and if not, erase one of the summoned creatures, since they probably aren't very important. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 11, 2010 Author Share Posted August 11, 2010 Okay, so I'm trying to spawn a creature and put a box on a space after four other creatures have died. Each of them is set to call state 23 upon death, which contains the following code: Code: beginstate 23; demons = demons + 1; if(demons >= 4) { message_dialog("",""); place_monster(42,41,113,0); set_terrain(42,41,200); }break; However, when the fourth one is killed, nothing happens. Quote Link to comment Share on other sites More sharing options...
Burgeoning Battle Gamma Metatron Posted August 11, 2010 Share Posted August 11, 2010 What is demons initially set to? Maybe just to be safe, you could include a print_num(demons) call while you're debugging. It's unlikely, but maybe you also need to call force_instant_terrain_redraw(). Quote Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Mea Tulpa Posted August 11, 2010 Share Posted August 11, 2010 Did you initialize demons? Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 11, 2010 Share Posted August 11, 2010 Are you initializing demons to 0 somewhere first? Are you sure state 23 is getting called at all? Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 11, 2010 Author Share Posted August 11, 2010 Yes, I set it to 0 in the INIT_STATE. As for whether state 23 is getting called... there's no reason I can see that it wouldn't be getting called, but I suppose I could add a print statement to verify that... Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody BJ Back From the Beyond Posted August 12, 2010 Share Posted August 12, 2010 Maybe demons is getting set back to zero when the state ends? If so, you might want to use an SDF and inc_flag instead. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 12, 2010 Author Share Posted August 12, 2010 Turns out the problem was a missing parameter elsewhere in the script. It now half-works, but the creature is not being spawned. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 16, 2010 Author Share Posted August 16, 2010 I discovered a strange glitch; it's not really related to scripting, but it's something I kind of need to solve. I have a town, which contains a boat. You are supposed to leave the town to the west. However, attempts to do so result in coming up against an invisible wall, even though the town boundaries leave one space at the edge rather than going all the way to the edge. If you try leaving to the north or south (which has three spaces beyond the boundary rect), you can go off the town boundaries (possibly even beyond the actual physical boundaries of the town); only after fiddling around a bit do you end up in the outdoors, and then you end up on land (but that's probably because the north and south entrances are supposed to be land entrances). Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 16, 2010 Share Posted August 16, 2010 Yeah, the game won't, as I recall, let the party leave town properly is there is too little space between the edge of the town boundary rectangle and the physical edge of the town. You may just have to contract the boundary rectangle by one or two spaces on that side to make it work. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 16, 2010 Author Share Posted August 16, 2010 My impression was that only one space outside the boundary was needed to allow the party to exit effectively. I guess I'll have to try shrinking it, though that might be a bit difficult since almost all the space is used up. EDIT: Apparently I was wrong. One space is insufficient; three is sufficient. Hopefully two will work. EDIT EDIT: Fortunately it does. For future reference, at least two spaces must be left on any side you want to be able to exit from. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 16, 2010 Author Share Posted August 16, 2010 I get a glitch after the cutscene when I try to move the party. The cutscene ends with the party in a different place from where they began. What's the best way to fix this? Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 16, 2010 Share Posted August 16, 2010 I'm so rusty at writing cutscenes that I had some troubles with something similar sounding. You may want to get advice from someone more knowledgable (or examine a script written by such a person), but the fix I used was to mostly move the party around using march_party(). It takes some extra effort, since you have to march them to the place where you want the final member to end up and then sequentially through the spaces for the other members up to the first member, but it gets the job done. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 16, 2010 Author Share Posted August 16, 2010 I actually did use march_party; however, at the beginning of the cutscene I had used relocate_character to make sure that they were not in a position where they'd get in the way of the cutscene. I guess I can try getting them there with march_party instead and see if that works. By the way, I'm pretty sure I remembered to include a one-second pause after each frame, yet some of the frames seem to be skipped when I actually see the cutscene (for example, it jumps from text bubble #1 to text bubble #3). Any idea what might cause that? Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody Duck in a Top Hat Posted August 17, 2010 Share Posted August 17, 2010 I had that problem before when making a cutscene. Are you sure that you used erase_text_bubbles() before each new text bubble on a character? Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 17, 2010 Author Share Posted August 17, 2010 No, I'm setting the character's text bubble to an empty string, which (according to the documentation) clears the text bubble. And it mostly works, too; there's just a handful that it fails on. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Nioca Posted August 17, 2010 Share Posted August 17, 2010 Are you making sure to force a new frame between each bubble? I can't remember the exact call at the moment, it's been a while... I think it's force_terrain_redraw(); or something to that effect. Anyway, if it's not redrawing with each change, it probably won't display correctly. Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody BJ Back From the Beyond Posted August 17, 2010 Share Posted August 17, 2010 First of all, is the first party character returning to the space where the cut scene is activated? If so, you need to include the call block_entry somewhere in the code for your relocations to stick. I believe that applies to march_party as well. As for the text bubbles, empty strings do work to clear them. Make absolutely sure that you include the call force_instant_terrain_redraw() every time you want a change to be displayed to the player, and then include a pause, even between changes in text bubbles. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 17, 2010 Author Share Posted August 17, 2010 I wasn't forcing redraw between bubbles (only between people moving), so perhaps that was it. And thanks for the block_entry tip; I'll try that. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 18, 2010 Author Share Posted August 18, 2010 Is START_STATE the only required state in an outdoor script? For that matter, is it even required at all? (I ask because omitting EXIT_STATE from my town script was causing errors when I left town. Nothing serious, though.) Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody BJ Back From the Beyond Posted August 18, 2010 Share Posted August 18, 2010 The only states required for outdoor scripts are INIT_STATE and START_STATE. Towns need both plus the EXIT_STATE. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 18, 2010 Author Share Posted August 18, 2010 Thanks. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 19, 2010 Author Share Posted August 19, 2010 Perhaps this is a silly question, but is there any way to a) determine if a PC has a cursed item equipped and remove said curse using a script? I'm looking at simulating an Exile-type healing interface, where you have a list of ailments that afflict some member of the party and choose from the list to heal that ailment. One of said ailments is cursed items, at least in Exile. This isn't really necessary for my scenario, since it doesn't really have cursed items, but I want to have it for completeness so that I can post it on Blades Forge or something. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 19, 2010 Share Posted August 19, 2010 Quote: a) determine if a PC has a cursed item equipped In Jeff's infinite wisdom: No! Quote: remove said curse using a script Yes, according to the docs restore_pc() does this. Edit: Just realized that it should be possible to implement a sneaky work-around to accomplish (a). I think that I have all of the necessary information, so I'll just have to code it up and test it. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 19, 2010 Author Share Posted August 19, 2010 Will the sneaky way work in the condition of a dialog node, though? And can be done without restore_pc()? Next question... how to remove dread curse? alter_stat doesn't seem to work, possibly because dread curse reduces all stats by 1 including itself. I can detect it with get_stat_levels_bought (which is actually kind of strange, but whatever), but I can't seem to remove it. Again, it's not strictly needed for my scenario, but for completeness... Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 19, 2010 Share Posted August 19, 2010 Quote: Will the sneaky way work in the condition of a dialog node, though? It's not going to be a one-liner, so no. You could fake it fairly well by evaluating it from a special rectangle that the party has to (or at least is likely to) walk through before starting the conversation and storing the result, though. (After all, the party isn't going to be taking off a cursed item between walking through the rectangle and talking to the NPC.) Quote: And can be done without restore_pc()? I think yes, using more sneakiness, but why? Is there something wrong with using restore_pc()? If you're concerned about preserving the character's hitpoints and energy, you can just store them before and then revise them to match again afterwards. Quote: Next question... how to remove dread curse? alter_stat doesn't seem to work, possibly because dread curse reduces all stats by 1 including itself. I can detect it with get_stat_levels_bought (which is actually kind of strange, but whatever), but I can't seem to remove it. Huh, I hadn't thought there was a problem with this. Nephilim Mystery gives the party 12 levels (!) of Dread Curse and then removes them again, successfully as far as I recall. Maybe someone else has some experience with this. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 20, 2010 Author Share Posted August 20, 2010 Originally Posted By: Niemand I think yes, using more sneakiness, but why? Is there something wrong with using restore_pc()? If you're concerned about preserving the character's hitpoints and energy, you can just store them before and then revise them to match again afterwards. Good point. That would probably be easier. Originally Posted By: Niemand Huh, I hadn't thought there was a problem with this. Nephilim Mystery gives the party 12 levels (!) of Dread Curse and then removes them again, successfully as far as I recall. Maybe someone else has some experience with this. Well, I tried the following two lines (not at the same time): Code: alter_stat(i,31,0 - get_stat_levels_bought(i,31));alter_stat(i,31,-500); The first didn't work. I don't think the second did either.On an unrelated note, does anyone know if there is a maximum on the number of animations (explosions, etc) running simultaneously? I think I might have run into such a limit. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted August 20, 2010 Share Posted August 20, 2010 You could iterate "short char_has_item_of_class_equip(short char_num,short which_class,short take_item)" for all the cursed items in the game if you give all such items the same special class. It depends if you only to check for one specific type of cursed item or if you want to check for any type at all. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 20, 2010 Share Posted August 20, 2010 Quote: On an unrelated note, does anyone know if there is a maximum on the number of animations (explosions, etc) running simultaneously? I think I might have run into such a limit. There is such a limit; as I recall Ephesos hit it with some of his animations in early versions of SoG, but I don't know what exactly it was. if you determine it please make note so we don't forget again. Quote: You could iterate "short char_has_item_of_class_equip(short char_num,short which_class,short take_item)" for all the cursed items in the game if you give all such items the same special class. It depends if you only to check for one specific type of cursed item or if you want to check for any type at all. You can do this, but I'm not impressed with this as a solution in general, since it both requires a bunch of redundant work tagging all of the relevant items in the scenario's data definitions, each item can carry only one tag (potentially causing problems if you wanted to be able to query more than one property this way), and it can't work on items that the party carries into the scenario. That being said, in some situations this will be good enough, and is supported, which may make it the pragmatic choice. Finally, regarding the sneaky dark magic I mentioned above: It seems I don't have quite the right incantations handy; the ones I have do something different than what I thought. A bit more research will be required, although the fundamental idea should still be sound. Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody BJ Back From the Beyond Posted August 20, 2010 Share Posted August 20, 2010 Originally Posted By: Celtic Minstrel Next question... how to remove dread curse? alter_stat doesn't seem to work, possibly because dread curse reduces all stats by 1 including itself. I can detect it with get_stat_levels_bought (which is actually kind of strange, but whatever), but I can't seem to remove it. Again, it's not strictly needed for my scenario, but for completeness... If you don't give the party Dread Curse to the party in your scenario, then you don't need to worry about it. Dread Curse is removed once the party leaves the scenario where the curse was acquired. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 20, 2010 Author Share Posted August 20, 2010 Originally Posted By: B.J.Earles If you don't give the party Dread Curse to the party in your scenario, then you don't need to worry about it. Dread Curse is removed once the party leaves the scenario where the curse was acquired. I realize this, but I'm trying to make it generic so that it could be used in other scenarios. EDIT: Effects limit is 60. For effects and sparkles, the num_effects and num_sparkles are the number that counts towards the effect. Explosions count for one. I'm not quite sure how zaps count. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 20, 2010 Author Share Posted August 20, 2010 Is there any other way to get a numeric response other than having a check_text_response_match call for every possible value? Also, what was the "node limit" again Also also, see previous post. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 20, 2010 Share Posted August 20, 2010 For my research on the node limit, see this post. Short answer: it's 32000. Quote: Is there any other way to get a numeric response other than having a check_text_response_match call for every possible value? There is no other supported way. I assume you recall the discussion which resulted in this suggestion, which is what I would recommend using in general. This is another thing that can be done very nicely via tricks, but given that a not totally horrible legal way exists, it might be best to stick to that. At some point I'll publish a finished version of the tricky version, though. (So many irons in the fire. SO MANY.) Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 21, 2010 Author Share Posted August 21, 2010 You can have 20 string variables and 20 int variables, right? Or is it 20 total variables? Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 21, 2010 Share Posted August 21, 2010 You can have up to 20 of each. Also, take a look over on the Blades Forge; I got a few useful scripts to the point where I think that they're ready, so I put them up there. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 21, 2010 Author Share Posted August 21, 2010 Is there some bug that affects shops above #9? I'm adding stuff to them, but it doesn't seem to have taken hold. EDIT: I just discovered an error in the scenario script which had passed unnoticed; I think that's the culprit. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted August 22, 2010 Share Posted August 22, 2010 I am not aware of any such bug. As long as you stay within the 29 item limit you should be okay. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 24, 2010 Author Share Posted August 24, 2010 Wait, 29 items? I thought it was 25. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 24, 2010 Author Share Posted August 24, 2010 Originally Posted By: Niemand Huh, I hadn't thought there was a problem with this. Nephilim Mystery gives the party 12 levels (!) of Dread Curse and then removes them again, successfully as far as I recall. Maybe someone else has some experience with this. It seems there are problems with giving insane levels of Dread Curse; my test case involved giving 100 levels (something which will almost certainly not occur in practice), and it didn't work, but reducing the test case to 10 levels allowed it to work just fine. Perhaps someone should research the maximum safe level of Dread Curse. (Might be worth noting that the test case did in fact remove the Dread Curse as far as get_stat_levels_bought was concerned, yet still showed it in the skill list.) Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 24, 2010 Share Posted August 24, 2010 You know, now that you mention it, I remember having similar problems with manipulating stats for the identification scrolls in BoR. If I boosted the character's Intelligence or Arcane Lore too high, it wouldn't go back down again. I eventually settled on always boosting to 60, rather than the +100 or some such that I had originally used. Unfortunately, I don't think I have any notes from my session of debugging it with Nikki, since we were using KoL chat to communicate. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 29, 2010 Author Share Posted August 29, 2010 Okay, there's a character who I want to automatically become hostile whenever you steal anything in a particular town. I have a setup theoretically working by basically checking if the crime level has changed in the START_STATE, but there's a problem. It's possible for the character to join your party, and if you steal his stuff after he has joined you he should leave your party and attack. However, since he's in your party, there's no-one to see you to increase the crime level, so it won't work in that case. Any suggestions? Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 29, 2010 Share Posted August 29, 2010 You could make an invisible character to follow the party around and watch them while the other character is a party member. It might be tricky to make sure that this didn't interfere in any other detectable way, though. (The invisible character would need to never get in the way of the party or visible NPCs.) Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody BJ Back From the Beyond Posted August 29, 2010 Share Posted August 29, 2010 There is a call that checks if there is an item of a certain class on a space. You would need to give each of the items their own special classes and then check to make sure those items are still where they belong every turn. It would be a bit clunky, but wouldn't get in the way of PCs and NPCs. I've never actually done this before, but it should work in theory. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted August 29, 2010 Author Share Posted August 29, 2010 What happens to items with a special class when you leave the scenario? Does the game take away the items, or does it just remove the special class? Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted August 29, 2010 Share Posted August 29, 2010 The docs claim: Quote: When a party leaves a scenario. . . items that have special classes will have those classes be set to 0 Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted September 2, 2010 Author Share Posted September 2, 2010 Well, this is odd. I have an NPC in the party with a custom script, and its DEAD_STATE appears to not be running when it dies... and yet, it definitely worked yesterday. I have the following code: Code: beginstate DEAD_STATE; if(this_char_is_in_party()) { set_flag(5,5,3); drop_item(459); if(is_town()) { if(current_town() == 5) { spawn_creature(66); set_attitude(66,3); spawn_creature(67); set_attitude(67,3); spawn_creature(69); set_attitude(69,3); } } }break; The only thing I added today was the is_town conditional; however, I'm not getting a script error, so I'm doubtful that that's the problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.