Jump to content

Home

[K1] Help with a script.


sekan

Recommended Posts

Hi,

 

( So you don't get confused, Yes it is call of aid am talking about)

 

I'm trying to add so you can talk to a member of the republic and say:"The republic is my enemie" and everyone that is republic will turn hostile. I used the ChangeToStandardFaction in the script but since there might be multiple npcs using the same .utc file in game so I did this.

ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic01"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic02"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic03"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic04"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic05"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic06"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic07"), 1);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(GetObjectByTag ("pc_republic08"), 1);



//  Then this is re used 500 times in the same script 

 

Now to the problem... when saying :"The republic is my enemie" not all are turned hostile. So I'm asking if anyone knew a better way to change faction of muliple npcs that may use the same .utc file?

Link to comment
Share on other sites

I think this will work much better:

void GM_ChangeAllToStandardFaction( string sTag, int STANDARD_FACTION );

void main() {
GM_ChangeAllToStandardFaction("pc_republic01", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic02", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic03", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic04", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic05", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic06", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic07", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic08", STANDARD_FACTION_HOSTILE_1);
}

void GM_ChangeAllToStandardFaction( string sTag, int STANDARD_FACTION ) {
int i = 0;

// Start first line to allow while() statement to work.
object oCreature = GetObjectByTag(sTag, i);
ChangeToStandardFaction(oCreature, STANDARD_FACTION);

while( oCreature != OBJECT_INVALID ) {
	i++;
	object oCreature = GetObjectByTag(sTag, i);
	ChangeToStandardFaction(oCreature, STANDARD_FACTION);
}
}

Link to comment
Share on other sites

You might be on the right track but I first off all I got to ask does this script work for both games? And secondly my brain seems to have problem with understanding the script

 

void GM_ChangeAllToStandardFaction(  string sTag, int STANDARD_FACTION );

void main() {
GM_ChangeAllToStandardFaction("pc_republic01", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic02", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic03", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic04", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic05", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic06", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic07", STANDARD_FACTION_HOSTILE_1);
GM_ChangeAllToStandardFaction("pc_republic08", STANDARD_FACTION_HOSTILE_1);
}

void GM_ChangeAllToStandardFaction( string sTag,int STANDARD_FACTION) {
int i = 0;

// Start first line to allow while() statement to work.
object oCreature = GetObjectByTag("pc_republic01");
ChangeToStandardFaction(oCreature, STANDARD_FACTION_HOSTILE_1);

while( oCreature != OBJECT_INVALID ) {
i++;
	object oCreature = GetObjectByTag("pc_republic01");

ChangeToStandardFaction(oCreature, STANDARD_FACTION_HOSTILE_1);
}
}

 

Do I need to change something sTag and Starnadfaction? Or shall they stay as they are?

Link to comment
Share on other sites

With your script and some minor adjustments everything works :D

 

Thanks

 

Edit: Here is what I'm planning to change in the new call of aid version:

 

- Am going to add so you can change so your allies become your enemie. You can just change one of them to your enemie or change so the Republic, Sith or Mandalorians become your enemie.

- Adding a robot faction(For both games) and TSF (TSL only)

- Removing the check if your light or dark side now you can spawn all even if your 100% light or dark side.

-(Maybe) Adding so you can choose how powerful you want your allies want to be:

Very Easy

Easy

Normal

Hard

Uber powering

Link to comment
Share on other sites

Why would anyone choose to have easy allies?

 

_EW_

 

Maybe some people wants to use call of aid on Endar Spire and Taris but don't want to have it to easy in battles. Although The very easy thing is a little dumb when I think about it although. But I think it's good to include easy since those people that might want to use Easy will be happy and those that won't use easy will not be affected.

 

Edit: Welcome back ChAiNz.2da :D

Link to comment
Share on other sites

Maybe some people wants to use call of aid on Endar Spire and Taris but don't want to have it to easy in battles. Although The very easy thing is a little dumb when I think about it although. But I think it's good to include easy since those people that might want to use Easy will be happy and those that won't use easy will not be affected.

 

Edit: Welcome back ChAiNz.2da :D

 

Then it might be a good idea to have a script that checks the level of the PC and then adjusts the level of the spawned allies for you.

 

_EW_

Link to comment
Share on other sites

Then it might be a good idea to have a script that checks the level of the PC and then adjusts the level of the spawned allies for you.

 

_EW_

 

Yes it's a good idea but I prefer to give the player power to choose how powerful you allies shall be.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...