Question about Event Begin Play and Dino Spawning

Hello everyone!

So, I have created an event that I want to happen when a dino is spawned. I’ve tied this custom event to Event Begin Play. It worked fine when the dino is spawned, but if I leave the server and come back, the event happens again. Is this normal behaviour of Begin Play? Any ideas on how I could fix this issue? I’ve done a big of digging, and haven’t had any luck finding anything. Is it a replication issue? It was my understanding that dino’s persist in the servers…shouldn’t that mean that begin play shouldn’t be called everytime I join in? I’m spawning the dino’s manually, by the way - a modified blueprint of them. Everything works normal, just my custom event triggers everytime I join the game.

Thanks in advance everyone!

I’m not expert, but that sounds like a replication issue. It’s executing Event Begin Play on the client, because technically it’s the first time the dino us “seen” from the client’s perspective (after logging in).

There should be a function/variable called IsServer. You can use that with a branch statement to make sure only the server handles the event.

Hello everyone!

So, I have created an event that I want to happen when a dino is spawned. I’ve tied this custom event to Event Begin Play. It worked fine when the dino is spawned, but if I leave the server and come back, the event happens again. Is this normal behaviour of Begin Play? Any ideas on how I could fix this issue? I’ve done a big of digging, and haven’t had any luck finding anything. Is it a replication issue? It was my understanding that dino’s persist in the servers…shouldn’t that mean that begin play shouldn’t be called everytime I join in? I’m spawning the dino’s manually, by the way - a modified blueprint of them. Everything works normal, just my custom event triggers everytime I join the game.

Thanks in advance everyone!
[/QUOTE]

It actually sounds like your event is happening everytime the dino is spawned, or removed from stasis. You would have to create a check in your event to see if the even has been played on that dinosaur before, or you would have to specify exactly what time the event needs to fire off.

Thanks for the replies guys. I will try both of your suggestions this evening and come back with more questions if I have them, or more thanks if something worked :slight_smile:

yep there is an is server :slight_smile:

look here for an example that may help you too :

try to only excecute server side first and if it don’t solve the issue then i think it’s because of the begin play event :s since when you spawn you will active a begin play event yourself.

did you look for an event like DinoSpawn or something like that? maybe they did not have add it for now but that would be the good one to use ^^

else try making an actor is of class > dino just after the event to excecute it only for dino actor. but expert of bp scripting will be of better use than me here it’s just that i have see this thing when looking :smiley:

@

So I do want it to happen everytime they are spawned into the world, but just the initial “spawn”. I figured that because they persist to the server, it wouldn’t spawn again every time I leave and rejoin the game. Is this false logic?

You would want to make a custom event for this then. Event begin play will cause it to only happen I believe when the server is launched or in single player, when you resume play, which is not actually your desired outcome from my understanding

Correct. Any ideas on a custom event for when a dino is spawned? That’s the starting point that I need this other custom event (the one thats happening over and over) to fire, and only once.

So to clarify, ‘Event Begin Play’ happens everytime you log back in on a server, or load a saved local game? Does it happen every time the server restarts?

Quick breakdown when Begin Play fires from my experience:
Server-Side: When the actor is spawned in, When the server is restarted
Client-Side: When the actor is spawned(for all clients currently in replication range), Everytime the actor comes into replication range for the client

Ok, if you do a ‘Do Once’ on Event Begin Play, will it run the do once after every time event begin play runs or will it do it once, rememer that, and never do it again? Or do you have to set a variable saying do once has run, then use a branch?

I don’t think DoOnce will work over a server restart so the save way is to go with a variable and branch. Make sure you enable “SaveGame” in the variable settings so it persists over restarts.