Well-Actually War Trall Ishad Nha Posted February 16, 2010 Share Posted February 16, 2010 I am attempting to translate Mind Crystals from the Avernum trilogy into the Blades of Avernum game. Currently each Mind Crystal requires one state in the scenario script. To top that off, each state must be in the official zone of 10 thru 100. The reason is that you can record who used the custom item but not which item he/she used. Each state serves only purpose, to set a variable to record which item was used. beginstate 11; u = 445; set_state_continue(27); break; &&& My approach is to allow the relevant PC to only have one type of Mind Crystal in his/her inventory when it is used. Thus the char_has_item() call will return the number of the Crystal used. If he has more than one of the given type of Crystal, only one will be used. Click to reveal.. beginstate 11; d = who_used_custom_item(); c = char_has_item(d,445) + char_has_item(d,446) + char_has_item(d,447) + char_has_item(d,448) + char_has_item(d,449) + char_has_item(d,450) + char_has_item(d,451) + char_has_item(d,452) + char_has_item(d,453) + char_has_item(d,454) + char_has_item(d,455) + char_has_item(d,456) + char_has_item(d,457) + char_has_item(d,458); if (c == 0) end(); if (c == 1) { if (char_has_item(d,445) == 1) u = 445; if (char_has_item(d,446) == 1) u = 446; if (char_has_item(d,447) == 1) u = 447; if (char_has_item(d,448) == 1) u = 448; if (char_has_item(d,449) == 1) u = 449; if (char_has_item(d,450) == 1) u = 450; if (char_has_item(d,451) == 1) u = 451; if (char_has_item(d,452) == 1) u = 452; if (char_has_item(d,453) == 1) u = 453; if (char_has_item(d,454) == 1) u = 454; if (char_has_item(d,455) == 1) u = 455; if (char_has_item(d,456) == 1) u = 456; if (char_has_item(d,457) == 1) u = 457; if (char_has_item(d,458) == 1) u = 458; set_state_continue(27); } if (c > 1) { reset_dialog(); add_dialog_str(0,"You cannot use any Mind Crystal if you have crystals of different varieties in your possession.",0); add_dialog_str(1,"Choose one type of crystal to use then put the others on the floor or give them to other party members.",0); add_dialog_choice(0,"OK."); choice = run_dialog(1); } break; Section 27 actually invokes the crystal. beginstate 27; reset_dialog(); add_dialog_str(0,"As you stare deep into the Mind Crystal, you start to hear strange, whispering voices in your mind. The words are barely audible, but they seem to be trying to teach you something.",0); add_dialog_str(1,"You concentrate, and you start to get an impression of what ability the item is trying to teach you:",0); clear_buffer(); if(u == 445) append_string("Summon Beast"); if(u == 446) append_string("Call Spirit"); if(u == 447) append_string("Lay On Hands"); if(u == 448) append_string("Natural Curing"); if(u == 449) append_string("Go Berzerk"); if(u == 450) append_string("Inner Might"); if(u == 451) append_string("Defensive Glow"); if(u == 452) append_string("Blademaster"); if(u == 453) append_string("Anatomy"); if(u == 454) append_string("Gymnastics"); if(u == 455) append_string("Pathfinder"); if(u == 456) append_string("Magery"); if(u == 457) append_string("Resistance"); get_buffer_text(dlgstr); add_dialog_str(2,dlgstr,0); clear_buffer(); if(u == 445) append_string("This is the ability to summon aid to your side once per day. The higher your level, the better the aid you will obtain."); if(u == 446) append_string("This is the ability to communicate with the spirit world. In addition to always having someone to talk to, once per day you can summon a shade to aid you. The higher your level, the better the aid you will obtain."); if(u == 447) append_string("This blessing is a healing touch. Once per day, you can heal yourself. The amount of healing increases with your level."); if(u == 448) append_string("Merely by concentrating, you can purge yourself of disease and poison. This ability works once per day. The higher your level, the better the effect."); if(u == 449) append_string("You can cause yourself to go berserk, increasing your effectiveness in combat while enabling your foes to hit you more easily. This ability works once per day. The higher your level, the better the effect."); if(u == 450) append_string("This is the ability to bless yourself, increasing the effectiveness of your blows in combat. This ability works once per day. The higher your level, the better the effect."); if(u == 451) append_string("This is the ability to magically shield yourself, protecting you from enemy attacks. This ability works once per day. The higher your level, the better the effect."); if(u == 452) append_string("A Blademaster will get bonuses when using any sort of hand-to-hand weapon. The more of this powerful skill you have, the more likely you are to hit and the more damage you will do."); if(u == 453) append_string("Intimate knowledge of anatomy will help you with First Aid and aid you when fighting humanoids. Your blows will do more damage against humans and similar species."); if(u == 454) append_string("Nimbleness in combat is a great advantage. This skill makes you a leaping, spinning, fighting machine. Gymnastics skill makes you harder to hit and helps you act faster in combat."); if(u == 455) append_string("Pathfinder skill helps you find your way through hostile terrain. Your chance of being poisoned or diseased by swamps and the like is reduced. The more of this skill you have, the better the effect."); if(u == 456) append_string("Knowledge of Magery gives you intimate familiarity with the secret ways of magic. Any spell you cast will be more effective. The more you have, the better the bonus. You can't train in this skill."); if(u == 457) append_string("You have learned how to evade magical attacks. The more of this skill you have, the higher the chance of hostile magic (like fire and cold) doing less damage to you. You can't train in this skill."); get_buffer_text(dlgstr); add_dialog_str(3,dlgstr,0); add_dialog_str(4,"This crystal can only teach one character, so choose carefully whether or not to use it now.",0); add_dialog_choice(0,"Don't use it yet."); add_dialog_choice(1,"Use the crystal."); choice = run_dialog(1); if (choice == 2) { if(u < 452) set_state_continue(132); else set_state_continue(133); } break; beginstate 132; reset_dialog(); add_dialog_str(0,"You stare into the crystal. It teaches you a new ability.",0); add_dialog_str(1,"To use this ability, press the Use Ability button.",0); add_dialog_choice(0,"OK."); choice = run_dialog(1); if(u == 445) set_char_trait(who_used_custom_item(),15,1); if(u == 446) set_char_trait(who_used_custom_item(),16,1); if(u == 447) set_char_trait(who_used_custom_item(),17,1); if(u == 448) set_char_trait(who_used_custom_item(),18,1); if(u == 449) set_char_trait(who_used_custom_item(),19,1); if(u == 450) set_char_trait(who_used_custom_item(),20,1); if(u == 451) set_char_trait(who_used_custom_item(),21,1); take_item(u); break; beginstate 133; reset_dialog(); add_dialog_str(0,"You stare into the crystal. It teaches you a new skill.",0); add_dialog_str(1,"To see your new skills, look on the Character Info screen.",0); add_dialog_choice(0,"OK."); choice = run_dialog(1); if(u == 452) alter_stat(who_used_custom_item(),21,1); if(u == 453) alter_stat(who_used_custom_item(),22,1); if(u == 454) alter_stat(who_used_custom_item(),23,1); if(u == 455) alter_stat(who_used_custom_item(),24,1); if(u == 456) alter_stat(who_used_custom_item(),25,1); if(u == 457) alter_stat(who_used_custom_item(),26,1); take_item(u); break; Need protection against using the crystal for once a day abilities when the relevant PC already has the ability concerned. Quote Link to comment Share on other sites More sharing options...
Ineffable Wingbolt Dahak Posted February 16, 2010 Share Posted February 16, 2010 Not sure I understood everything tht you are looking for, but char_has_trait() will allow you to check to see if the character already has ability. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk nikki. Posted February 16, 2010 Share Posted February 16, 2010 Erm... why aren't you just making each unique Mind Crystal a different item? That way there isn't this messiness. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted February 16, 2010 Author Share Posted February 16, 2010 Each is a unique item, whole idea is to avoid unneccessary use of scenario states. Each Crystal uses one Scenario script state for no really good reason, just to record the item number of the item that was used. It also aims to reduce the use of tokens, which are finite in number. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted February 16, 2010 Share Posted February 16, 2010 I'm not sure you've saved enough of anything here for it to be worthwhile; with 14 types of mind crystals, giving each its own state wouldn't be all that prohibitive, and if each crystal began with its own state, where it set variables for its unique data (skill name, skill number, item type), and then jumped to a common state which actually implemented the use logic, you would use only 15 states and and still have the advantage of coalescing duplicate strings and code. Then you wouldn't have the bizarre problem of not be able to allow a character to use one mind crystal while holding another. Aside: Another script call that's missing: One to write the name of a skill, specified by number, into the text buffer. The game already has a table of skill names for its own use, but there's no way provided for a script to make use of it. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted February 16, 2010 Share Posted February 16, 2010 Originally Posted By: Niemand Aside: Another script call that's missing: One to write the name of a skill, specified by number, into the text buffer. The game already has a table of skill names for its own use, but there's no way provided for a script to make use of it. That doesn't seem all that problematic. Since the skills don't change number, as long as you know which skill you're talking about, you can write the skill name into the text buffer yourself. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted February 16, 2010 Share Posted February 16, 2010 It's true that you can work around it fairly simply; it just irks me that you have to waste some of your script's string constants on this when the game already maintains a set. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted February 17, 2010 Author Share Posted February 17, 2010 In the High Level Party Maker, it takes around 150 lines to enumerate traits and usable abilities possessed by the PC concerned. This is all due to the lack of a call to print out the name of a trait or ability. Quote Link to comment Share on other sites More sharing options...
Articulate Vlish Archaon Posted February 17, 2010 Share Posted February 17, 2010 I can think of a few workarounds, but they are pretty ugly. - Make one kind of item for all crystals. -Give crystals only through scripted events and use 1 sdf per skill to count how many crystals of each kind the party has. -Each time a crystal is used, display a message saying which effects are available and ask for input of what to use. The only problem is what happens when the party drops a crystal. To fight that, you could make a single item called “bundle of crystals” and only take it away when there are no crystals left. Alternatively, you could make crystals special items and use them through a custom special ability. All these methods use a single state, no matter how many kinds of crystals you have. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted February 17, 2010 Author Share Posted February 17, 2010 "Each time a crystal is used, display a message saying which effects are available and ask for input of what to use." Appending strings was something that Kel demonstrated in his scenarios, this should be straightforward. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted February 17, 2010 Share Posted February 17, 2010 Originally Posted By: Niemand I'm not sure you've saved enough of anything here for it to be worthwhile; with 14 types of mind crystals, giving each its own state wouldn't be all that prohibitive, and if each crystal began with its own state, where it set variables for its unique data (skill name, skill number, item type), and then jumped to a common state which actually implemented the use logic, you would use only 15 states and and still have the advantage of coalescing duplicate strings and code. Then you wouldn't have the bizarre problem of not be able to allow a character to use one mind crystal while holding another. This. Just make a separate state for each crystal. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Ishad Nha Posted February 17, 2010 Author Share Posted February 17, 2010 If an item is dropped it won't show up in the char has item call, this won't be a problem. Best solution is to use the appended strings method with the char has item call. If you want more than 15 items like this you would need more than 15 states. The snag here is that the scenario script must do custom everything: custom spells, items with customized abilities, custom abilities, books. Then it has to handle the usual scenario stuff. Now you can use states 10 thru 100 as initial states then transfer to other states beyond 100. Quote Link to comment Share on other sites More sharing options...
Articulate Vlish Archaon Posted February 18, 2010 Share Posted February 18, 2010 Now that I have thought of it more, it’s pretty simple: -Make each crystal a different Item, but have all of them call the same scenario state. -Use Has_item and append calls and make a list of all available effects the party is carrying. -Ask for input. I’d use something like the alchemy system in Frostbite, so that you can include flavor text, too. State limit is not a problem. One could easily write states in creature or terrain scripts, hide them in inaccessible points and call them through their start_state via sdfs. I recently did that with a cutscene and it worked. 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.