PDA

View Full Version : Faction Help


Darth Essence
10-31-2007, 03:50 PM
void main()
{
object oStud1 = GetObjectByTag("n_dan_student1");
object oStud2 = GetObjectByTag("n_dan_student3");
object oPC = GetFirstPC();

SendMessageToPC(oPC, "Executed");
ChangeToStandardFaction(oStud1, 11);
ChangeToStandardFaction(oStud2, 12);

SendMessageToPC(oPC, IntToString(GetStandardFaction(oStud1)));
}



K1 ... This should change the Faction of oStud1 to 11 .. but the SendMessage gives me a mystical -1 Faction ... :S .. why ?

tk102
10-31-2007, 08:13 PM
// 713: GetStandardFaction
// Find out which standard faction oObject belongs to.
// * Returns a mystical INVALID_STANDARD_FACTION if oObject does not belong to
// a Standard Faction, or an error has occurred.

The only two things I can think of is that "n_dan_student1" isn't a valid tag or that the commands may need delaying.
Try inserting this after you initialize oStud1 to test the validity of your tag.
if (!GetIsObjectValid(oStud1))
SendMessageToPC(oPC, "oStud1 is not valid");


If that doesn't generate an message in your feedback, try a DelayCommand of 0.2 on the ChangeToStandardFaction and a delay of 0.4 on the GetStandardFaction message line.

:confused: