Author Topic: A Henchmen Problem  (Read 1485 times)

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #15 on: September 01, 2010, 01:37:28 am »


               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 .
                     
                  


            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #16 on: September 01, 2010, 02:16:40 am »


               
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 .
                     
                  


            

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #17 on: September 01, 2010, 02:22:01 am »


               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
Anyway... Still not working 'Posted

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 .
                     
                  


            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
A Henchmen Problem
« Reply #18 on: September 01, 2010, 02:25:04 am »


               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
               
               

               
            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #19 on: September 01, 2010, 02:29:51 am »


               

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
Anyway... Still not working 'Posted


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.
               
               

               
            

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #20 on: September 01, 2010, 02:38:34 am »


               Didn't worked...

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

               


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


            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #21 on: September 01, 2010, 02:43:49 am »


               

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? 
               
               

               
            

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #22 on: September 01, 2010, 02:46:20 am »


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

               
            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #23 on: September 01, 2010, 02:49:43 am »


               

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);
      }

}
}


               
               

               
            

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #24 on: September 01, 2010, 02:52:56 am »


               Again, I got the same error. Script still firing 3 times...
               
               

               
            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #25 on: September 01, 2010, 02:57:13 am »


               

Mephisto Gladius wrote...

Again, I got the same error. Script still firing 3 times...


How about...


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);
    return; 
    }
   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);
   return;
     }
   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);
      }

}
}


               
               

               


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


            

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #26 on: September 01, 2010, 03:02:56 am »


               I can't believe it... Didn't work again... There's one thing wrong in your scripts.. Check when axs_merca = 0.. When oPC have the item axs_merc3, will spawn 3 mercenaries, when pc have the item axs_merc2, will be 2, etc.. But nevermind that now, we have to fix this strange problem..
               
               

               
            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #27 on: September 01, 2010, 03:04:52 am »


               What's calling the script?
               
               

               
            

Legacy_Mephisto Gladius

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
A Henchmen Problem
« Reply #28 on: September 01, 2010, 03:09:47 am »


               The player uses one item to store the mercenary, as you can see in the script... So, the action of using the "UniquePowerSelf" on the item, calls one script with its tag, named "axs_mercreg". This one calls the "OnActivated" wich is ac_axs_mercreg, that is giving us problems...

Should I post "axs_mercreg"?
               
               

               


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


            

Legacy_Redunct

  • Jr. Member
  • **
  • Posts: 85
  • Karma: +0/-0
A Henchmen Problem
« Reply #29 on: September 01, 2010, 03:12:43 am »


               Please do so.