Aller au contenu

Photo

Why Does This Script Break When It Is Called From A Cleric?


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

#1
Morbane

Morbane
  • Members
  • 1 883 messages
 //on_click_chamber_door
void main()
{
object oPC = GetClickingObject();

if(GetclassByPosition(1, oPC) == class_TYPE_FIGHTER ||
GetclassByPosition(1, oPC) == class_TYPE_RANGER ||
GetclassByPosition(1, oPC) == class_TYPE_PALADIN ||
GetclassByPosition(1, oPC) == class_TYPE_SWASHBUCKLER ||
GetclassByPosition(1, oPC) == class_TYPE_BARBARIAN)
{
JumpPartyToArea(oPC, GetObjectByTag("fighter_chamber"));
SetGlobalInt("fighter_history", TRUE);
}
else if(GetclassByPosition(1, oPC) == class_TYPE_WIZARD ||
GetclassByPosition(1, oPC) == class_TYPE_SORCERER ||
GetclassByPosition(1, oPC) == class_TYPE_WARLOCK)
{
JumpPartyToArea(oPC, GetObjectByTag("wizard_chamber"));
SetGlobalInt("wizard_history", TRUE);
}
else if(GetclassByPosition(1, oPC) == class_TYPE_CLERIC ||
GetclassByPosition(1, oPC) == class_TYPE_FAVORED_SOUL ||
GetclassByPosition(1, oPC) == class_TYPE_DRUID ||
GetclassByPosition(1, oPC) == class_TYPE_SPIRIT_SHAMAN)
{
JumpPartyToArea(oPC, GetObjectByTag("cleric_chamber"));
SetGlobalInt("cleric_history", TRUE);
}
else if(GetclassByPosition(1, oPC) == class_TYPE_ROGUE ||
GetclassByPosition(1, oPC) == class_TYPE_MONK ||
GetclassByPosition(1, oPC) == class_TYPE_BARD)
{
JumpPartyToArea(oPC, GetObjectByTag("rogue_chamber"));
SetGlobalInt("rogue_history", TRUE);
}
}

The Cleric PC dissappears and nothing happens - like some kind of bug - does anyone know what it is or how to fix it?

Modifié par Morbane, 21 août 2011 - 05:40 .


#2
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
Something like this, if it does not work it would send you a message to your character. ( Pastebin version
void main()
{	
	object oPC = GetClickingObject();
	
	int iMainclass = GetclassByPosition(1, oPC);
	string sclassType = "fighter";
	
	if( iMainclass == class_TYPE_FIGHTER || iMainclass == class_TYPE_RANGER || iMainclass == class_TYPE_PALADIN || iMainclass == class_TYPE_SWASHBUCKLER || iMainclass == class_TYPE_BARBARIAN)
	{
		sclassType = "fighter";	
	}	
	else if( iMainclass == class_TYPE_WIZARD ||	iMainclass == class_TYPE_SORCERER || iMainclass == class_TYPE_WARLOCK)
	{	
		sclassType = "wizard";
	}	
	else if( iMainclass == class_TYPE_CLERIC || iMainclass == class_TYPE_FAVORED_SOUL || iMainclass == class_TYPE_DRUID || iMainclass == class_TYPE_SPIRIT_SHAMAN)
	{	
		sclassType = "cleric";
	}	
	else if( iMainclass == class_TYPE_ROGUE || iMainclass == class_TYPE_MONK || iMainclass == class_TYPE_BARD)	
	{	
		sclassType = "rogue";	
	}
	
	string sChamberTag = sclassType+"_chamber";
	string sGlobalVar = sclassType+"_history";
	
	object oAreaTag = GetObjectByTag(sChamberTag);
	if ( GetIsObjectValid(oAreaTag) )
	{
		JumpPartyToArea(oPC, GetObjectByTag(sChamberTag));	
		SetGlobalInt(sGlobalVar, TRUE);
		SendMessageToPC( oPC, GetName(oPC)+" was sent to "+sChamberTag);

	}
	else
	{
		SendMessageToPC( oPC, sChamberTag+" Was an Invalid Area for "+GetName(oPC));
	}
}

Modifié par painofdungeoneternal, 21 août 2011 - 06:01 .


#3
Morbane

Morbane
  • Members
  • 1 883 messages
Man oh man - The way I designed the 4 areas included a lot of cut and paste of prefabs - in 2 of the areas there was a "cleric_chamber" door in an invalid section of the map. I got rid of those and all is well.

BTW - Thanks Pain! That script is tight. Your script-fu is strong indeed!

#4
The Fred

The Fred
  • Members
  • 2 516 messages
Much to learn you have, grasshopper.