Ambrosia Garden Archive
    • Hostile NPC Problem


      Hello everybody! I seem to have a problem here: when I "manually" delete a hostile NPC, the engine reads that he's still here. I suspect the problem may be that I have things going on while the hostility is in progress, but can't figure out how to change that. Here's the situation:

      I made an NPC that's a tax collector.

      He's a hostile NPC, so that he can initiate dialogue (the Player does not make the initial contact with a passive NPC; who would, when the Player knows he's collecting taxes?!).

      The range weapon, which is a simple white graphic, hits the Player that then begins a series of events. The engine reads that the Player has gained x amount of money since the last time the tax collector collected (income). Then the income is divided by ten to determine how much tax the Player owes. The tax collector then takes the tax. (Actually, I give the Player a choice to pay or not to pay at this point, and if he doesn't, he's in trouble.) I delete the NPC as part of this event process. I haven't yet placed this in a timer (which I'm not worried about as I've done this quite a lot before), but all of this works well and is stable.

      But once all of this runs and when the Player continues the game, he can't do any passive events. When I try to save, the dialogue comes up that you can't save while a hostile (something) is nearby. It's like an echo. I've tried deleting the NPC with the "kill" option, and the same thing happens. I've tried replacing the range weapon with a spell, and the same thing happens. I've also tried using the white as a regular weapon and the same thing happens. Actually, I've tried everything I can think of.

      Any help would be appreciated. I won't be able to look at this again until tomorrow, Monday, so I thank you now!!

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

    • This is what you may be experiencing

      When you kill an npc via the npc control the engine does not remove it from the &&CounterHostileNPCs; ( which might be an array or just a plain variable...either way it doesn't subtract one from it.)...search the beta list, should be called aptly called 'Ghost in the machine' or something to that accord.

      other known issues, when killing an npc ( by attacking in game ) that has a white frame as its picture, will cause the invisible npc to take on your mirror image ( snap shot of your current frame, adjust it for direction,) then fade out.

      In short the engine doesn't clean up after itself very well, i'm still unclear as to what variables you're testing, seems &&EncounterInProgress; however you might want to create two custom variables/global

      &&gb;_lastTime set this to 0 somewhere @ the start
      &&gb;_thisTime set this to 1
      this bit would fit nicely into main

      in the event that launches a new tax collector check if &&gb;_lastTime is different of &gb;_thisTime
      if so then launch the tax collector
      else add 1 to &&gb;_lastTime

      this will keep the balance the inequality, when its time to send out the tax collector you need to unbalance it
      by adding one to &&gb;_thisTime.

      as it stands the variables' values will continue to chase each other,autonomously managing themselves...assuming there are no other references/changes made to variables outside of the timer animations event...

      ------------------

      ... ** Big O..ACTION!**

    • Quote

      Originally posted by ellrx:
      **
      When you kill an npc via the npc control the engine does not remove it from the &&CounterHostileNPCs; ( which might be an array or just a plain variable...either way it doesn't subtract one from it.)...search the beta list, should be called aptly called 'Ghost in the machine' or something to that accord.
      **

      Humm, looks like this is what's happening. Thank you, ellrx. The NPC isn't white; the weapon is white. I believe I already have the globals to control both the tax collector NPC's appearance and the number of times the NPC attacks. I apologize if this isn't what you were communicating.

      I don't know what a beta list is -- if it has to do with plugins, I've never made one. I'm sorry. After it all runs and I try to save, the dialogue window tells me that I can't save when an attack is in progress. That's how I know, anyway.

      Is there any way I can manipulate &&CounterHostileNPCs; to stop the encounter? Is this a bug in the engine?

      Thanks, again, ellrx..... Waiting for a plane ... and waiting ... and waiting ...

      (edit) I'm aware that I CAN use alternate methods. I could make the NPC passive, and have the tax collector increase stamina so that perhaps the Player will want to pay up. Or I can not run it from an NPC at all, but when the Player enters a map at a certain time, or step on an event tile. Perhaps it would work best, if I have to have an alternative method, to have it happen in an interior, which is a much smaller map size with passive NPCs in the room, but the Player would step on an event tile just as soon as he entered the room. I'd just like to have it all come from an NPC. Thanks again! And still waiting ....

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

      (This message has been edited by Debra (edited 04-04-2004).)

    • beta list = Beta Testing eMail Mailing List, where we document problems with the engine, and give feedback, essentially i said the exact same thing i said here.

      You can't directly effect &&CounterHostileNPCs; the only thing you the builder can do, is test its value.
      It is a bug in the engine, it not cleaning up after itself and removing alll references when "disposing" of an NPC.

      I do not know of a way to turn off these variables, if EncounterInProgress is active its probably wouldn't readjust to the proper value until you got into and out of an actual encounter with another/"normal" npc...they're strictly look but don't touch.

      ------------------

      ... ** Big O..ACTION!**

    • Ah! I see. I'll then turn to an alternative. Have the tax collector in an interior and initiate the event array when the Player enters the room. I'm doing this in other instances anyway. It will seem to the Player at the time as if the NPC is initiating dialogue, which is good enough!

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

    • I think another solution (though very clunky) would be to teleport the player to another map. Perhaps the tax collector drags the player off to an accountant to make sure he gets the right amount. That way you can have your encounter, teleport the player to another map, have a few more encounters, and drop the player back where he/she started.

      ------------------
      Cha0s
      (url="http://"http://www.world-of-cha0s.hostrocket.com")The Homepage of Cha0s(/url)

    • Odd lil' snippet,
      do not use this sequence of actions wihtin a single event to reset the number of npcs,

      teleport to main location
      wait ( i tried 1,2 and 3 seconds )
      map position
      teleport back to map

      i ended up having to create a dummy map to wipe the slate clean, mind you the medieval demo does this as well,

      their specific reason as to why are unknown, they label it as clearing the map cache and teleport to a small map filled with black tiles...

      Which I've found is pretty much a transparent measure.

      ------------------

      ... ** Big O..ACTION!**

    • Does this ghost in the machine happen whenever you kill an NPC, or just when you manually delete an aggressive NPC?

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

    • I've only thoroughly tested it with the NPC control..

      ...it is possible in some other cases that it wouldn't clean up, but i haven't had an issue with it,

      ways to test, event with a dialog action, with:

      total NPCs: &&CounterNPCs;
      friendlies: &&CounterPassiveNPCs;
      potential foes: &&CounterAggressiveNPCs;
      engaged combatants: &&CounterHostileNPCs;

      or something to that effecct as its contents...

      ------------------

      ... ** Big O..ACTION!**

    • Thanks! This would be a nice way to keep track of these things via a keydown while making the game.

      One of the most important things to me is the stability of the game. I can't quite get my mind around the cleaning up the NPCs from a map thing. But I'm now going for the ILLUSION of dialogue being initiated by an NPC, which I've actually succeeded in doing. The tax collector can't be in an exterior "world" map, as I can't effectively determine where the Player will step. I can, however, connect to the tax event array in an interior, since the Player is transported to a room and he'll more likely than not step further into the room, especially to gain the goodies. So I've surrounded the entrance/exit with a tax array event on several movement tiles on the map. And with globals, I've both controlled the timing of the tax event (couldn't put it on a timer to work right, so the engine counts the number of times the Player walks over the map event) and have matched the event on the map with an NPC showing up in the interior. So the Player enters a particular interior (several, actually) and he walks over the map event a certain number of times (I have 52 times). The event will not happen without the NPC present, so when he walks over the event equal or more than 52 times, the tax array doesn't just pop up. The Player has to enter an interior geared for the tax collector array to happen after 52 times, and the Player now sees a PASSIVE NPC who tries to reach the Player. The Player moves a little bit and the tax array runs. I've not seen anything at all buggy about deleting a passive NPC, so that should remain stable. During the tax array run, the passive NPC is replaced with another passive NPC, Taxcollector2, at &&actual;_x and &&actual;_y so that the NPC doesn't follow the Player around, but is still the tax collector. Then it starts all over again. Anyway, the illusion works this way, it's interesting, and it's not predictable. Whew! Thanks for your help! I do hope that they can get this particular bug out of the engine.

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

      (This message has been edited by Debra (edited 04-06-2004).)

    • There may be an issue with deleting passive NPCs, but because you can't fight an NPC &&EncounterInProgress; (and &&HostileNPCCounter;) ignore them, so it doesn't matter.

      Also, you could instead: freeze the player, order a passive NPC to the tile above the player (or to the left, the right, etc.) and then, on reaching that location, initiate the dialog... oh shoot. Ignore all that: no tag values in the NPC coordinate fields (out of curiosity, has anyone tried typing &&gb;_xxx ?). Anyway, it sounded good until i remembered that snag... :frown:

      Good luck with it!

      ------------------
      Cha0s
      (url="http://"http://www.world-of-cha0s.hostrocket.com")The Homepage of Cha0s(/url)

    • There is no snag, and tags won't work.

      to order an npc to the player's exact coordinates use the npc control with the coords for adding the NPC
      &&PlayerX;, &&PlayerY;
      ( the engine will put the npc in the first available space, same as it does when you attempt to throw a large number of unique items @ the player's position )

      but to give some ( "actual" ) distance set up two of your own variables
      freeze the player
      set the variables/globals equal to the value of &&PlayerX;,&&PlayerY;
      then subtract or add however much to give the npc its map offset.

      either way,
      make the npc set to try to reach the player.

      ------------------

      ... ** Big O..ACTION!**

    • Thanks. I've placed the NPC control in the location def, so the NPC is there when the Player enters the map and consequently the room. Setting the NPC to try to reach the Player, even though the NPC is just a few movement tiles away from the Player, works just fine by itself. It creates the illusion that the NPC is initiating the dialogue (part of the tax collector event array). Thanks again!

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

    • Wow... I feel stupid. Why didn't I realize that in the first place? 😛

      ------------------
      Cha0s
      (url="http://"http://www.world-of-cha0s.hostrocket.com")The Homepage of Cha0s(/url)

    • What comes to my mind about you certainly is not the word stupid.

      ------------------
      -- Debra
      Danillitphil Productions
      (url="http://"http://www.danillitphil.com/graphics/index.html")www.danillitphil.com(/url)

    • Well, I should have looked at what you were trying to do more closely. I sort of forgot some stuff about NPC commands...

      The last math test though (Algebra 2 is SO annoying)... Meh, I made up for it English. 😉

      ------------------
      Cha0s
      (url="http://"http://www.world-of-cha0s.hostrocket.com")The Homepage of Cha0s(/url)