Jump to content

Home

Some scripts


Recommended Posts

Well lets see if I can get some of these...

 

This script here, I think, will killl one NPC whether it is hostile or not

void KillCreature(object oCreature, int nDelay )
{
   if ( nDelay > 0 )
   {
       DelayCommand(IntToFloat(nDelay), KillCreature( oCreature, 0 ));
       return;
   }

   effect eDeath = EffectDeath(FALSE, FALSE, TRUE);

   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oCreature );
}

 

This one, I believe, will change one character into whatever you would like the to be

// 850
// ChangeObjectAppearance
// oObjectToChange = Object to change appearance of
// nAppearance = appearance to change to (from appearance.2da)
void ChangeObjectAppearance( object oObjectToChange, int nAppearance );

 

This one will spawn an NPC beside you


// same OBJECT_TYPEs as above

CreateObject( OBJECT_TYPE_CREATURE,
"object_template", GetLocation(GetFirstPC()));

 

and last but not least this one will increase your xp

GiveXPToCreature(GetFirstPC(),nAmount);

 

Hope thats what you wanted.;)

Link to comment
Share on other sites

Would someone give me these scripts:

 

You should specify which game it is for, since the scripting language isn't completely identical in KOTOR and TSL. I'm assuming KOTOR (1) here since that's what you've been asking about earlier as far as I can remember. :)

 

Kill all hostiles in the area

 

void main() {
   object oPC = GetFirstPC();
   object oArea = GetArea(oPC);
   object oTarget = GetFirstObjectInArea(oArea, OBJECT_TYPE_CREATURE);
   effect eKill = EffectDeath();

   while (GetIsObjectValid(oTarget)) {
       if (GetIsEnemy(oPC, oTarget) && !GetIsDead(oTarget)) {
           DelayCommand(0.1, ApplyEffectToObject(DURATION_TYPE_INSTANT, eKill, oTarget));
       }
       oTarget = GetNextObjectInArea(oArea, OBJECT_TYPE_CREATURE);
   }
}

 

Change the apperance of all NPCs in the area into Gizkas

 

This can't be done directly in KOTOR 1 since it has no appearance changing function (that was added in TSL), but you can fake it by applying a disguise effect to them, like:

 

void main() {
   object oPC = GetFirstPC();
   object oArea = GetArea(oPC);
   object oTarget = GetFirstObjectInArea(oArea, OBJECT_TYPE_CREATURE);
   effect eGizka = EffectDisguise(DISGUISE_TYPE_C_GIZKA);

   while (GetIsObjectValid(oTarget)) {
       if (!IsObjectPartyMember(oTarget) && !GetIsDead(oTarget)) {
           ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGizka, oTarget);
       }
       oTarget = GetNextObjectInArea(oArea, OBJECT_TYPE_CREATURE);
   }
}

 

 

Spawn an NPC beside you

 

void main() {
   CreateObject(OBJECT_TYPE_CREATURE, "[color=Yellow]NameOfUTCfile[/color]", GetLocation(GetFirstPC()));
}

 

Change NameOfUTCfile to the name of the UTC file to spawn the NPC from.

 

 

Increase maximum HP

 

Of whom? Assuming the player character:

 

void main() {
   object oTarget = GetFirstPC();
   int iMax = GetMaxHitPoints(oTarget) + [color=Red]100[/color];
   SetMaxHitPoints(oTarget, iMax);
}

 

Change 100 to how much the max health should be increased by.

Link to comment
Share on other sites

Oh, and one more script question: How can I kill the whole party including the PC with a script?

 

 


void main() {
   int iIdx;
   for (iIdx = 0; iIdx < GetPartyMemberCount(); iIdx++) {
       ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), GetPartyMemberByIndex(iIdx));
   }   
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...