[MOD] (Alpha 3F) Battle Formations (v1.0)

Started by pawnstorm, April 24, 2014, 10:57:27 PM

Previous topic - Next topic

pawnstorm


Battle Formations
Now with lasers, banana bombs and exploding sheep!
(not really)
Description:
Allows you to save the positions of all your drafted colonists so you can make them all return to the exact same positions at a later time.
I also added the ability to manually order your colonists to eat or sleep, so while the raiders are staging you can make sure all your colonists are well fed and rested.

Download:
The download link is at the bottom of this post or here.

How to install:
- Unzip the contents and place them in your RimWorld/Mods folder.
- Activate the mod in the mod menu in game.

Important:
You can't use this mod on an existing savegame. You have to start a new game with this mod enabled and you can't disable the mod for that savegame afterwards.
Savegames started with Battle Formations v0.1 also won't work with the new version. If you really want to use this mod in one of your existing savegames you can easily fix this using the awesome XML manipulation tool XmlStarlet which you can download here.

To fix your Battle Formations 0.1 savegame to work with Battle Formations 1.0:
xml ed -P -u "//thing[@Class='BattleFormations.XPawn'][def/text()='Human']/@Class" -v "BF.PawnX" -u "//thing[@Class='BattleFormations.XPawn'][def/text()!='Human']/@Class" -v "Pawn" input.rim >output.rim

To add Battle Formations 1.0 to your vanilla savegame:
xml ed -P -u "//thing[@Class='Pawn'][def/text()='Human']/@Class" -v "BF.PawnX" input.rim >output.rim

To remove Battle Formations 1.0 from your savegame:
xml ed -P -d "//thing[@Class='BF.PawnX']/savedpos" -u "//thing[@Class='BF.PawnX']/@Class" -v "Pawn" input.rim >output.rim

If all this command line stuff scares you, just download XmlStarlet, get this batch file, make sure xml.exe and the batch file are in the same directory and drag and drop your savegame on the batch file. I do advise to keep the backup file, at least until some people have reported it all works as intended.

Notes:
- The easiest way to set up positions for your colonists is to just move them all into position once, select them all and click the "Save positions" button. The other new button in draft mode will make them all return to these positions.
- The options to manually order your colonists to eat or sleep become available when either food or rest drops below 50%. The way I intended it to work is when raiders are staging you can select all your colonists and click the eat or sleep button to make all colonists with food or rest levels below 50% fulfill their needs.

Credits:
Clker.com is where I got the images I used for the buttons
Haplo for his awesome PowerSwitch mod which I used as a template

Changelog:
0.1- Released
1.0- Changed it so it only affects human pawns, the eat and sleep buttons will be disabled if pawns are already eating or sleeping and tidied up the code a bit.

P.S. There won't be anymore updates for Battle Formations. If you're still using this, consider getting Vanilla+ instead.

[attachment deleted by admin: too old]

JanBlair


pawnstorm

Thanks! Let me know if you run into any bugs or if you have any suggestions on how to improve it. I'd love to get some feedback on this, especially how people use it.
The way I intended it to work is when raiders are staging you can select all your colonists and click the eat or sleep button to make all colonists with food or rest levels below 50% fulfill their needs.
Saving positions and ordering your colonists to move to their respective positions should also work with all your colonists selected.

Kirid

Oh my gosh this is awesome ;D just what I was wishing for. I thought it was too good to be true at first. I started a new game and played around with it in godmode for a bit, no errors and works as intended so far. I'm going to start testing out mods with it, then play a full colony.
You can't rollerskate in a muffalo herd

Celthric Aysen

This would definitely be very very very useful!
THANK YOU!
My DeviantART|E-Vehicles|Flebe's  Channel
"♫"Every people that i see i will never understand"♪"

pawnstorm

Glad you're enjoying it :). On a sidenote, if you really want to use this mod in one of your existing savegames you could in theory open up the savegame in notepad and replace every instance of 'Class="Pawn"' with 'Class="BattleFormations.XPawn"' (remove the single quotes). You could probably also do the opposite to disable the mod, but you'd still have some saved positions in your savegame (which is probably harmless, but I haven't tested that).

Celthric Aysen

Quote from: pawnstorm on April 25, 2014, 02:00:35 AM
Glad you're enjoying it :). On a sidenote, if you really want to use this mod in one of your existing savegames you could in theory open up the savegame in notepad and replace every instance of 'Class="Pawn"' with 'Class="BattleFormations.XPawn"' (remove the single quotes). You could probably also do the opposite to disable the mod, but you'd still have some saved positions in your savegame (which is probably harmless, but I haven't tested that).
Awesome!
My DeviantART|E-Vehicles|Flebe's  Channel
"♫"Every people that i see i will never understand"♪"

Kirid

I plopped it into a rimworld folder with 30 other mods, no problems so far. No conflicts with the AlphaMuffalo mod, my only pawn-adding mod. Since your xml just changes the <thingClass> of "BasePawn", I think anything loaded before may automatically get written over as a BattleFormations.XPawn?
You can't rollerskate in a muffalo herd

pawnstorm

I expect that's how it works, yes. I considered only changing the class of human pawns, but I figured someone might add tamable pets some day and I want my mod to be ready for it :P. Like dogs that can haul and melee attack or something.

Killaim


Celthric Aysen

#10
BTW pawnstorm if you want me to make icons for your mod, tell me.
a good mod requires good textures ;)
My DeviantART|E-Vehicles|Flebe's  Channel
"♫"Every people that i see i will never understand"♪"

pawnstorm

Quote from: Blackjack1000K on April 25, 2014, 04:01:01 AM
BTW pawnstorm if you want me to make icons for your mod, tell me.
i good mod requires good textures ;)

Thanks for the offer! I think the icons I used look nice enough, but if you have any ideas how to make something that looks better I'd definitely appreciate it!

Celthric Aysen

Quote from: pawnstorm on April 25, 2014, 04:13:02 AM
Quote from: Blackjack1000K on April 25, 2014, 04:01:01 AM
BTW pawnstorm if you want me to make icons for your mod, tell me.
i good mod requires good textures ;)

Thanks for the offer! I think the icons I used look nice enough, but if you have any ideas how to make something that looks better I'd definitely appreciate it!
Alright'y then il give it to you tomorrow
My DeviantART|E-Vehicles|Flebe's  Channel
"♫"Every people that i see i will never understand"♪"

Architect

Awesome man :D I'm so glad someone decided to make this. :)
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


keyes

This is a great mod.  The next thing that would be cool to go with it is to have speakers, or flashing red lights that you can activate. Anyone near the lights or speakers go to their positions.