Spawning Fx's

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Spawning Fx's

Post by Mysterious »

Hi guys in the old day you could a fx in log 1 like this:

Code: Select all

spawn("fx", party.level, party.x, party.y, party.facing, "red1")
red1:translate(0, 1.5, 0)
red1:setParticleSystem("fade_red_fast_2")
What I would like to know is how you do it for log 2? Thxs :)
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Spawning Fx's

Post by petri »

The FX thing was a terrible hack in LoG1. In LoG2 you build your objects from components.

But if you just need a particle system, an easy way would be to spawn a particle_system object and change the particle system it's using.

Something like this should work (haven't tested):

Code: Select all

local obj = spawn("particle_system", <insert coords here>)
obj.particle:setParticleSystem("fade_red_fast_2")
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Spawning Fx's

Post by Mysterious »

Thxs Petri it works now I have a new weapon :)
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

Re: Spawning Fx's

Post by Phitt »

Works great, but is there any way to avoid the annoying 'Warning! no such particle system: xxx' console message?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Spawning Fx's

Post by minmay »

spawn("particle_system",<coords>).particle:setParticleSystem("torch")
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply