View Single Post
Old 02-07-2013, 09:57 PM   #275
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,635
So, I have a strange problem. The script compiles fine. The beginning of it executes fine. But then at some point it just stops recognizing two of my variables, causing all other parts of the script to fail to execute. What's stranger still is the script is almost identical to one I wrote for K2 with no such problems.
Code:
#include "jc_inc_clone"

void main() {

object oTarget = OBJECT_SELF;
int iFaction = 2;

if( oTarget == OBJECT_INVALID ) {
	JC_DLG("jc_clo1");
	}

else {

	string sTemp = JC_Template(oTarget);

	object oClone = CreateObject(OBJECT_TYPE_CREATURE, sTemp, GetLocation(OBJECT_SELF), FALSE);

	int iI;

// Copy ALIGNMENT
AdjustAlignment(oClone, GetAlignmentGoodEvil(oTarget), abs(GetGoodEvilValue(oTarget) - GetGoodEvilValue(oClone)), FALSE);

// Clear INVENTORY
  for( iI = 0; iI <= 17; iI++ ) {
	ActionUnequipItem(GetItemInSlot(iI, oClone), TRUE);
	}

// Copy INVENTORY

  for( iI = 0; iI <= 17; iI++ ) {
	if( GetIsObjectValid(GetItemInSlot(iI, oTarget)) ){
		DelayCommand(0.1, AssignCommand(oClone, ActionEquipItem(CreateItemOnObject(GetStringLowerCase(GetTag(GetItemInSlot(iI, oTarget))), oClone, 1, 1), iI, TRUE)));
		}
	}

// Copy APPEARANCE
ApplyEffectToObject(2, EffectDisguise(GetAppearanceType(oTarget)), oClone, 0.0);

// Set FACTION
ChangeToStandardFaction(oClone, iFaction);

// Heal up the clone (just in case)
ApplyEffectToObject(0, EffectHeal(GetMaxHitPoints(oClone) - GetCurrentHitPoints(oClone)), oClone, 0.0);
ApplyEffectToObject(0, EffectHealForcePoints(GetMaxForcePoints(oClone) - GetCurrentForcePoints(oClone)), oClone, 0.0);

  }

}
It works consistently up to and including the creation of oClone. After that, it seems like oTarget and oClone work once each, and after that they never work again. I'm able to shift parts of the code around to get that part to work, but at the expense of all the others. It's rather frustrating.

Any ideas?


JCarter426 is offline   you may: quote & reply,