PDA

View Full Version : [K1] Help with a script.


sekan
07-17-2008, 05:56 PM
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?

glovemaster
07-18-2008, 02:45 AM
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);
}
}

sekan
07-18-2008, 08:23 AM
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?

glovemaster
07-18-2008, 08:53 AM
Oh, the script is your solution :p You just need to compile it and it will work.

As for what the script does, it basically searches through every NPC with the tag specified. You don't need to change anything as changing anything will likely break it. :lol:

sekan
07-18-2008, 11:21 AM
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

EnderWiggin
07-18-2008, 12:10 PM
-(Maybe) Adding so you can choose how powerful you want your allies want to be:
Very Easy
Easy
Normal
Hard
Uber powering

Why would anyone choose to have easy allies?

_EW_

ChAiNz.2da
07-18-2008, 12:19 PM
Why would anyone choose to have easy allies?

_EW_
I'd do it just to watch the Disciple die over and over, but that's just me ;) :devsmoke:

sekan
07-18-2008, 12:25 PM
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

EnderWiggin
07-18-2008, 12:27 PM
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_

sekan
07-18-2008, 12:33 PM
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.