Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Some scripts

Page: 1 of 1
 Mindtwistah
07-06-2007, 3:14 PM
#1
Would someone give me these scripts:

Kill all hostiles in the area

Change the apperance of all NPCs in the area into Gizkas

Spawn an NPC beside you

Increase maximum HP

?

Pleeease. Big please.
 SithRevan
07-06-2007, 3:48 PM
#2
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.;)
 stoffe
07-06-2007, 4:01 PM
#3
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, "NameOfUTCfile", 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) + 100;
SetMaxHitPoints(oTarget, iMax);
}


Change 100 to how much the max health should be increased by.
 Mindtwistah
07-08-2007, 4:01 PM
#4
Thank you all. And yes, it was for K1.

Oh, and one more script question: How can I kill the whole party including the PC with a script?
 stoffe
07-08-2007, 4:10 PM
#5
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));
}
}
Page: 1 of 1