PDA

View Full Version : Force Clone script help


VarsityPuppet
09-03-2009, 02:36 AM
Well, I've toyed around with this script for a reasonable amount of time, but then I just realized instead of spending several hourse slaving over how to perfect this, maybe I should just ask the able-bodied people at the Holowan Labs how to do it.

So far it just looks like a long list, but it works.

It spawns an exact clone of the caster, but I don't know how to limit it so you can only have 3 clones at a time. It's not that big of a deal for this particular power, but how do I prevent/control stacking effects?

Another thing is I haven't figured out how to make an object follow the PC (puppets are not an answer as the PC can't have any) but if I remember correctly, someone made a fake party member function.


void main(){
int disg = GetAppearanceType(OBJECT_SELF);
int align = GetGoodEvilValue(OBJECT_SELF);

string sArmor = GetTag(GetItemInSlot(INVENTORY_SLOT_BODY, OBJECT_SELF));
string sRight = GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, OBJECT_SELF));
string sLeft = GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, OBJECT_SELF));

object oDoppel = CreateObject(OBJECT_TYPE_CREATURE, "dppl_01", GetLocation(OBJECT_SELF));
object odArmor = CreateItemOnObject(sArmor, oDoppel, 1);
object odRight = CreateItemOnObject(sRight, oDoppel, 1);
object odLeft = CreateItemOnObject(sLeft, oDoppel, 1);

AssignCommand(oDoppel, ActionEquipItem(odArmor, INVENTORY_SLOT_BODY));
AssignCommand(oDoppel, ActionEquipItem(odRight, INVENTORY_SLOT_RIGHTWEAPON));
AssignCommand(oDoppel, ActionEquipItem(odLeft, INVENTORY_SLOT_LEFTWEAPON));
AssignCommand(oDoppel, ChangeObjectAppearance(oDoppel, disg ));
AssignCommand(oDoppel, SetGoodEvilValue( oDoppel, align ));
AssignCommand(oDoppel, SetIsDestroyable(TRUE, FALSE, FALSE));
DelayCommand(60.0, DestroyObject(oDoppel, 0.0, FALSE, 0.0, 0));

}


Lastly, I realize that someone else has made this power before, but to me it is important that I make this on my own from scratch.

Any help would be appreciated, but help that actually gets me somewhere would be better.

newbiemodder
09-03-2009, 01:31 PM
What I did with a similar force power...Sith Resurrection..where the pc summons a sith ghost during combat....I made it cost a high amount of force points, therefore if I used it, it would almost drain me....you could also decrease the duration for which your clone exists before disappearing.

I know it's not what your looking for but I hope it helps.

Edit: I used this script to have my ghost follow me around...I put it in its hearbeatscript tab:

#include "k_inc_switch"
void main() {
object oPC = GetFirstPC();
object oNPC= GetObjectByTag("YOUR NPC TAG GOES HERE");
SetMinOneHP(oNPC,TRUE);
int bMoving = (GetCurrentAction() == ACTION_MOVETOPOINT);
if (!bMoving && (GetDistanceToObject(oPC) > 3.0)) {
ClearAllActions();
ActionMoveToObject(oPC, TRUE, 2.0);
}
else if (!bMoving) {
ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_HEARTBEAT);
}

}

VarsityPuppet
09-03-2009, 01:57 PM
Yeah, that's what I was going to do.. just make the force cost quite high. That way, you could have more than one clone, but only as many as your force point cost would allow.

For the heartbeat follow script, i was going to use Dak Vesser's modified fake party member function.. but if I don't have the proper permissions to do so, may I use yours instead?

Also, if you have any force powers you'd like to donate or lend to the TSL FFM, I'd be most honored! You would of course get credit for making your own powers.

newbiemodder
09-03-2009, 02:26 PM
Go ahead and use it...I think I found it out there among the threads and modified it only slightly.....I'll pm you regarding the force power donations

Nirran
09-03-2009, 02:40 PM
put a wrapper in your script that sets a number such as


void main(){
if(GetLocalNumber(OBJECT_SELF, 31) < 3){
SetLocalNumber( OBJECT_SELF, 31, GetLocalNumber(OBJECT_SELF, 31) + 1);
int disg = GetAppearanceType(OBJECT_SELF);
int align = GetGoodEvilValue(OBJECT_SELF);

string sArmor = GetTag(GetItemInSlot(INVENTORY_SLOT_BODY, OBJECT_SELF));
string sRight = GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, OBJECT_SELF));
string sLeft = GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, OBJECT_SELF));

object oDoppel = CreateObject(OBJECT_TYPE_CREATURE, "dppl_01", GetLocation(OBJECT_SELF));
object odArmor = CreateItemOnObject(sArmor, oDoppel, 1);
object odRight = CreateItemOnObject(sRight, oDoppel, 1);
object odLeft = CreateItemOnObject(sLeft, oDoppel, 1);

AssignCommand(oDoppel, ActionEquipItem(odArmor, INVENTORY_SLOT_BODY));
AssignCommand(oDoppel, ActionEquipItem(odRight, INVENTORY_SLOT_RIGHTWEAPON));
AssignCommand(oDoppel, ActionEquipItem(odLeft, INVENTORY_SLOT_LEFTWEAPON));
AssignCommand(oDoppel, ChangeObjectAppearance(oDoppel, disg ));
AssignCommand(oDoppel, SetGoodEvilValue( oDoppel, align ));
AssignCommand(oDoppel, SetIsDestroyable(TRUE, FALSE, FALSE));
DelayCommand(60.0, DestroyObject(oDoppel, 0.0, FALSE, 0.0, 0));
DelayCommand(60.0, SetLocalNumber( OBJECT_SELF, 31, GetLocalNumber(OBJECT_SELF, 31) - 1);
}
}

not sure if that compiles,but that would limit it to 3

Nirran

edit : missed 2 lines of code,fixed it

VarsityPuppet
09-03-2009, 02:45 PM
Anyway to do it without using local variables? I've not had success with Local variables in the past..

and the other thing is that they may be used in certain modules maybe? idk

Nirran
09-03-2009, 02:47 PM
not that i know of,the dialog tutorial has a list of variables used and not used by the game,31 is the last number local and according to that tutorial is not used

link to that thread
http://www.lucasforums.com/showthread.php?t=180845

Nirran

logan23
09-03-2009, 08:18 PM
Hey,

What you could do is use a journal entry.

When you learn the power give yourself the journal entry cloneme 10.

Add the journal entry to global journal.

Here is the script that you had with using a check on your journal entry as the trigger of the power.

I compiled the script but I have not tested it out in game.

Let me know if it works.:)

add an entry through script

void main()
{
AddJournalQuestEntry("cloneme",10);
}

tutorial on journal entries
http://www.lucasforums.com/showthread.php?t=143372

void main(){

if (GetJournalEntry("cloneme") == 10){

int disg = GetAppearanceType(OBJECT_SELF);
int align = GetGoodEvilValue(OBJECT_SELF);

string sArmor = GetTag(GetItemInSlot(INVENTORY_SLOT_BODY, OBJECT_SELF));
string sRight = GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, OBJECT_SELF));
string sLeft = GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, OBJECT_SELF));

object oDoppel = CreateObject(OBJECT_TYPE_CREATURE, "dppl_01", GetLocation(OBJECT_SELF));
object odArmor = CreateItemOnObject(sArmor, oDoppel, 1);
object odRight = CreateItemOnObject(sRight, oDoppel, 1);
object odLeft = CreateItemOnObject(sLeft, oDoppel, 1);

AssignCommand(oDoppel, ActionEquipItem(odArmor, INVENTORY_SLOT_BODY));
AssignCommand(oDoppel, ActionEquipItem(odRight, INVENTORY_SLOT_RIGHTWEAPON));
AssignCommand(oDoppel, ActionEquipItem(odLeft, INVENTORY_SLOT_LEFTWEAPON));
AssignCommand(oDoppel, ChangeObjectAppearance(oDoppel, disg ));
AssignCommand(oDoppel, SetGoodEvilValue( oDoppel, align ));
AssignCommand(oDoppel, SetIsDestroyable(TRUE, FALSE, FALSE));
DelayCommand(60.0, DestroyObject(oDoppel, 0.0, FALSE, 0.0, 0));
DelayCommand(60.0, SetLocalNumber( OBJECT_SELF, 31, GetLocalNumber(OBJECT_SELF, 31) - 1));
}
}

Have fun:thmbup1:

Logan

VarsityPuppet
09-03-2009, 08:35 PM
Hey, Logan23!

That is a very innovative idea. I want it to be as invisible and unintrusive as possible though... a.k.a. only through scripts.

The problem with using local variables is that let's say I wanted to make another power that does the same thing? Then I'd have to use another variable and so on and so forth.

Thanks for your help though guys. All of these ideas will be put to good use! ;)

VarsityPuppet
09-05-2009, 09:48 PM
Next problem:

I just want this simple script to fire. It's a stripped down version of Force Clone. I want it to spawn a different creature for each different Prestige Class (sith only), Otherwise, if you don't have any of those classes, then it'll spawn a "dud" creature (aka a Gizka).

It's not been working. It'll just spawn the dud no matter what. Help?

void main(){

if(GetLevelByPosition(2, OBJECT_SELF) == 15){

object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "SAspawn_02", GetLocation(OBJECT_SELF));}
if(GetLevelByPosition(2, OBJECT_SELF) == 14){

object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "SAspawn_01", GetLocation(OBJECT_SELF));}

else {
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "SAdud_01", GetLocation(OBJECT_SELF));}
}

Nirran
09-05-2009, 10:37 PM
void main(){
if( GetLevelByClass(CLASS_TYPE_SITHMARAUDER) > 0 ) ||
( GetLevelByClass(CLASS_TYPE_SITHLORD) > 0 ) ||
( GetLevelByClass(CLASS_TYPE_SITHASSASSIN) > 0 ){
if ( GetLevelByClass(CLASS_TYPE_SITHMARAUDER) > 0 ){
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "SAspawn_02", GetLocation(OBJECT_SELF));
}
if ( GetLevelByClass(CLASS_TYPE_SITHLORD) > 0 ){
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "SAspawn_01", GetLocation(OBJECT_SELF));
}
if ( GetLevelByClass(CLASS_TYPE_SITHASSASSIN) > 0 ){
}
else if( GetLevelByClass(CLASS_TYPE_SITHMARAUDER) <= 0 ) &&
( GetLevelByClass(CLASS_TYPE_SITHLORD) <= 0 ) &&
( GetLevelByClass(CLASS_TYPE_SITHASSASSIN) <= 0 ){
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "SAdud_01", GetLocation(OBJECT_SELF));
}


that should work