Particle

  • Create a Client.lua file inside the Scripts folder and put the following content in it.

Example) Creating a fire object using particles

function fireParticleUnitID(posx,posy,id)
  local p = ParticleSystem();
  p.AttachToUnitID(Point(posx,posy),id)

  p.shape = 4
  p.sortOrder = 499

  p.material = 0
  p.startLifetime = 1.5
  p.startSpeed = 1
  p.startSize = 25
  p.gravityModifier = -10
  p.angle = 50
  p.radius = 7
  p.shapeRotX = -90
  p.shapeScaleZ = 13.5
  p.scale = 3
  p.sizeOverLifeTime = true
  p.sizeoVerLifeTimePrefab = 2

  -- particle fire setting
  p.colorOverLifeTime = true
  p.SetColorOverLifeTimeColor(0,Color(255,0,0,255))
  p.RemoveColorOverLifeTimeColor(1);
  p.SetColorOverLifeTimeColorAlpha(0,0)
  p.AddColorOverLifeTimeAlpha(0.5,255)

  p.SetMaterialTexture("Pictures/fireEffect.png","Pictures/fireEffect.png")

  local p2 = ParticleSystem();
  p.AddChild(p2)
  p2.visible = true

  p2.shape = 4
  p2.sortOrder = 500

  p2.material = 4
  p2.startLifetime = 1.5
  p2.startSpeed = 1
  p2.startSize = 20
  p2.gravityModifier = -10
  p2.angle = 50
  p2.scale = 3
  p2.radius = 7
  p2.shapeRotX = -90
  p2.shapeScaleZ = 13.5
  
  p2.sizeOverLifeTime = true
  p2.sizeoVerLifeTimePrefab = 2

  -- particle fire setting
  p2.colorOverLifeTime = true
  p2.SetColorOverLifeTimeColor(0,Color(255,255,0,255))
  p2.RemoveColorOverLifeTimeColor(1);
  p2.SetColorOverLifeTimeColorAlpha(0,0)
  p2.AddColorOverLifeTimeAlpha(0.5,255)

  --Fire picture settings
  p2.SetMaterialTexture("Pictures/fireEffect.png","Pictures/fireEffect.png")
end

Insert the corresponding code content into the client script → Create an auto-start or button input event in Nekoland Studio → Register a script event → Insert fireParticleUnitID(0,0,event.id)

If you follow the above steps, a fire particle will be generated at the location of the event.

If you replace event.id with unit.id, it will be spawned at the player's location. 0,0 is the location where it will be spawned.

Last updated