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:
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 .