Aller au contenu

Photo

A Henchmen Problem


  • Veuillez vous connecter pour répondre
36 réponses à ce sujet

#1
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Hello guys...

Well, I have a problem with henchmen in my module. Actually I am trying to build a Mercenary System by my own. Then I found some problems.

1- Somehow the function "RemoveHenchmen" does not work, so the henchmen disappears, but remains in the party dead.

2- I created one Item to make possible to players control when they want their henchs active or not, spawning and destroying their henchs. I suppose my scripts are correct, but there comes the problem. Somehow, when I export the system to my main module, when using this item, the mercenary (henchmen) disappears (when using to deactivate) and one appears dead in the ground!

As you can see, I need some help here. The second problem is not really important right now, I will se what can I do about that....

Any Ideas? Posted Image

#2
Genisys

Genisys
  • Members
  • 525 messages
Henchmen, why does that word bring a bad taste to my mouth?

I suppose if this is going to be an online module, you will definitely want to check out a custom system already made on the nwvault.ign.com, seriously...

If it's just for your offline module, than that's another subject entirely different..

To answer your first problem, you can always remove any Plot / Immortal / or other Flags they may have, then kill their inventory, and then kill the Henchmen...

The second problem sounds two part, and I can answer one of them, without looking more indepth at your system, and that involves how they are to appear when they die, this is a setting in the NPC (forget where) basically you set it to be a body bag or what have you, and destroyable etc..

That may solve some of your issues..

Modifié par Genisys, 31 août 2010 - 04:47 .


#3
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Well it is an online module. I checked other systems in the nwvault but no one fits my module.

Let me explain better the first question. The henchmen dies, and his body disappears, but he still remains in the party, I don't know how! His status still appears below my character avatar like he were dead... but he's not there!...

PS: Thanks for help in second question. I didn't tested yet, but looks working..

I'm testing here my module and trying to figure out what the hell just happenned there... Your answer about my second question didn't worked, so every time I use the item, the mercenary leaves the party, but appears two dead mercenary's body. And when I spawn him, appears him (in the party, and close to me) and another one, out of the party and dead...

Any Idea?

Well, now looks the script runs three times!

Modifié par Mephisto Gladius, 31 août 2010 - 06:30 .


#4
Xovian

Xovian
  • Members
  • 87 messages

Mephisto Gladius wrote...

1- Somehow the function "RemoveHenchmen" does not work, so the henchmen disappears, but remains in the party dead.

Sounds like you may not be using the proper includes.
x0_inc_henai is the one you want i believe.
Also bare in mind the remove function would have to happen prior to the "destroy" effect, if they are already destroyed, then they return as an invalid object and won't be removed.

Mephisto Gladius wrote...
2- I created one Item to make possible to players control when they want their henchs active or not, spawning and destroying their henchs. I suppose my scripts are correct, but there comes the problem. Somehow, when I export the system to my main module, when using this item, the mercenary (henchmen) disappears (when using to deactivate) and one appears dead in the ground!

Not sure of the necessity of needing an item to do this sort of thing, but to each their own.
If you're only getting the error when you export, it means one of your scripts are not carrying over.
Perhapse you are using an ExecuteScript(".....", <object>); in one of your scripts, if that's the case, those scripts will not automatically carry over like include files do. Might be something to look at.

#5
Genisys

Genisys
  • Members
  • 525 messages
Isn't there something that controls the max # of henchmen you can have?

#6
Xovian

Xovian
  • Members
  • 87 messages
Yea.
SetMaxHenchman(#); (is placed in the on module load event, or at least I do)

Though if you use default NWN scripts (or conversation files), it doesn't change anything as those have preset limits.

Modifié par Xovian, 31 août 2010 - 09:32 .


#7
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
I set the maximum of henchmen to 3.



I've fixed the first problem. The second one happens because the script run, somehow, four times! The script send a message over PC head, so I could see it 4 times... something with if conditions?

#8
Xovian

Xovian
  • Members
  • 87 messages
Should try adding a conditional for the run so it only runs once.

Runs if set at 0, doesn't if set to 1.

Probably be the easiest way to fix it.

#9
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Well, I made it but... Look, my script is somenthing like that:
if (GetLocalInt(oPC, "int_name")==1)

      if (condition that means merc = 3)
      {
      script
      }
      else if (condition that means merc = 2)
      {
      script
      }
      else if (condition that means merc = 1)
      {
      script
      }

else if (GetLocalInt(oPC, "int_name")==0)

then more 3 conditions.. because of 3 mercenaries

return;
Doing like that, storing the mercenaries work as it should be. But restoring them (what should be below the else if condition) doesn't work...

Modifié par Mephisto Gladius, 31 août 2010 - 10:30 .


#10
Redunct

Redunct
  • Members
  • 49 messages

Mephisto Gladius wrote...

Well, I made it but... Look, my script is somenthing like that:

if (GetLocalInt(oPC, "int_name")==1)

      if (condition that means merc = 3)
      {
      script
      }
      else if (condition that means merc = 2)
      {
      script
      }
      else if (condition that means merc = 1)
      {
      script
      }

else if (GetLocalInt(oPC, "int_name")==0)

then more 3 conditions.. because of 3 mercenaries

return;
Doing like that, storing the mercenaries work as it should be. But restoring them (what should be below the else if condition) doesn't work...

You're missing a braket.

if (GetLocalInt(oPC, "int_name")==1)
 {
      if (condition that means merc = 3)
      {
      script
      }
      else if (condition that means merc = 2)
      {
      script
      }
      else if (condition that means merc = 1)
      {
      script
      }
}
else if (GetLocalInt(oPC, "int_name")==0)

then more 3 conditions.. because of 3 mercenaries

return;


If that doesn't work, try it this way:

if (GetLocalInt(oPC, "int_name")==1)
 {
      if (condition that means merc = 3)
      {
      script
      }
      else if (condition that means merc = 2)
      {
      script
      }
      else if (condition that means merc = 1)
      {
      script
      }
 return;
    }
if (GetLocalInt(oPC, "int_name")==0)

then more 3 conditions.. because of 3 mercenaries

return;


Modifié par Redunct, 31 août 2010 - 11:09 .


#11
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages

Redunct wrote...

If that doesn't work, try it this way:

if (GetLocalInt(oPC, "int_name")==1)
 {
      if (condition that means merc = 3)
      {
      script
      }
      else if (condition that means merc = 2)
      {
      script
      }
      else if (condition that means merc = 1)
      {
      script
      }
 return;
    }
if (GetLocalInt(oPC, "int_name")==0)

then more 3 conditions.. because of 3 mercenaries

return;



I've tried this one... But didn't worked too... Thanks for helping, but I have the same problem. In the if after the first return; I mean, the second condition of using the item (checking int = 0) doesn't run... But the PC HAVE this variable =0 at this time....

Any more ideas? Posted Image

Modifié par Mephisto Gladius, 31 août 2010 - 11:27 .


#12
Redunct

Redunct
  • Members
  • 49 messages
The whole script would be helpful.

#13
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Sorry, here it is...

void main()
{
object oItem;
object oTarget;
object oPC;
location lTarget;
object oSpawn;
int nInt;
effect eEffect;
oPC = GetItemActivator();
if (GetLocalInt(oPC, "axs_merca")== 1)
   if (GetLocalInt(oPC, "axs_merc")== 3)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   CreateItemOnObject("axs_mercr3", oPC, 1);
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
      }
   else if (GetLocalInt(oPC, "axs_merc")== 2)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr2", oPC, 1);
      }
   else if (GetLocalInt(oPC, "axs_merc")==1)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr1", oPC, 1);
      }
   return;
if (GetLocalInt(oPC, "axs_merca")== 0)
   if (GetItemPossessedBy(oPC, "axs_mercr3")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr3");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr2")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr2");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr1")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      oItem = GetItemPossessedBy(oPC, "axs_mercr1");
      DestroyObject(oItem);
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   return;
}


Modifié par Mephisto Gladius, 31 août 2010 - 11:59 .


#14
Xovian

Xovian
  • Members
  • 87 messages
Just off hand your logic order seems off.

if (GetLocalInt(oPC, "axs_merca")== 1)
   if (GetLocalInt(oPC, "axs_merc")== 3)


Should be something like this:

if (GetLocalInt(oPC, "axs_merca")== 1)
{
[script to run for the if statment]
set local integer to 1
}
else if (GetLocalInt(oPC, "axs_merca")== 2)
{
[script to run for the if statment]
set local integer to 1 (or any number other then 0)
}
else if (GetLocalInt(oPC, "axs_merca")== 3)
{
[script to run for the if statment]
set local integer to 1 (or any number other then 0)
}
else
{
return; // or whatever else you may desire.
Set local integer to 0, because it was not meeting the above conditions
This part can act as a wrap around if needed.
}


Modifié par Xovian, 01 septembre 2010 - 12:13 .


#15
ffbj

ffbj
  • Members
  • 593 messages
Well the very first two line after the definitions are:
if (GetLocalInt(oPC, "axs_merca")== 1)
if (GetLocalInt(oPC, "axs_merc")== 3)

Indicating you want something to occur if int is either 1 or 3, why not just write it as an or instead.
Then next you go to if the int ==2.
Then you go back to 1 again:
else if (GetLocalInt(oPC, "axs_merc")==1)
{
oTarget=GetHenchman(oPC);
RemoveHenchman(oPC, oTarget);
eEffect = EffectDeath();
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
nInt = GetLocalInt(oPC, "axs_merca");
nInt -= 1;
SetLocalInt(oPC, "axs_merca", nInt);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
FloatingTextStringOnCreature("Mercenary Stored", oPC);
CreateItemOnObject("axs_mercr1", oPC, 1);
}
return;
if (GetLocalInt(oPC, "axs_merca")== 0)

and finally to 0, which is not really needed since you could just use and else and do something, since if it's not 1,2, or 3 it's 0. Maybe write it if 0,.. else if 1... else if 2..etc..Sorry that's all I noticed in a quick glance, though I seem to recall a bug with removing dead henchies as you desribe. Are you patched up?

though when I look at it I notice you differentiate merc and merca so it is a different local. Just a bit confusing in that format.

Modifié par ffbj, 01 septembre 2010 - 12:19 .


#16
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Well, let me explain this script. It's really confusing, because there's 2 variables "axs_merc" and "axs_merca". It means:

"axs_merc" -> Mercenary number. So when it's set to 1, player have 1 mercenary, etc.
"axs_merca" -> Mercenary Status. This is what I use to call them Active, or Deactive.

This script is fired when the player uses one item, so there's "GetItemActivator()". Then, the script checks if the mercenaries are activated or deactivated (variable "merca" = 1 or 0) and checks again the number of mercenaries in PC's party.

My Neverwinter Nights are 1.69 and I'm not using any haks.
I'm trying to figure out how to fix this.. The script is confusing because I'm not developer or anything like that. I'm just a simple DM trying to make people like this module...

Thanks for helping here.. I'm almost done with this mercenary system.

Modifié par Mephisto Gladius, 01 septembre 2010 - 01:08 .


#17
Redunct

Redunct
  • Members
  • 49 messages
[quote]

void main()
{
object oItem;
object oTarget;
object oPC;
location lTarget;
object oSpawn;
int nInt;
effect eEffect;
oPC = GetItemActivator();
if (GetLocalInt(oPC, "axs_merca")== 1)
 [color="#00ff00"]{[/color]
   if (GetLocalInt(oPC, "axs_merc")== 3)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   CreateItemOnObject("axs_mercr3", oPC, 1);
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
      }
   else if (GetLocalInt(oPC, "axs_merc")== 2)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr2", oPC, 1);
      }
   else if (GetLocalInt(oPC, "axs_merc")==1)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr1", oPC, 1);
      }
   return;
      [color="#00ff00"]}[/color]
if (GetLocalInt(oPC, "axs_merca")== 0)
 [color="#00ff00"]{[/color]
   if (GetItemPossessedBy(oPC, "axs_mercr3")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr3");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr2")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr2");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr1")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      oItem = GetItemPossessedBy(oPC, "axs_mercr1");
      DestroyObject(oItem);
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   return;
    [color="#00ff00"]}[/color]
}

[/quote]
You are missing brackets.

Also, may I suggest case statements for this kind of script? It's much cleaner.

Example:

[quote]
void main()
{
object oItem;
object oTarget;
object oPC;
location lTarget;
object oSpawn;
int nInt;
effect eEffect;
oPC = GetItemActivator();
[color="#00ff00"]switch (GetLocalInt(oPC, "axs_merca"))[/color]
[color="#00ff00"]  {[/color]
[color="#00ff00"]   case 1:[/color]
[color="#00ff00"]     switch (GetLocalInt(oPC, "axs_merc"))[/color]
[color="#00ff00"]      {[/color]
[color="#00ff00"]      case 3:[/color]
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   CreateItemOnObject("axs_mercr3", oPC, 1);
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
     [color="#00ff00"]break;[/color]
   [color="#00ff00"]case 2[/color][color="#00ff00"]:[/color]
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr2", oPC, 1);
     [color="#00ff00"]break;[/color]
     [color="#00ff00"]case [/color][color="#00ff00"]1:[/color]
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr1", oPC, 1);
     }
   return;
   [color="#00ff00"]break[/color];
   [color="#00ff00"]case[/color] [color="#00ff00"]0:[/color]
   if (GetItemPossessedBy(oPC, "axs_mercr3")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr3");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr2")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr2");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr1")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      oItem = GetItemPossessedBy(oPC, "axs_mercr1");
      DestroyObject(oItem);
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
[color="#00ff00"]}[/color]
}

[/quote]
You don't need a return at the end of the script, not that it will matter.

If this doesn't fix it, I'll have to take a closer look, but that's the most apparent problem.

Modifié par Redunct, 01 septembre 2010 - 01:21 .


#18
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Thanks Redunct for trying, but it still doesn't work. The script run 3 times... I didn't put those switch/case conditions because I didn't know how to use them... Posted Image
Anyway... Still not working Posted Image

Edit:

AHHHH DAMN!
I found one ****ing strange problem! I exported this script to another module, just to test. And it WORKED!... Not 100%, I must say, but were ok. The only problem is that again, the mercenary disappears but remains in the party.
Export I mean, Ctrl + C and Ctrl + V..

Modifié par Mephisto Gladius, 01 septembre 2010 - 01:28 .


#19
ffbj

ffbj
  • Members
  • 593 messages
Maybe you can give tdonadino (tony) from the old boards I think he is around. I still think there is a bug somewhere, not with the script, but anyway, here read this:



http://nwn.bioware.c...ighlight=remove henchman bug

#20
Redunct

Redunct
  • Members
  • 49 messages

Mephisto Gladius wrote...

Thanks Redunct for trying, but it still doesn't work. The script run 3 times... I didn't put those switch/case conditions because I didn't know how to use them... Posted Image
Anyway... Still not working Posted Image


Let's try this trick:

Add this to the beginning:

if (GetLocalInt(oPC, "using") == 0)
{
    SetLocalInt(oPC,"using",1);
    DelayCommand(1.0f, SetLocalInt(oPC,"using",0));


and a bracket to the end.

#21
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Didn't worked...

Shouldn't I put one "return" in this "if" condition?

Modifié par Mephisto Gladius, 01 septembre 2010 - 01:42 .


#22
Redunct

Redunct
  • Members
  • 49 messages

Mephisto Gladius wrote...

Didn't worked...

Shouldn't I put one "return" in this "if" condition?


a "return" statement ends the script immediately. You only use returns when you want the script to end without running the rest.

It's still firing the script mutiple times? 

#23
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Yes... It's fired 3 times..

#24
Redunct

Redunct
  • Members
  • 49 messages

Mephisto Gladius wrote...

Yes... It's fired 3 times..


Try this.

void main()
{
object oItem;
object oTarget;
object oPC;
location lTarget;
object oSpawn;
int nInt;
effect eEffect;
oPC = GetItemActivator();

if (GetLocalInt(oPC, "axs_merca")== 1)
  {
   if (GetLocalInt(oPC, "axs_merc")== 3)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   CreateItemOnObject("axs_mercr3", oPC, 1);
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
      }
   else if (GetLocalInt(oPC, "axs_merc")== 2)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr2", oPC, 1);
      }
   else if (GetLocalInt(oPC, "axs_merc")==1)
      {
   oTarget=GetHenchman(oPC);
   RemoveHenchman(oPC, oTarget);
   eEffect = EffectDeath();
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
   nInt = GetLocalInt(oPC, "axs_merca");
   nInt -= 1;
   SetLocalInt(oPC, "axs_merca", nInt);
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
   FloatingTextStringOnCreature("Mercenary Stored", oPC);
   CreateItemOnObject("axs_mercr1", oPC, 1);
      }
   return;
   }
if (GetLocalInt(oPC, "axs_merca")== 0)
   {
   if (GetItemPossessedBy(oPC, "axs_mercr3")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr3");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr2")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      oItem = GetItemPossessedBy(oPC, "axs_mercr2");
      DestroyObject(oItem);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }
   else if (GetItemPossessedBy(oPC, "axs_mercr1")!= OBJECT_INVALID)
      {
      oTarget = oPC;
      lTarget = GetLocation(oTarget);
      oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mercenario", lTarget);
      oTarget = GetObjectByTag("mercenario");
      AddHenchman(oPC, oTarget);
      nInt = GetLocalInt(oPC, "axs_merca");
      nInt += 1;
      SetLocalInt(oPC, "axs_merca", nInt);
      ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oPC));
      oItem = GetItemPossessedBy(oPC, "axs_mercr1");
      DestroyObject(oItem);
      FloatingTextStringOnCreature("Mercenary Restored", oPC);
      }

}
}



#25
Mephisto Gladius

Mephisto Gladius
  • Members
  • 20 messages
Again, I got the same error. Script still firing 3 times...