Ludeon Forums

Ludeon Forums

  • December 03, 2020, 05:33:46 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Faction war  (Read 1330 times)

Berengar

  • Colonist
  • ***
  • Posts: 159
  • Refugee
    • View Profile
Faction war
« on: December 22, 2014, 03:04:26 PM »

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
Logged

Lord Fappington

  • Drifter
  • **
  • Posts: 78
  • Scientist
    • View Profile
Re: Faction war
« Reply #1 on: December 22, 2014, 07:12:52 PM »

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)
Logged

Shinzy

  • Battering ram
  • Global Moderator
  • Transcendent
  • ****
  • Posts: 3079
  • Ramming speeed!
    • View Profile
    • My mods, all of them!
Re: Faction war
« Reply #2 on: December 23, 2014, 08:09:42 AM »

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
Logged

Evul

  • Moderator
  • Planetologist
  • ***
  • Posts: 1656
  • Quality Assurance
    • View Profile
    • Evul Development
Re: Faction war
« Reply #3 on: December 23, 2014, 08:34:08 AM »

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

JuliaEllie

  • Colonist
  • ***
  • Posts: 774
  • I am the one who mods.
    • View Profile
Re: Faction war
« Reply #4 on: December 23, 2014, 09:40:46 AM »

You could try this

Code: [Select]
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:

Code: [Select]
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..
« Last Edit: December 23, 2014, 09:42:59 AM by JuliaEllie »
Logged

Berengar

  • Colonist
  • ***
  • Posts: 159
  • Refugee
    • View Profile
Re: Faction war
« Reply #5 on: December 23, 2014, 10:19:22 AM »

Thats perfect. Thanks! Will try it later^^
Logged