View Single Post
Old 02-08-2013, 01:58 PM   #278
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,635
Quote:
Originally Posted by Hassat Hunter View Post
Try adding oClone at the top but blank, so

Code:
void main() {

object oTarget = OBJECT_SELF;
object oClone = "";
int iFaction = 2;

if(
Not sure if it'll fix it, but it might help...
I tried defining everything outside of the if... no luck.
Quote:
Originally Posted by Fair Strides 2 View Post
I don't know. Could you post the contents of jc_inc_clone? That might help us out a bit.
Ah, well, I knew that part is working, but I've updated the code so jc_inc_clone takes up the bulk of it anyway, so here's the entire updated code:
Code:
void JC_DLG(string sDLG) {

SetPartyLeader(-1);
DelayCommand(0.2, AssignCommand(OBJECT_SELF, ActionStartConversation(GetFirstPC(), sDLG, 0, 0, 1, "", "", "", "", "", "", 0, -1, -1, 1)));

}


int JC_Get_Class(object oObject) {

	int iClass1 = GetClassByPosition(1, oObject);
	int iClass2 = GetClassByPosition(2, oObject);
	int iClass3 = GetClassByPosition(3, oObject);

if( iClass3 != 255 ) return iClass3;
if( iClass2 != 255 ) return iClass2;
return iClass1;

}


string JC_Class_To_String(int iClass) {

if( iClass == 0 ) return "soldier";
if( iClass == 1 ) return "scout";
if( iClass == 2 ) return "scoundrel";
if( iClass == 3 ) return "guardian";
if( iClass == 4 ) return "consular";
if( iClass == 5 ) return "sentinel";
if( iClass == 6 ) return "combat";
if( iClass == 7 ) return "expert";
if( iClass == 8 ) return "minion";
return "minion";

}


string JC_Class_To_Letter(int iClass) {

if( iClass == 0 ) return "r";
if( iClass == 1 ) return "t";
if( iClass == 2 ) return "l";
if( iClass == 3 ) return "g";
if( iClass == 4 ) return "c";
if( iClass == 5 ) return "s";
return "";

}


string JC_Gender_To_String(object oObject) {

if( GetGender(oObject) == 1 ) return "f";
return "";

}


int JC_Get_Level(object oObject) {

	int iLevel = (	GetLevelByPosition(1, oObject) +
			GetLevelByPosition(2, oObject) +
			GetLevelByPosition(3, oObject) );
return iLevel;

}


string JC_Level_To_String(object oObject) {

return IntToString(JC_Get_Level(oObject));

}


string JC_Object_To_JC_Temp(object oObject) {

if( oObject == GetFirstPC() ) return JC_Class_To_Letter(JC_Get_Class(oObject)) + "pc" + JC_Gender_To_String(oObject);
if( GetTag(oObject) == "Bastila" ) return "bastila";
if( GetTag(oObject) == "Cand" ) return "canderous";
if( GetTag(oObject) == "Carth" ) return "carth";
if( GetTag(oObject) == "HK47" ) return "hk47";
if( GetTag(oObject) == "Jolee" ) return "jolee";
if( GetTag(oObject) == "Juhani" ) return "juhani";
if( GetTag(oObject) == "Mission" ) return "mission";
if( GetTag(oObject) == "T3M4" ) return "t3m4";
if( GetTag(oObject) == "Zaalbar" ) return "zaalbar";
return JC_Class_To_String(JC_Get_Class(oObject)) + JC_Gender_To_String(oObject);

}


string JC_Template(object oObject) {

return "jc_" + JC_Object_To_JC_Temp(oObject) + JC_Level_To_String(oObject);

}


void JC_CLONE(object oTarget, int iFaction) {

object oClone;
string sTemp;
int iI;

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

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

  }

}


void main() {

}
And then this is executed through either:
Code:
#include "jc_inc_clone"

void main() {

JC_CLONE(OBJECT_SELF, 2);

}
or:
Code:
#include "jc_inc_clone"

void main() {

JC_CLONE(GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, 1), 2);

}
EDIT: I have someone breathing down my neck, waiting impatiently for me to finish this, so to prove that it's not my fault I took the scripts and all the support files and moved them into K2, not changing a damn thing. AND IT WORKS. So what's up? I'm officially lost at this point.



Last edited by JCarter426; 02-08-2013 at 02:29 PM.
JCarter426 is offline   you may: quote & reply,