Author Topic: Monsters, death and counting  (Read 313 times)

Legacy_MaxVonk

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Monsters, death and counting
« on: December 29, 2010, 04:35:38 pm »


               Hi.

I have just started with NWN Toolset. I have created several areas and there are X number of monsters of various types in each area.

What Id like to do:
When the player kills the last monster in that area a message is shown about it and the player is transported to the next area. (Yeah I know - but start simple right?)

Problems:
At the moment I need to hard code the number of monsters in each area (as a variable attached to the mod to make it kind of global). On death 1 is subtracted until it reaches zero, but Id like to be able to detect how many monsters there are automagically. I could do this incrementally too, but in either case I need to know how many monsters there are. Better ideas anyone?

When the last monster is killed in an area I am unable to transport the player to the next area, nor can I work out how to display any kind of message telling the player what is (should be) going on.

When the final monster is killed in the final area I have no idea how to end the game (Iv not even got this far yet but its worth asking now).

Any kind of help would be much appreciated at this point. I know this is a simplistic mod, but I have to start somewhere and Id like to get it done so that it actually works before I move on to the next project.

Cheers

Max
               
               

               
            

Legacy_NorthWolf

  • Full Member
  • ***
  • Posts: 143
  • Karma: +0/-0
Monsters, death and counting
« Reply #1 on: December 29, 2010, 07:58:00 pm »


               Relevant functions for printing messages to players:

FloatingTextStringOnCreature
SendMessageToPC


The first is probably better suited to your purposes, as it's more visible when you're in the midst of something.

Relevant function for teleporting places:

JumpToObject

You can use a waypoint for this. Give it a unique tag (wp_area1 or somesuch), then GetObjectByTag to grab the waypoint and jump to it. You'll need to use AssignCommand to do this, most likely.

Finally, for the counting, I suppose you could use GetFirstObjectInArea and GetNextObjectInArea every time one of the creatures dies, but that's probably not the most efficient way to go about it.

I'd post more but I'm heading out, sorry!
               
               

               
            

Legacy_MaxVonk

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Monsters, death and counting
« Reply #2 on: December 30, 2010, 09:50:29 am »


               Thanks for that NorthWolf, Ill give things a try as soon as I can. Maybe Ill get lucky and someone will post some more answers in the meantime. '<img'>



Cheers



Max