23 lines
944 B
Plaintext
23 lines
944 B
Plaintext
URL: https://wiki.studiominus.nl/snippets/spawnParticle.html
|
|
Title: People Playground Modding - Spawn particles on activation
|
|
==================================================
|
|
|
|
Spawn particles on activation
|
|
This code snippet shows how to spawn the built-in particle effects when the object is activated.
|
|
ModAPI.Register(new Modification()
|
|
{
|
|
//set item details
|
|
OriginalItem = ModAPI.FindSpawnable("Knife"),
|
|
NameOverride = "Epic knife that sparks when you use it",
|
|
DescriptionOverride = "not a single soul knows why this exists",
|
|
ThumbnailOverride = ModAPI.LoadSprite("sparkknife_view.png"),
|
|
|
|
AfterSpawn = (Instance) =>
|
|
{
|
|
//add a UseEventTrigger and set its action
|
|
Instance.AddComponent<UseEventTrigger>().Action = () => {
|
|
//spawn an effect by the name of "Spark" at the transform position
|
|
ModAPI.CreateParticleEffect("Spark", Instance.transform.position);
|
|
};
|
|
}
|
|
}); |