Easygoing Eyebeast Xaiya Posted December 9, 2007 Share Posted December 9, 2007 How do you make them? I have looked and I can't find out how. I want to know how to do it for when the party attacks a certain friendly person. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted December 9, 2007 Share Posted December 9, 2007 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. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted December 9, 2007 Share Posted December 9, 2007 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. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted December 9, 2007 Share Posted December 9, 2007 If it's a friendly, important character, I can see why this is necessary. If it's just your personal cameo in your scenario, Iffy, then I'd say leave it alone and just make the character be level 100. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted December 9, 2007 Author Share Posted December 9, 2007 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. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Jeran Korak Posted December 9, 2007 Share Posted December 9, 2007 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. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Nioca Posted December 9, 2007 Share Posted December 9, 2007 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. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted December 9, 2007 Share Posted December 9, 2007 You'll also want to use Alint to check your scripts if you do much scripting. It's far more convenient to know where there are errors before you load the script in the game and it crashes. It'll help you catch things like the undefined variable sooner and more painlessly. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted December 9, 2007 Share Posted December 9, 2007 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). Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Callie Posted December 9, 2007 Share Posted December 9, 2007 Alint doesn't work on older platforms. I'm forced to do it the old-fashioned way. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted December 9, 2007 Share Posted December 9, 2007 Not meaning to sidetrack the topic, but what platforms are you refering to, Excalibur? Classic Mac OS? Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted December 9, 2007 Share Posted December 9, 2007 kill_char(1000,3,0) would work just as well as looping through the party. I'd do it that way. 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. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk John S Posted December 9, 2007 Share Posted December 9, 2007 Right now, the way the script works is if the party commits any crime, they will be killed. If the effect is specific only to the hostility of a character, though, you may want to use the character's hostility as a trigger. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted December 9, 2007 Share Posted December 9, 2007 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.) Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted December 9, 2007 Author Share Posted December 9, 2007 Well, what I want is a message to appear right before death. How is that done? And I am really confused with this. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted December 9, 2007 Share Posted December 9, 2007 Just put a message_dialog call with your message right before the death code. The message will be displayed, then the party will die. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted December 10, 2007 Share Posted December 10, 2007 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. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted December 10, 2007 Share Posted December 10, 2007 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. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted December 11, 2007 Author Share Posted December 11, 2007 It doesn't take that long to reload. Also, Iffy is the only one in the cave. So a message then death when you attack him would be okay without making a custom creature script. Edit -are you guys glad that I am finally making Muffins n' Hell? Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Nioca Posted December 11, 2007 Share Posted December 11, 2007 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 Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted December 11, 2007 Share Posted December 11, 2007 I'll second what Nioca said (and what the rest of the Creator's article said as well.) Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Ephesos Posted December 11, 2007 Share Posted December 11, 2007 I'm glad to see it happening, 'cause it means you're learning Avernumscript. And that means better scenarios down the road, as others have said. As for the specific content of the scenario, well, we'll see... I'm not exactly expecting Pulitzer-winning storytelling here. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Callie Posted December 12, 2007 Share Posted December 12, 2007 Quote: Edit -are you guys glad that I am finally making Muffins n' Hell? I...don't know. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 Quote: And also make sure to define the variable i. Otherwise, it thinks it's a mistake. Uh, what do you mean by "define the variable i"? Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast *i Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 6, 2008 Share Posted January 6, 2008 "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... Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 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 } }; Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 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; Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 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; Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Micawber Posted January 6, 2008 Share Posted January 6, 2008 ... and remove the word "short", in case Nikki didn't make that clear. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 Edit -Nevermind, fixed. Thank you. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Micawber Posted January 6, 2008 Share Posted January 6, 2008 You forgot to remove the 1. It should be get_crime_level() Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 6, 2008 Share Posted January 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 Okay, I tried putting a code that creates a dialoge box just before you die, but it didn't work. I tried using the "void message_dialog" call, but I must of not done it right. Where does it go? Is it the right call? Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Micawber Posted January 6, 2008 Share Posted January 6, 2008 If you included the word "void", you probably did it wrong. message_dialog("Why not peek at an existing scenario's scripts and copy paste what you need, changing where appropriate?",""); Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 6, 2008 Author Share Posted January 6, 2008 I placed it wrong. I got the message...every single step. Where should it go? Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 6, 2008 Share Posted January 6, 2008 Code: beginstate START_STATE; if(get_crime_level(1) > 0) { i = 0; while(i < 4) { kill_char(i,3,0); message_dialog("Your message",""); //HERE i = i + 1; } } Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted January 7, 2008 Share Posted January 7, 2008 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. 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. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted January 7, 2008 Share Posted January 7, 2008 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. </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... Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted January 7, 2008 Share Posted January 7, 2008 All this takes me back to '94 when I began to learn Logo... Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted January 7, 2008 Share Posted January 7, 2008 Yay Logo! That was the first "programming" language I ever learnt. It's almost amazing what you can do with it though. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Micawber Posted January 7, 2008 Share Posted January 7, 2008 Me too. A little earlier than 1994, however. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted January 8, 2008 Share Posted January 8, 2008 For me, it would have been later than 1994, I think. I would have been... um... seven in 1994? Something like that. I don't think I started learning Logo quite that early. I think it was after I got my first Mac (an LC 68k!). Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Xaiya Posted January 8, 2008 Author Share Posted January 8, 2008 Uh, what is "Lego"? 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.