Plese, help "ON DEATH" scripts and a comun chest in several areas

Hi… cold you help me about this ?:

1) I use this as triigger on death bad boys , but i have meny invocaded creatures INDEPEDENTS
//Put this script OnDeath
void main()
{

object oPC = GetLastKiller();

while (GetIsObjectValid(GetMaster(oPC)))

  • {*
  • oPC=GetMaster(oPC);*
  • }*

if (!GetIsPC(oPC)) return;

}

Coud i change it runs just when the monster is killed, but not by me or henchman?

2) On death I use this:

//Una variada seleccion de objetos al morir .

void main()
{

object oPC = GetLastKiller();

while (GetIsObjectValid(GetMaster(oPC)))

  • {*
  • oPC=GetMaster(oPC);*
  • }*

if (!GetIsPC(oPC)) return;

if (d100()>50)

  • return;*

object oTarget;
object oSpawn;
location lTarget;

  • oTarget = OBJECT_SELF;*

  • lTarget = GetLocation(oTarget);*

  • oSpawn = CreateObject(OBJECT_TYPE_ITEM, “nw_it_picks002”, lTarget);*

  • if (d100()>50)*

  • return;*

  • oTarget = OBJECT_SELF;*

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_ITEM, “it_sparscr006”, lTarget);

  • if (d100()>50)*

  • return;*

  • oTarget = OBJECT_SELF;*

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_ITEM, “it_spdvscr005”, lTarget)

}

As you see, it have a posiblity of create several item… ¿Could it drop this especif item aleatory instead?
You know:
or, or…or

----- -----
3) ¿Could i have mi adventure chest, the way if a drop in , other chest in other zone contain it?

THANKS : )

What does this word mean? I’m sorry, but I don’t know.

  1. So, you want the script to run ONLY if the creature is killed by another NPC and not the PC or the henchman?

I think it would be easier for us to read your script if you put mark them as preformatted text like this:

code here

Edit: Maybe something like this would work, I don’t know (it’s untested), since I only work with NWN2, but maybe you could try it:

//Put this script OnDeath

void main()
{

object oPC = GetLastKiller();

object oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN);

if(GetIsPC(oPC) || oPC == oHench) return;


}

That is!, with the “self power only”, i have scripted a several invocation army :smiley:

As the created creatures are abundants, they go as free Defender NPC.
and i would like get the “on death” runs when NPC is killed by them or by me &henchman :).

Eh…sorry, but I don’t quite understand. Did my script work, you mean?

1 Like

You would like the on death script to run when the NPC is killed by another NPC or by the PC or the henchman? Eh…what? If that is the case you wouldn’t need any particular script rather than the normal OnDeath script. Sorry, I don’t get this at all… :upside_down_face:

Maybe someone else can help you…

1 Like

That is!! When a NPC is killed by other NPC or by me&henchemen
Its means, when is killed , really
Lool!!
thanks for helping :yum:

What do you think about the other (drop a random item of many specifics ones ) and the adventured chest?

I’m sorry, I really don’t understand the other question at all. Maybe someone else can help you.

==> acqui :

…buscas el pc. pero no es necesario por lo que quieres hacer.

si quieres una variadad aleatoria de articulos con la misma probabilidad para cada articulo cuando el monstruo muere, puedes hacerlo de esta manera :


void main()
{
    object item;

    switch(Random(3)) {
      case 0:
        item = CreateItemOnObject("nw_it_picks002"); // crear un articulo en OBJECT_SELF [el predeterminado]
        break;
      case 1:
        item = CreateItemOnObject("it_sparscr006");
        break;
      case 2:
        item = CreateItemOnObject("it_spdvscr005");
        break;
    }

    if (!GetIsObjectValid(item))
        PrintString("ERROR al crear del articulo");
}

si, en cambio, quieres que el cofre tiene el articulo, y no el monstruo, puedes hacerlo de una moda similar :


void main()
{
    object cofre = GetObjectByTag("MI_COFRE");
    if (!GetIsObjectValid(cofre)) {
        PrintString("ERROR : no puedo encontrar el cofre !!");
        return;
    }

    object item;

    switch(Random(3)) {
      case 0:
        item = CreateItemOnObject("nw_it_picks002", cofre);
        break;
      case 1:
        item = CreateItemOnObject("it_sparscr006", cofre);
        break;
      case 2:
        item = CreateItemOnObject("it_spdvscr005", cofre);
        break;
    }

    if (!GetIsObjectValid(item))
        PrintString("ERROR al crear del articulo");
}
1 Like

Hola, amigo. Gracias, ya está hecho :).
El Script que pones crea un objeto en el inventario, lo he modificado con los parámetros de ‘’ Create_Item_Type_’’ o algo así, estoy con el móvil… lool, pero its runs :slight_smile:


Pues muy bueno lo de no poner Pc…


Sobre el cofre, pues poder tener un cofre de aventurero, para poder acceder a mis cosas del cofre A aunque esté en otra area con un cofre B pero no parece posible.
Da igual :), gracias por la ayuda.

de nada. estoy contento que funcione ahora.
buena aventura. :wink:

1 Like