Faction war

Started by Berengar, December 22, 2014, 03:04:26 PM

Previous topic - Next topic

Berengar

Greetings!
I got 2 new factions.. the stormtroopers, and the rebels.
And normaly that two guys realy dont like eatch other..
But when they meet each other on the plains of rimworld.. they just ignore.
Any Idea how to change that?

Mfg: Berengar

Lord Fappington

Personally don't have an answer, but you may find the answer when looking at pre-existing factions and how they are set up (e.g., settler types tend to be hostile to pirates as well)

Shinzy

Don't know either but the way I *like to think it is*
the factions just might generate the relations when they're created
kinda like how they do it to your colony

so if you'd put your Stormtroopers hostile like 100% of time they'd be hostile to everyone
(might not be something you'd want to do but)

but I don't think you can get them to be hostile towards one specific faction without
some genious coding taking place =P

Evul

Unless there are some kind of hidden code Ty made. The only easy way to do it is make them hate all.

JuliaEllie

#4
You could try this

Find.FactionManager.FirstFactionOfDef(DefDatabase<FactionDef>.GetNamed("Imperium")).AffectGoodwillWith(Find.FactionManager.FirstFactionOfDef(DefDatabase<FactionDef>.GetNamed("Rebels")), -100);
Find.FactionManager.FirstFactionOfDef(DefDatabase<FactionDef>.GetNamed("Rebels")).AffectGoodwillWith(Find.FactionManager.FirstFactionOfDef(DefDatabase<FactionDef>.GetNamed("Imperium")), -100);


Well this is spaghetti code *yummy* lets do it a little bit less spaghetti-ish but with way more lines:


FactionDef imperiumdef = DefDatabase<FactionDef>.GetNamed("Imperium");
               Faction imperium = Find.FactionManager.FirstFactionOfDef(imperiumdef);

               FactionDef rebeldef = DefDatabase<FactionDef>.GetNamed("Rebels");
               Faction rebel = Find.FactionManager.FirstFactionOfDef(rebeldef);

               imperium.AffectGoodwillWith(rebel, -100);
               rebel.AffectGoodwillWith(imperium, -100);



thats basically the same but looks better and is easier to understand. Have fun :)

P.S. the second one occupies 4 variables while the first one uses none. Doesnt matter in this scale but if you have a few million of those..

Berengar

Thats perfect. Thanks! Will try it later^^