Hello. I blatantly wrote to Jecrell to ask about this, but I would like to ask here too.
A new modder here, I studied XML of the game already so I have no issue adding things into the game, but I need to learn how to make incidents now to make somewhat interesting mods.
My first one is aliens/predator mod, so it does need some coding to add the features like alien attacks and predator spawning.
I am currently struggling with basic stuff: how to spawn a pack of pawns of some kind and make them attack the colony through an incident.
If I understand correctly, from what I've seen in Jecrells' code, I need:
1) Make a variable for a PawnKind which find the PawnKind from XML:
varKind = PawnKindDef.Named("Xenomorph");
2) Make a variable for a faction to assign the pawn to:
varFac = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("Aliens"));
3) Make a variable out of PawnGenerator class to get the pawn itself:
varPawn = PawnGenerator.GeneratePawn(varKind, varFac);
Now I just need to force it to find a suitable spawn location and spawnpawns there.
This is where I run into issues.
Jecrell seems to use:
iwLoc = CellFinder.RandomClosewalkCellNear(parms.spawnCenter, ;
https://ludeon.com/forums/index.php?topic=26373.msg266952#msg266952
However my compiler complains that CellFinder.RandomClosewalkCellNear needs 3 parameters and "map" is missing from those.
Can someone help me to figure out why it works for Jecrell and my compiler does not work with it? I can find the definition of this in the metadata:
public static IntVec3 RandomClosewalkCellNear(IntVec3 root, Map map, int radius);
So there seems to be 3 parameters. I have no idea how to get the "Map" to pass to it. Am I doing something completely wrong? I hope that my concern is understood . Thank you in advance.
P.S. A secondary question would be how to make the pawns of a "manhunter" type. I assume there's a simple variable you can flick, but I could not find where to look for it. Is there a "full source code" somewhere I can look up?
A new modder here, I studied XML of the game already so I have no issue adding things into the game, but I need to learn how to make incidents now to make somewhat interesting mods.
My first one is aliens/predator mod, so it does need some coding to add the features like alien attacks and predator spawning.
I am currently struggling with basic stuff: how to spawn a pack of pawns of some kind and make them attack the colony through an incident.
If I understand correctly, from what I've seen in Jecrells' code, I need:
1) Make a variable for a PawnKind which find the PawnKind from XML:
varKind = PawnKindDef.Named("Xenomorph");
2) Make a variable for a faction to assign the pawn to:
varFac = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("Aliens"));
3) Make a variable out of PawnGenerator class to get the pawn itself:
varPawn = PawnGenerator.GeneratePawn(varKind, varFac);
Now I just need to force it to find a suitable spawn location and spawnpawns there.
Code Select
public override bool TryExecute(IncidentParms parms)
{
<variable declaration>
FindSpawnLoc(parms); // locate where to spawn creatures
SpawnAliens(parms); // call the function to spawn the aliens
}
This is where I run into issues.
Jecrell seems to use:
iwLoc = CellFinder.RandomClosewalkCellNear(parms.spawnCenter, ;
https://ludeon.com/forums/index.php?topic=26373.msg266952#msg266952
However my compiler complains that CellFinder.RandomClosewalkCellNear needs 3 parameters and "map" is missing from those.
Can someone help me to figure out why it works for Jecrell and my compiler does not work with it? I can find the definition of this in the metadata:
public static IntVec3 RandomClosewalkCellNear(IntVec3 root, Map map, int radius);
So there seems to be 3 parameters. I have no idea how to get the "Map" to pass to it. Am I doing something completely wrong? I hope that my concern is understood . Thank you in advance.
P.S. A secondary question would be how to make the pawns of a "manhunter" type. I assume there's a simple variable you can flick, but I could not find where to look for it. Is there a "full source code" somewhere I can look up?