More or less I don’t think you’re able to edit the egg’s properties, but you can work around that problem by spawning a dino, have it lay an egg via the CreateCloneFertilizedEgg function, then immediately delete the dino that you just spawned in.
Here’s a blueprint graph that I posted the other day Spawning a fertilized egg posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
I try to be descriptive as possible when I code anything in a graph via the comment feature, but just to further iterate i’ll explain it more in detail.
In the “event play just for testing purposes” section:
I’m only using begin play here to quickly test out what I’m trying to do. I spawned an ankylo directly on the by dragging my remapped version of the ankylo blueprint into the test level. Note: I’m using are mapped version of the ankylo, but I don’t think it’s 100% necessary, however since you don’t want to remap any dinos you’ll have to figure out way to get a reference to the dinos that you want to lay eggs. For right I would suggest just temporarily remapping a dino just so you can play around with the code and test things to figure out exactly how it works.
In the “get dino’s world position” section:
Here I’m getting the world position of the dino that I can see walking around on the map (this is the dino that I directly added to the level with the editor for testing). Honestly I don’t really know exactly understand K2_GetWorld, but it doesn’t matter. I’m “assuming” that “the world” it returns is the level that the test dinos resides in. K2_GetActorLocation returns a vector that tells us the exact position in the world where our test dino is. K2_GetActorRotation tells us what direction it is facing.
In the “spawn a temporary dino at our position…” section:
This is where the actual fun stuff starts w/ the “Spawn Dino” function. We could skip spawning this temporary dino if we wanted to the egg to be the same level as the dino that we see on the map. I wanted to spawn an egg that was the same level as if you were to tame the dino, otherwise tamed dinos through the traditional process will always be higher level than the ones created through the fertilized egg. If you want to set the eggs level to something other than the test dino’s level then you must “check” the boolean “Override Base NPCLevel” to true, then you must set a dino level integer in “NPCAbsoluteBaseLevel”. The “return value” of “Spawn Dino” is a reference to the dino that I just spawned. I should have set the “K2_GetActorLocation” and “K2_GetActorRotation” to reference the test dino and not the dino that I created with SpawnDino. The CreateCloneFertilizedEgg forces the dino to lay a proper egg with a proper amount of health and the level that we choose. K2_DestroyActor deletes the temporary dino that I spawned in.
Note: CreateCloneFertilizedEgg gives a reference to egg that was just laid. This reference will allow you to manipulate the egg. You should be able to put this egg into a dinos inventory if you want.
Since you don’t want to overwrite any dino bps, you’re gonna have to find someway to get a reference to the dino that you want to lay the egg.
There are other options that are probably easier. You could do something like make a “vending machine” type item that if a player clicks on it or something then it will spawn a dino, like i did in my link, have it lay an egg, then delete the dino.
You can create admin commands that spawn in the temporary dino to lay a proper egg.
You can probably create a blueprint that makes an invisible item that the admin places around the map and have the item run a timer. When the timer goes off, it checks dinos in a radius around the item to get a reference to them and have the invisible item take care of the logic that spawns the egg. If you go this route, you’ll also want to check all of the referenced dinos to see what gender they are, if they’re in stasis (stasis means no players are around so the dinos and “sleeping” and not being updated by the server normally), and also the random chance to lay an egg.
You could probably even make a new type of weapon that when it hits a dino, it grabs a reference to the dino, and handles all the logic inside the weapon to get the dino to lay the egg. I’m picturing a “cupid bow w/ pink arrows” for some reason
The possibilities are endless