Jump to content

spyderbytes

Member
  • Posts

    200
  • Joined

  • Last visited

    Never

Posts posted by spyderbytes

  1. Umm... that doesn't answer my question (perhaps I asked it badly?). Food items do show up in inventory. What I'm wanting to do is to give the player a choice to give a (generic) food item to a NPC.

     

    Obviously, the option should only come up in dialog if someone in the party actually has a food item. But I don't care WHAT particular food item (fish, bread, steak, whatever) it might be.

     

    So... do I have to check for each food item the party MIGHT have individually (until I find one or work through every possible food item), or is there an easy way?

     

    -spdyerbytes

  2. Quote:
    Originally written by Drakefyre:
    It's usually spelled 'dialogue'. Dialog boxes are boxes that pop up with options for you to choose.
    Umm, not to quibble (OK, maybe I'm quibbling just a bit wink ), but AFAIK, 'dialogue' is simply an archaic spelling of 'dialog' (the modern, more accepted spelling). They're called dialog boxes because it's a metaphor for carrying on a conversation between you and your computer. smile

    To the subject at hand: this looks terrific! Thanks for doing this! smile

    -spyderbytes
  3. There are probably some optimizations that can be made to this (I'm an Avernumscript noob), but it should be pretty safe and generic. Enjoy! smile

     

    Code:
      // cpoisonspit.txt// Much like basicnpc, but creature spits poison every other round at anyone in the// party in an adjacent and visible location. Also includes logic for granting an optional// special item after a number of these cretures specified in Memory Cell 4 have died.// Memory Cells://   Cell 0 - How creature moves.//     0 - If 0, wander randomly. //     1 - Stands still until a target appears.//     2 - Completely immobile, even if target appears.//   Cell 1,2 - Stuff done flag. If both 0, nothing. Otherwise when each of these dies, //     flag is incremented.//   Cell 3 - Dialogue node to start with if talked to. if left at 0, this//     character doesn't talk.//   Cell 4 - Number of these things to die before a special item is granted. If 0, no//     special item is granted.//   Cell 5 - Special item to grant on death.//   Cell 6 - Number of dice for poison damage//   Cell 7 - Size of dice for poison damagebegincreaturescript;variables;short i, target, last_abil_time, distance, max;body;beginstate INIT_STATE;  if (get_memory_cell(0) == 2)    set_mobility(ME, 0);  last_abil_time = get_current_tick();  // uesd to determine when to spit poisonbreak;beginstate DEAD_STATE;  // Increment the appropriate stuff done flag for this character being dead  if ((get_memory_cell(1) != 0) || (get_memory_cell(2) != 0)) {    inc_flag(get_memory_cell(1), get_memory_cell(2), 1);      if (get_memory_cell(4) != 0 && (get_memory_cell(4) ==         get_flag(get_memory_cell(1), get_memory_cell(2)))) {       // only want to do this after specified number of these die      // give the special item      change_spec_item(get_memory_cell(5), 1);        // make it more obvious to the player that a special item was found      play_sound(0);  // high beep      message_dialog("Your message here...",         "(You have gained a special item. Check the Character Info screen to examine it.)");    }  }break;beginstate START_STATE;   // if I have a target for some reason, go attack it  if (target_ok()) {    if (dist_to_char(get_target()) <= 16)      set_state(3);      else set_target(ME, -1);    }    // Look for a target, attack it if visible  if (select_target(ME, 8, 0)) {    do_attack();    set_state(3);    }      // Have I been hit? Strike back!  if (who_hit_me() >= 0) {    set_target(ME, who_hit_me());    do_attack();    set_state(3);    }      // Otherwise, just peacefully move around. Go back to start, if I'm too far  // from where I started.  if ((my_dist_from_start() >= 6) || ((my_dist_from_start() > 0) && (get_memory_cell(0) > 0))) {    if (get_ran(1, 1, 100) < 40)       return_to_start(ME, 1);    }    else if (get_memory_cell(0) == 0) {      fidget(ME, 25);      }  // if we're in combat and the above didn't give me anything to do, just  // stop now. Otherwise, game will keep running script, and that eats up CPU time.  if (am_i_doing_action() == FALSE)    end_combat_turn();break;beginstate 3; // attacking  if (target_ok() == FALSE)    set_state(START_STATE);      // time to spit more poison?  if (tick_difference(last_abil_time, get_current_tick()) > 1) {    max = party_size();    i = 0;    while (i < max) { // loop through party      distance = char_dist_to_loc(i, my_loc_x(), my_loc_y()); // how close is this char?      if (distance == 1 && (can_see_char(i) == TRUE)) {        print_named_str(ME, " spits poison!");        play_sound(42); // acid spray -- close enough for poison, I reckon         damage_char(i, get_ran(get_memory_cell(6), 1, get_memory_cell(7)), 2);      }      i = i + 1;    }    last_abil_time = get_current_tick();  }    do_attack();break;beginstate TALKING_STATE;  if (get_memory_cell(3) == 0) {    print_str("Talking: It doesn't respond.");    end();    }  begin_talk_mode(get_memory_cell(3));break;
    -spyderbytes
  4. At the risk of making a pest of myself, I'd like to know why this doesn't work. smile I decided to code around the problem with damage_near_loc passing through walls, and came up with this:

     

    Code:
    beginstate 3; // attacking	...stuff here that's ok...			// time to spit more poison?	if (tick_difference(last_abil_time, get_current_tick()) > 1) {		// don't use damage_near_loc, because it damages where it shouldn't		i = 0;		while (i < 4) {			distance = char_dist_to_loc(i, my_loc_x(), my_loc_y());			if (distance == 1) {	// character is adjacent				print_named_str(ME, "spits poison!");				play_sound(42); // acid hiss				damage_char(i, get_ran(3, 1, 3), 2);			}			i = i + 1;		}	}		do_attack();break;
    That seems to me as if it should work, but any character that's adjacent ends up taking damage four times, instead of only once. So where did I go wrong?

     

    -spyderbytes

     

    EDIT: DOH! It's always the simple gotchas. laugh Adding last_abil_time = get_current_tick(); before the last curly bracket makes it work as expected. Sorry 'bout dat!

  5. You wouldn't need AoE spells to have what (to me) would be correct behavior for this call. Seems to me it would just be a check with the pathfinding algorithm to see if the path from the damager's current loc to the loc in question is range squares or less. Sure, my spider COULD go out the door, around the building and into the shop in question, but not in 'range' moves. So it shouldn't do damage there.

     

    Of course, not knowing the particulars of the implementation, such a call to the pathfinding algorithm might be prohibitively expensive. In that case, current behavior would be correct (not to say optimal wink ).

     

    -spyderbytes

  6. OK... I decided my spiders still weren't quite challenging enough, so I decided to have them spit poison every couple of turns to soften up the melee types standing adjacent to them and hacking at them. damage_near_loc seemed the perfect candidate for that, and works perfectly EXCEPT... a shopkeeper on the other side of a stone wall from the spiders also gets poisoned. smile

     

    It's a simple enough matter to move the shopkeeper far enough away from the wall to not get poisoned. I just expected intervening impassible terrain to block the damage, so I'm wondering if the current behavior is intended or a bug.

     

    -spyderbytes

  7. Quote:
    Originally written by Imban:
    I guess what I'm trying to say is that designers have to remember that they're making a game, not a novel. While a good plot can certainly make a scenario more enjoyable, challenging, fast-paced, fun, and unpredictable gameplay goes so much further.
    While hoping I can avoid adding fuel to a smouldering fire, I have to say I completely agree with that statement. In a CRPG, story is a vehicle and gameplay is the driver. While most people would prefer to ride in style in a luxury vehicle, just sitting in one that isn't going anywhere isn't overly enjoyable--or at least not for long. smile

    "Story" seems to be the Holy Grail that has replaced "realism" in what hardcore fanatics ask for these days. Don't get me wrong, both are Good Things and need to be there--but both also need to take a back seat to fun when they get in its way.

    As I'm sure someone will see fit to question my credentials for making such a statement, I'll say I spent many a year doing professional game design. I'm retired now (for health reasons), but the principals remain unchanging.

    I've read the reviews of Jeff's scenarios, and have to respectfully disagree with many of the negative comments. Are his scenarios perfect? Far from it. Could they have better stories? Most likely. But story served its purpose in them, to me at least. It kept me interested enough to play the scenarios through to the end (and I assure you there are many, many CRPGs I can't say that for)--and have fun by doing so. That's what games are all about. smile

    -spyderbytes
  8. Actually, my jug-guardian spiders already have a custom script for some custom targeting AI, so that part isn't a problem. What was originally holding me up was trying to figure out how to give the special item when the last spider died, and not for each one (and that's why I wanted to place it in a nearby container, as I would a normal item).

     

    But then I discovered friends_nearby, and now all's well with the world. smile I've changed it so I'm granting the special item when friends_nearby returns 0 (meaning all the others are already dead when this one dies). So, problem solved. smile

     

    Thanks for the help!

     

    -spyderbytes

  9. Quote:
    Originally written by Drakefyre:
    Well, you'd have to give it to the party in a script.
    I knew I didn't see any other way, but I thought (hoped?) I might have been missing something. smile

    Quote:
    Generally, putting special items in crates and barrels is a bad idea because they can be pushed around, which would mean that your special node would sometimes be on a space without the crate. Using a chest or some sort of terrain would be better.
    Hmm... good point. I'm actually accomplishing pretty much exactly what I want with a normal ol' item right now. The only reason I was thinking of making it a special item is that it's the item necessary to complete a quest, and it looks like junk (actually it is... the scenario I'm working on is a lampoon of the worser variety of homegrown CRPGs wink ).

    It's basically just the jug item. But I made mine with an icon color shift and gave it a slightly different name, so maybe that will be good enough. I just didn't want the player leaving it behind or throwing it out because s/he thought it was junk if s/he stumbled across it before receiving the quest to "FedEx" it to the NPC too lazy to get it himself. laugh

    -spyderbytes

    (edited for grammar)
  10. Ah... no wonder I couldn't tell any difference switching a lone hostile creature back and forth between Type A and Type B. laugh

     

    I hadn't even gotten around to thinking about factions yet, but nice to know it's covered, at least in a basic fashion. smile

     

    -spyderbytes

  11. The docs for special items seem pretty skimpy (to say the least). confused Is it possible for the party to find a special item in, say, a crate (after killing the monster guarding it)? Or does it have to be granted programmatically?

     

    If the former will work, how? I can't figure out how to place anything but regular items in the editor.

×
×
  • Create New...