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.

Free For All Script

Page: 1 of 1
 HK-42
12-21-2008, 6:44 PM
#1
Is there a script that will turn about say 5 people to a hostile faction, but they will attack all attacking people not just the pc. Like free for all or a bar fight:xp:.

(the latter is what im trying to do)
 Mandalore_The_Great
12-21-2008, 8:21 PM
#2
all you gotta do is put this script function in:
ChangeToStandardFaction(oNPC*, STANDARD_FACTION_HOSTILE_1);
put this a few times with the name of the NPCs at the place where I put the * it might be HOSTILE_2... not sure though
 TriggerGod
12-21-2008, 8:46 PM
#3
all you gotta do is put this script function in:
ChangeToStandardFaction(oNPC*, STANDARD_FACTION_HOSTILE_1);
put this a few times with the name of the NPCs at the place where I put the * it might be HOSTILE_2... not sure though

You misunderstood him. I'll try and simplify it for him...
dialog...
script fires
NPC1 hits NPC3 with a barstool, NPC2 gets hit by a beer bottle by NPC4, NPC1 beats up NPC4 with your flask of juma, and you wail on all of them.

As for your actual question, I do not think its possible. But one of our local scripting gurus may know something we don't...
 HK-42
12-21-2008, 8:57 PM
#4
You misunderstood him. I'll try and simplify it for him...
dialog...
script fires
NPC1 hits NPC3 with a barstool, NPC2 gets hit by a beer bottle by NPC4, NPC1 beats up NPC4 with your flask of juma, and you wail on all of them.

As for your actual question, I do not think its possible. But one of our local scripting gurus may know something we don't...
:lol:

I think it is possible in the game, because you see animals attacking a human, the human attacking the animal, and you come in and kill both...

Ill try the Mandalore's script and post the results.
 HK-42
12-21-2008, 9:01 PM
#5
all you gotta do is put this script function in:
ChangeToStandardFaction(oNPC*, STANDARD_FACTION_HOSTILE_1);
put this a few times with the name of the NPCs at the place where I put the * it might be HOSTILE_2... not sure though

nope, syntax error at ChangeToStandardFaction

my nice little script:
ChangeToStandardFaction(oNPC"ryloth_exslum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC"ryloth_exslum2", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC"ryloth_twislum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC"ryloth_twislum2", STANDARD_FACTION_HOSTILE_1);
 Canderis
12-21-2008, 9:08 PM
#6
You need to start it with
void main(){
and end it with
}
 HK-42
12-21-2008, 9:15 PM
#7
You need to start it with
void main(){
and end it with
}

Oh yea...I always forget obvious :migraine:

Syntax error at string constant rows 3, 4, 5, 6

void main()
{
ChangeToStandardFaction(oNPC"ryloth_exslum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC"ryloth_exslum2", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC"ryloth_twislum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC"ryloth_twislum2", STANDARD_FACTION_HOSTILE_1);
}
 Mandalore_The_Great
12-21-2008, 9:38 PM
#8
try, instead of (oNPC.. //bla-bla-bla, try
oNPC1..//bla-bla-bla That works with spawning more than one item
@TriggerGod- I knew what he meant I just thought maybe HOSTILE_2 would be different from HOSTILE_1

Anyway, you could try making it so they don't see you until after they're all in a fight with each other(put your guy on the other side of the bar from the participants, for an example).
 Canderis
12-21-2008, 9:46 PM
#9
Brain Blast! What you can do is make 2 of the enimys hostile 2 and one is hostile 1 and aonther friendly 2. Modify the ondeath script of one of the hostile 2's to change the friendly's faction to hostile 2 then they will fight and you can help.
 Mandalore_The_Great
12-21-2008, 10:00 PM
#10
Brain blast??
sounds kinda shaky... but it could work. Nice job, Canderis. 10/10 for idea, -2 for ^
 HK-42
12-21-2008, 10:12 PM
#11
Brain Blast! What you can do is make 2 of the enimys hostile 2 and one is hostile 1 and aonther friendly 2. Modify the ondeath script of one of the hostile 2's to change the friendly's faction to hostile 2 then they will fight and you can help.

Uh, what? I got about half that.
 Canderis
12-21-2008, 10:21 PM
#12
What didnt you get? Go to TH chat box, i can help you better there.
 HK-42
12-21-2008, 10:33 PM
#13
try, instead of (oNPC.. //bla-bla-bla, try
oNPC1..//bla-bla-bla That works with spawning more than one item
@TriggerGod- I knew what he meant I just thought maybe HOSTILE_2 would be different from HOSTILE_1

Anyway, you could try making it so they don't see you until after they're all in a fight with each other(put your guy on the other side of the bar from the participants, for an example).

Could you describe that a little more to fix the syntax?
 Mandalore_The_Great
12-22-2008, 1:15 AM
#14
what I meant is make a script that looks like this:
void main() {
ChangeToStandardFaction(oNPC0"ryloth_exslum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC1"ryloth_exslum2", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC2"ryloth_twislum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC3"ryloth_twislum2", STANDARD_FACTION_HOSTILE_1);

if you mention where the syntax errors were exactly, then that would help a little more
 HK-42
12-22-2008, 1:22 AM
#15
what I meant is make a script that looks like this:
void main() {
ChangeToStandardFaction(oNPC0"ryloth_exslum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC1"ryloth_exslum2", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC2"ryloth_twislum1", STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC3"ryloth_twislum2", STANDARD_FACTION_HOSTILE_1);

if you mention where the syntax errors were exactly, then that would help a little more
mobfight.nss(3): Error: Syntax Error at "string constant"
mobfight.nss(4): Error: Syntax Error at "string constant"
mobfight.nss(5): Error: Syntax Error at "string constant"
 sekan
12-22-2008, 5:37 AM
#16
This script should work


void main() {
object oNPC0 = GetObjectByTag("ryloth_exslum1");
object oNPC1 = GetObjectByTag("ryloth_exslum2");
object oNPC2 = GetObjectByTag("ryloth_twislum1");
object oNPC3 = GetObjectByTag("ryloth_twislum2");

ChangeToStandardFaction(oNPC0, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC1, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC2, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(oNPC3, STANDARD_FACTION_HOSTILE_1);
}
 stoffe
12-22-2008, 9:23 AM
#17
This script should work
ChangeToStandardFaction(oNPC0, STANDARD_FACTION_HOSTILE_1);


Keep in mind though that NPCs in the Hostile faction will not attack each other, only those who are considered enemies of the Hostile faction (the player, party and allies).

You could try using the STANDARD_FACTION_INSANE faction instead, that one is hostile to itself as well.
 HK-42
12-22-2008, 11:44 AM
#18
Keep in mind though that NPCs in the Hostile faction will not attack each other, only those who are considered enemies of the Hostile faction (the player, party and allies).

You could try using the STANDARD_FACTION_INSANE faction instead, that one is hostile to itself as well.

Alright I got the script done, but the NPCs just stand there till I attack them. Also I cant get their weapons to appear.
 Mandalore_The_Great
12-22-2008, 5:30 PM
#19
mobfight.nss(3): Error: Syntax Error at "string constant"
mobfight.nss(4): Error: Syntax Error at "string constant"
mobfight.nss(5): Error: Syntax Error at "string constant"

might've been because you forgot to put a } at the end
 HK-42
12-22-2008, 6:18 PM
#20
nope i put one and I got the script compiled and the npcs do attack whoever but they won't start till I hurt them. They just stand there till I attack.
 glovemaster
12-23-2008, 2:02 PM
#21
Assuming "ryloth_exslum1" and the others are the tag of the NPC, otherwise you will have to swap as necessary, try:
void main(){
ChangeToStandardFaction(GetObjectByTag("ryloth_exslum1"), STANDARD_FACTION_INSANE);
ChangeToStandardFaction(GetObjectByTag("ryloth_exslum2"), STANDARD_FACTION_INSANE);
ChangeToStandardFaction(GetObjectByTag("ryloth_twislum1"), STANDARD_FACTION_INSANE);
ChangeToStandardFaction(GetObjectByTag("ryloth_twislum2"), STANDARD_FACTION_INSANE);
}
 HK-42
12-23-2008, 3:28 PM
#22
Assuming "ryloth_exslum1" and the others are the tag of the NPC, otherwise you will have to swap as necessary, try:
void main(){
ChangeToStandardFaction(GetObjectByTag("ryloth_exslum1"), STANDARD_FACTION_INSANE);
ChangeToStandardFaction(GetObjectByTag("ryloth_exslum2"), STANDARD_FACTION_INSANE);
ChangeToStandardFaction(GetObjectByTag("ryloth_twislum1"), STANDARD_FACTION_INSANE);
ChangeToStandardFaction(GetObjectByTag("ryloth_twislum2"), STANDARD_FACTION_INSANE);
}

tried this one and it did the same thing, it turned the insane, but they dont start attacking they just stand there till I attack them.
 Mandalore_The_Great
12-23-2008, 4:06 PM
#23
oh well... try making one of the NPCs friendly, thereby attacking him, then when he dies, make it so they go insane, and maybe they'll attack each other since they were already engaged in a fight
 stoffe
12-24-2008, 6:39 AM
#24
Alright I got the script done, but the NPCs just stand there till I attack them. Also I cant get their weapons to appear.

If they are already within the perception range of each other by the time you change their faction you may need to kickstart their combat AI manually for them to start fighting. Usually NPCs will start fighting when they perceive an enemy, which can cause problems if they're friendly when they first perceive them. Something like:


void ST_Fight(int iFac, object oActor = OBJECT_SELF) {
ChangeToStandardFaction(oActor, iFac);
ExecuteScript("k_ai_master", oActor, 1003);
}


void main() {
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_exslum1"));
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_exslum2"));
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_twislum1"));
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_twislum2"));
}
 HK-42
12-28-2008, 8:32 PM
#25
If they are already within the perception range of each other by the time you change their faction you may need to kickstart their combat AI manually for them to start fighting. Usually NPCs will start fighting when they perceive an enemy, which can cause problems if they're friendly when they first perceive them. Something like:


void ST_Fight(int iFac, object oActor = OBJECT_SELF) {
ChangeToStandardFaction(oActor, iFac);
ExecuteScript("k_ai_master", oActor, 1003);
}


void main() {
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_exslum1"));
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_exslum2"));
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_twislum1"));
ST_Fight(STANDARD_FACTION_INSANE, GetObjectByTag("ryloth_twislum2"));
}


Thanks Stoffe it finally worked. . :) Now just to boost up there hp and defense they died almost right after it started.
Page: 1 of 1