Author Topic: OnAdd question  (Read 333 times)

How comes that if i spawn a playertype with an OnAdd script attached to it it will execute that, but won't when i changedatablock to it (via events)?

So, this is what i do:

-Create playertype
-Add an OnAdd script in it
-Spawn Playertype (executes OnAdd script)
-ChangeDatablock via events to playertype (doesn't execute OnAdd script)

I guess, OnAdd won't execute if you changedatablock, but..
How can i ensure it still performs the actions i want it to do when someone changes datablock into my playertype?

I don't have a clue at this very moment, maybe there is an obvious way, but i can't seem to think of it.
« Last Edit: March 24, 2010, 05:47:47 PM by lordician »

The datablock isn't added when it's just changed from a different datablock. Use ::onNewDatablock instead, it uses the same arguments and is called both when a new player using the datablock is spawned and when the datablock of an existing player is changed to your datablock.

The datablock isn't added when it's just changed from a different datablock. Use ::onNewDatablock instead, it uses the same arguments and is called both when a new player using the datablock is spawned and when the datablock of an existing player is changed to your datablock.
Wow, i didn't even know that function existed.

Is that bad? D:

Greatly thanks anyhow.