Jump to content

Need help with a finicky script...


Recommended Posts

So, I decided to dust off my BoA Editor and start to make a scenario that would actually get finished. I'm nearly done making said scenario, but I have one little problem.

When a certain NPC that joins the group dies, the rest of the party is supposed to die with it. (similar to Babysitting and when the little sister dies).

I tried to insert "run_town_script(18);" into the NPC's script's DEAD_STATE, and then have that node do:

Quote:
reset_dialog();

add_dialog_str(0,"You see Mari striken down by a foe. You are very easy to dispatch in your grief-striken state.",0);

run_dialog(1);

kill_char(0,0,1);

Apparently, said node only works when I myself kill the NPC, and not when the enemies that are allowed to kill her... kill her.

Help would be very appreciated considering this is one of the things (if not the only one) preventing me from releasing my scenario for betatesting or just to officially release it.

Link to comment
Share on other sites

I was under the impression that joinable NPC's custom scripts didn't work all that well, but I can't remember what did work and what didn't.

 

Anyway, the way I'd approach the problem is to stick some code in the scenario script's START_STATE that'd check if the NPC was actually in the party, and if so, if she was alive. If she ever was in the party but was dead, I'd display your "you lose" message.

 

Alternatively, just take a look to see how Khoth handled it in Babysitting, since it's the same thing. I'm pretty sure you could even use his code along as you credited it in the Readme...

Link to comment
Share on other sites

Well, while I was waiting for a reply, I tried to look through Khoth's scripting for the code I need, and I found it. Problem was that, since I'm still getting used to scripting, I couldn't tell what to take out and what to modify (I'm pretty sure that our scripts would be different since his allows two NPCs to join, in comparison to my one NPC). Would it be acceptable if I were to put the START_STATE with the code in a quote and have someone kindly point out what needs to be replaced?

Link to comment
Share on other sites

I just checked, and it seems Khoth just had some code to end the scenario, rather than killing the entire party off (same end result, of course). Since that seems to work, I'd just replace your "kill_char(0,0,1);" with an "end_scenario(0);" and see if that works.

 

Edit: (His code is in the custom creature script "cantdie", for the record, and he's using the DEATH_STATE, so I think you'll probably be fine to do the same.)

 

Edit 2: (I was clearly a bit too quick. It seems he originally had the same idea as you - in "sister.txt", there is code to kill off the entire party should the NPC fall in combat. Judging from the "If you see this message, let me know" note he added after that code, though, I suspect he couldn't get it to work for some reason? :/)

Link to comment
Share on other sites

Well, I looked at his "cantdie" before posting, and I didn't think that was what I was looking for. I was (and still kind of am) confused by the fact that it requires a SDF flag to be zero in order to work, and I don't know if said flag has any other importance or is changed by anything in his scenario. What I don't really understand is why DEAD_STATE doesn't work when the creature is killed by another creature...

Link to comment
Share on other sites

I looked at the notes too, to try and figure out what the SDF does. The fact that it's zero pretty much means that you don't have to worry about it anyway, though.

 

Did you try replacing your "kill_char" code with the "end_scenario" code?

 

EDIT: Also, I just reread your first post - is there a reason you're not just including your code in the DEATH_STATE of the custom creature script?

Link to comment
Share on other sites

I intended that encounter to be similar to Babysitting in that once your sister dies in battle, you also die (which is why I wasn't too interested with it in the first place). Regarding your edit, I think I ended up taking it out since it failed to work even then (my memory is a little foggy, so I'm not sure as to whether it didn't work when I killed her to test it, or when I had a creature kill her to test it).

After it failed to work then, I then did the whole "run_town_script" and the death code in the town script to see if that then would work.

I guess I'll take the "cantdie" script's DEAD_STATE, change the SDF from (1,4) to something I haven't used yet, switch the "end_scenario" to "kill_char", and then switch it with the faulty DEAD_STATE of my own NPC to see if it works then. If it fails again, then I'll be at a loss.

 

Edit: And yes, I'm at a loss. It still only seems to work when I kill her, not when creatures do the same...

Link to comment
Share on other sites

Okay. With regards to the SDF you don't need that call in there. At all The only way you would want to use a SDF check there would be if you wanted there to be another condition for the message to display. Since you don't, don't use the SDF code. It's not going to break the code by having it, but still (since all SDFs are 0 anyway, you'll basically be asking the game to check for a SDF you haven't used yet, which isnt necessary. Khoth probably added the code in there to check another variable before running his code, but you don't want to check anything).

 

Secondly, Khoth pretty much just stuck the code into the DEATH_STATE, so we know that should work. If neither that, or running a town script works, is it possible you never gave your NPC a custom creature script? You'd have to do that in the editor, most probably, or a custom data script. One way to test would be to put a print_num call into the DEATH_STATE. If a number prints in-game when the NPC dies, we know that the DEATH_STATE is working for that NPC. That makes our job easier.

 

Once we figure that out, it's jus a matter of sticking a kill_vhar/end_scenario call into the DEATH_STATE.

Link to comment
Share on other sites

This script continues to taunt me...

I did what you recommended and both temporarily took out the death code, permanently took out the flag, and added in "print_num(1);".

I let the boss kill her: no one in sight.

I kill her myself: big pink one in the text area...

Is there something else I might be doing wrong, because I can't really think of anything else...

Link to comment
Share on other sites

Okay, I sent you the scenario. Be warned, in my haste to send it, I sent an email without the scenario attached, and the second email wouldn't allow me to attach the folder itself (so I just sent all the files inside said folder).

 

And to Kelandon: that may shed a little light onto the situation, because if worse comes to worse and Nikki can't figure out what is wrong, I can just try and use parts of Phaedra's DEAD_STATE. I would be surprised if it worked, but it would be worth a try...

Link to comment
Share on other sites

I have to go to work now, so I only looked for a little while, but it appears that having Mari join the party makes Blades ignore her custom script; before she joins, the dialog box shows, but after it doesn't. I've no idea why.

 

Off the top of my head though, you should be able to get around this. In the town script node where Mari joins the party, set an UNused SDF to one. Then, in the scenario script's START_STATE, add something that checks the flag is one and then checks the status of char(4) - I think you'd want to use (char_ok()) for that. That way, if she is in the party, but not alive, the message will flash.

 

When I get home I'll have a proper look at why the custom script isn't being called whilst she's in the party though, because as far as I can see there's no reason why it isn't. Maybe somebody who has worked with joinable NPCs can help more.

 

(edit, unused SDF, not used...)

Link to comment
Share on other sites

Once you (or said person with joinable NPC experience) can find out what is the matter with the script(s), I'll be sure to make the adjustments (although I'll back up the scenario and give your idea a try).

 

Edit: One thing I see that might go wrong would be that I actually have two Mari's in the town. The first one gets erased in the boss battle, and then the second Mari (who is located at the edge of the town) is teleported into the corner, unconcious (to make it look like the original Mari was teleported into the corner of the room). I'm just concerned by the fact that erasing the character would cause the char_ok() to return false, causing the death code to start.

 

Edit 2: Strange... still no response. Here's the code I added to the scenario script just in case you're wondering what isn't working (minus the indentations of course):

Quote:
if(get_flag(12,12) == 1) {

if(char_ok(17) {

end();

}

else {

message_dialog("You see Mari striken down by a foe. You are very easy to dispatch in your grief-striken state.","");

kill_char(1000,2,0);

end();

}

}

else {

end();

}

break;

Link to comment
Share on other sites

As long as she's in your party, char_ok(4) will correctly check if she's alive; joined NPCs are always numbered 4 and 5. However, if she's not in your party, you need to check whatever her ID is, or something.

 

(P.S. To preserve indentation, use code tags instead of quote tags.)

Link to comment
Share on other sites

The problem you were having is running "char_ok(17)", I reckon. When an NPC joins the party, they immediately take a new number; the first is treated as number 4, for example.

 

Anyway, using that code in the START_STATE, I got it to work, until the fight with the boss, as you said. I even tried using "character_in_party" to check if either of the Mari's were in the party before running the "char_ok()" call, but obviously if she's dead she won't be in the party. I'm still no closer to figuring out why the DEATH_STATE of Mari's script isn't working once she's joined the party, either; it works fine before. smirk I've got some coffee on, though, so I'll continue to poke around.

Link to comment
Share on other sites

Huh, I guess I forgot about the number changing when a NPC joins the party...

Anywho, I greatly appreciate the help you guys are providing. grin

I really hope we can find out why the script is being so naughty before Friday, but if it takes that long I'll be sure to send you a copy, Kel.

(and this time I'll remember to attach the scenario to the first email. tongue )

 

Oh, and Nikki, by "you getting it to work", do you mean that you got the death code to actually start when she was killed by a creature?

Link to comment
Share on other sites

Originally Posted By: Seasons of Destiny
Oh, and Nikki, by "you getting it to work", do you mean that you got the death code to actually start when she was killed by a creature?


Yes. I added some code in the start_state that checked to see if the character had joined the party, and checked to see if she had any status other than 1. Then I let her get killed, and the code worked.

The problem came when, during the boss fight, she gets erased and replaced. What was happening was the flag check was still true, but char_ok(4) was false, and the kill text was showing. Wait...

If you set the flag back to 0 when she gets erased, and then back to 1 when the new Mari gets added, this should work.

So, in the scenario script's start_state, you'd add something like this (use any unused flag you like):

Code:
if(get_flag(199,1) == 1) {	if(char_ok(4) != 1) {		message_dialog("You see Mari striken down by a foe. You are very easy to dispatch in your grief-striken state.","");		kill_char(1000,2,0);		}	}
.

Then, you need to do three things.

-First, in node 13 of t2bandit, make sure you set that flag to 1. That way the game will know she's supposed to be in the party, for the moment.

-Next, in node 16 (when she gets erased, and the you make her collapse in the cutscene), you'll need to set the flag to 0. That will make the game realise she shouldn't be in the party anymore.

-Finally, in node 20, when she joins again, set the flag to one.

I haven't tested this, but it should work (character_in_party would be the call I'd usually say to use, but when she dies she's obviously not in the party anymore, so it doesn't work).
Link to comment
Share on other sites

It might be because you didn't test it, or that I just made a minute mistake somewhere, but she refuses to make me die when she dies in the boss fight before the whole teleportation/collapse scene (and yes, I followed those three changes that you listed, as well as the added code in the START_SCEN_STATE).

To think that I thought I had coding down, and then I just had to add the NPC... tongue

Link to comment
Share on other sites

Ah.

I guess I assumed START_STATE and START_SCEN_STATE were similar, since it was the scenario script... My mistake. tongue

Lemme give it another go then.

 

Edit: Success! The death code finally gets launched when Mari is slain by a creature! Thanks a bunch for the help, Nikki. I'll be sure to include you in the readme I still have to type. grin

Link to comment
Share on other sites

Don't mention it. It's not an ideal solution, of course, since it takes a turn between Mari dying and the text to show. Still, congratulations on finishing a scenario - you're now a better person! smile

 

(I'm going to go ahead and mess about with this still, though, since I'm really confused with the DEATH_STATE in the custom script. :p)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...