Jump to content

Instant death nodes


Xaiya

Recommended Posts

Try something like this in the START_STATE:

Code:
if(get_crime_level()>0){  kill_char(1000,3,0);}
Or, if that doesn't work:

Code:
if(get_crime_level()>0){  i=0  while(i<4){    kill_char(i,3,0);    i = i + 1  }}
(Maybe i<6 rather than i<4?)

 

Note: this should kill the party any time someone commits a crime. If you want it to run when a specific creature dies, you will have to give that creature a custom script - which could simply be a copy of basicnpc - and put the code in the DEAD_STATE, minus the if part.

Link to comment
Share on other sites

Yes, you will want 6 rather than 4 in that loop if there are any NPCs attached to the party whom you want to kill. kill_char(1000,...) should do all that neatly for you though.

 

I will comment that as a player, I hate use of this tactic to prevent the party from doing things the designer doesn't want; anything else is preferable to me. I'd personally prefer this to be used only as a last resort.

Link to comment
Share on other sites

Yes, Iffy is level 100. But if he is attacked, he will be hostile. And if he is hostile, the scenario might be impossible. So an instant death node makes sense.

 

Edit -Umm, I tried both and they don't work. Did I place this in wrong?

 

Code:
 begintownscript;variables; short body; beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); if(get_crime_level(1)>0){  i=0  while(i<6){    kill_char(i,3,0);    i = i + 1  }} 
Note that copy and paste makes it a bit weird.
Link to comment
Share on other sites

Level 100 means little, a GOD firebolt will blast a fire-resistant 2000HP level 100 character into dust with one hit. Then again thats what a GOD party is meant to be able to do but...

 

*Kicks self repeatedly*

 

Err um

 

Ah yes

 

As a script ignorant I'd like to know, would it be possible to have a script that would activate a death node that killed a PC if that script was set to kill the PC if his name was thus.

Link to comment
Share on other sites

Quote:
Originally written by Iffy:
Yes, Iffy is level 100. But if he is attacked, he will be hostile. And if he is hostile, the scenario might be impossible. So an instant death node makes sense.

Edit -Umm, I tried both and they don't work. Did I place this in wrong?

Code:
 begintownscript;variables; short body; beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); if(get_crime_level(1)>0){  i=0  while(i<6){    kill_char(i,3,0);    i = i + 1  }} 
Note that copy and paste makes it a bit weird.
Wrong state. The kill node needs to be in the START_STATE, not INIT_STATE.

And also make sure to define the variable i. Otherwise, it thinks it's a mistake.

Nija - It depends on where the fire resistance comes from. If 25% fire resistance is coded into the data script for that creature, it'll always block at least 25% of incoming fire damage. Same applies to Ice, Magic, Mental, Poison/Acid, and Physical. So if one sets Magic resistance in the data script to 100%, that creature becomes completely immune to energy-based attacks, god party or not.
Link to comment
Share on other sites

Quote:
Originally written by Buckshot Party:
Level 100 means little, a GOD firebolt will blast a fire-resistant 2000HP level 100 character into dust with one hit. Then again thats what a GOD party is meant to be able to do but...
Yes, god parties break scenarios and we know this. Everybody knows this.

Quote:
As a script ignorant I'd like to know, would it be possible to have a script that would activate a death node that killed a PC if that script was set to kill the PC if his name was thus.
...so you're asking if a script could kill PCs with a certain name? I'm afraid I don't understand what you were trying to say (nor do I understand why you'd do this).
Link to comment
Share on other sites

Well in this case it amounts to the same thing, because if they commit any crime the town (and thus that NPC) will go hostile.

 

But yeah, if you want to auto-kill for attacking an important NPC, you should probably put the autokill code in that NPCs death state. There are basicnpc edits that call town states on death, I'd advise using one so you don't have to write a whole new custom script for said creature (Scripts that add functionality to basicnpc are a good thing to have so you can do simple tasks without writing whole new scripts.)

Link to comment
Share on other sites

Okay. If it's only for when you kill a specific character, go into the Blades of Avernum Files folder, and copy basicnpc.txt into your scenario's folder. Rename it Iffy.txt (or whatever you like). Open it up, and replace the DEAD_STATE with this:

Code:
beginstate DEAD_STATE;    message_dialog("Your","Message");    kill_char(1000,3,0);break;
Then set Iffy as your character's script.

 

That should work.

 

(Note: I omitted the set SDF code because it won't do anything if you die right after.)

 

You could probably also alter it to be triggered when you attack the character, but I'm not sure how you would do that. It would still require the Iffy.txt though.

Link to comment
Share on other sites

Quote:
Originally written by Niemand:
I will comment that as a player, I hate use of this tactic to prevent the party from doing things the designer doesn't want; anything else is preferable to me. I'd personally prefer this to be used only as a last resort.
As a designer, I find that kill nodes are bad, too. It makes beta-testers cry. Of course, if you try to kill the uber-boss guy, you're not going to get off lightly, but still.

I like to put in a warning, and then boot the party out of the scenario, with a end_scenario(2) call - in game, I'd say they were exiled from town or whatever. Much nicer, and the player doesn't have to reload.

Quote:
Originally written by Lazarus:
And you can get by fine without Alint, I never use it (command line is teh suk) and I know TM doesn't either, although he doesn't have that excuse.
I've used it once or twice. I think I was getting weird errors in TV, and I couldn't work out why. Turns out setting memory cells above the expected limits is bad.
Link to comment
Share on other sites

So long as it doesn't amount to Foul Hordes version 2, then yes, I'm glad. Because it means not only will we have another scenario in our community, but it may just lead you onto bigger and better scenarios. As the wise Creator said:

Quote:
Then, finally, it out there for people to play! Congratulations! You have

just released your worst scenario!

 

Please note that this is not an insult. Your scenario might be very good -

but even then, your next scenario will almost certainly be better.

- Excerpt from Your First Scenario by The Creator

Link to comment
Share on other sites

  • 4 weeks later...

Take a look at any of Jeff's scenario town scripts. Near the top, you will see a section for variables. You will often see:

 

int i, j

short choice

 

"i", "j", and "choice" are variables that are used throughout the script. You may define your own. Read the section on it in the documentation. If this gives you trouble, read up on the BASIC programming language. It should give you a basic understanding of the variable.

Link to comment
Share on other sites

I'm still confused. I don't see how i isn't defined.

Here is the whole script:

Code:
 begintownscript;variables; short body; beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); beginstate START_STATE;if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } } 
Man, the copy and paste thing acts up with Notepad.
Link to comment
Share on other sites

"Defining i" can be said much more clearly by saying "tell BoA that you are going to use a variable called 'i'".

 

So, firstly, I'm assuming you know what a variable is. It's a number (usually) that either changes in value, or that you don't know the value of. Think alegbra in the example I'm about to show you, i = 3.

 

Code:
  i + 2 = 5. 
i is the variable, since we didn't know what it was until we did the equation.

 

Now, in order to tell BoA that you are going to use a variable, you have to write it down in the script. So, under the variables; line, you'd write "int i;" (but without the quotation marks).

 

E.g:

 

Code:
begintownscript;variables; int i;body;
See? The "int" bit just tells BoA that the variable is an integer, or, basically, a whole number. You can also use the term "short", (by writing "short a;" for example, though I'd just stick to int for now.

 

Hope that's clearer...

Link to comment
Share on other sites

Thankyou, that helped.

 

But now it is saying: t3 Error: State not ended properly in line 18.

 

And I don't see any problem at all

Here is the script:

Code:
 begintownscript;variables; short body; int i; beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); beginstate START_STATE;if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } }; 
Link to comment
Share on other sites

The key word "beginstate" does just what it says and begins a state. Each state must then be ended by using the "break" keyword. Like this:

Code:
beginstate START_STATE;//the contents of the statebreak;
You need one break for every beginstate, and you can't begin another state until you've ended the previous one.
Link to comment
Share on other sites

I see a few errors.

 

1)The variable needs defining before the "body" bit of the script. It's annoying at first, but you'll get the hang of it. The order is:

 

Code:
begintownscript;variables;int i; //THIS IS WHERE IT HAS TO GO!!body; 
2)Both the INIT_STATE and START_STATE need a "break;" command at the end. This is the "state not ended" thing. A "break" call tells BoA you've finished that bit of code. Look:

 

Code:
beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); break; //YOU'RE MISSING THISbeginstate START_STATE;if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } }; break; //AND THIS - IT TELLS BOA WE'RE DONE.
Link to comment
Share on other sites

Thank you, that fixed the problem yet another one came up.

 

t3: Bad expression in line 22

I don't get what a "Bad expression" is.

 

Code:
 begintownscript;variables;  int i; short body; beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); break; beginstate START_STATE;if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } }; break; 
Link to comment
Share on other sites

A bad expression is a mathematical formula that BoA doesn't like. Usually 'cus you've done something wrong...

 

It's this line:

 

Code:
 if(get_crime_level(1)>0){i=0 while(i<4{ kill_char(i,3,0); i = i + 1 } }; 
It should be:

 

Code:
 if(get_crime_level(1) > 0) {    i = 0;    while(i < 4) {        kill_char(i,3,0);        i = i + 1;     }} 
It's not necessary to write code out like that, but it helps when starting out because you can see which if calls do what.
Link to comment
Share on other sites

I fixed it, but it still says it.

And I can't identify what is wrong.

 

Code:
begintownscript;variables;  int i; short body; beginstate INIT_STATE;// Setting crime low because Iffy is easily annoyed.set_crime_tolerance(1); break; beginstate START_STATE;if(get_crime_level(1) > 0) {    i = 0;    while(i < 4) {        kill_char(i,3,0);        i = i + 1;     }} ; break;
Link to comment
Share on other sites

Technically writing it all as one line is fine (Although it's DEFINITELY not advised) but the real problem is that your while statement doesn't close parentheses. This can be spotted fairly easily if you follow Nikki's advice and split your code into multiple lines, and it's advisable to do so for a myriad of other reasons as well (I started out making the same mistake and writing code as one line like that-- it wasn' pretty. Do yourself a favor and stop right now.)

 

Edit: And you fixed it in that post. The new problem is the final ";" you only use semicolons at the end of a call, not after parenthesis or brackets.

 

Edit2: Huh, so get_crime_level() doesn't take a town number as an arguement-- makes it awkward to pull an Anama kind of deal and make a whole province pissed off.

Link to comment
Share on other sites

Code:
begintownscript;

variables;

int i;
short //YOU DON'T NEED THIS BIT.

body;

beginstate INIT_STATE;

// Setting crime low because Iffy is easily annoyed.
set_crime_tolerance(1);

break;



beginstate START_STATE;


if(get_crime_level() > 0) { //YOU DON'T NEED A ONE IN THE BRACKETS
i = 0;
while(i < 4) {
kill_char(i,3,0);
i = i + 1;
}
} //YOU DON'T NEED A SEMI-COLON HERE
break;
Remove my comments, and it should work.
Link to comment
Share on other sites

Quote:
Originally written by Lazarus.:
Edit2: Huh, so get_crime_level() doesn't take a town number as an arguement-- makes it awkward to pull an Anama kind of deal and make a whole province pissed off.
A SDF is probably how Jeff did it in A3, I'm guessing; although including an option to take town numbers would be nice, it's not much more work to do it the long way.
Link to comment
Share on other sites

Quote:
Originally written by Funkadelic:
Code:
 beginstate START_STATE;if(get_crime_level(1) > 0) {    message_dialog("Your message",""); //HERE      i = 0;      while(i < 4) {        kill_char(i,3,0);       i = i + 1;        }} 
FYT. :p

Void and short are used in the appendix to tell you what type of call it is (Specifically whether or not that call returns a value.) You never actually write short get_health() or void message_dialog(), just the actual call.
Link to comment
Share on other sites

Quote:
Originally written by Lazarus.:
Code:
 beginstate START_STATE;if(get_crime_level(1) > 0) {    message_dialog("Your message",""); //HERE      i = 0;      while(i < 4) {        kill_char(i,3,0);       i = i + 1;        }} 
FYT. :p
</strong></font><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica, sans-serif">The stupid thing is, I was writing out instant death nodes for my own scenario when I wrote that, and, looking at my scripts, I did it wrong there too...
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...