Looping Effect? (Some LUA involved)

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Looping Effect? (Some LUA involved)

Post by jedimoose32 »

Hi everyone.

I've just finished making a custom effect in Particle Editor - it's just the defense buff effect, but orange, and it's Particle instead of Billboard. Anyway, the 'animation' or behaviour of the effect is essentially the same as the defense buff, so in essence the rings spawn and expand outwards, then disappear. That's it. Here's where it gets interesting...

I'm loading the effect through a custom ingame.lvl and having it spawn on certain units under specific conditions (code excerpt below). That part works great, and the effect plays... once. However, I'd like it to loop until I want to turn it off... is there a way to do that using LUA? Or would I have to do it manually and just make the effect animation repeat itself for a very long time using the Particle Editor? I tried looking at the Tantive turbine effect prop for reference but it looks like they just made the lightning stuff a damage effect (from 100% to 80% health range), which is hard-coded to loop anyway.

Any ideas?

(Excerpt from AssassinMode.lua)
Hidden/Spoiler:
[code]
if isEntryDup == false then
self:PrintMe("\tDOESN'T EXIST!")
table.insert(quicktable, member)
AttachEffectToObject(CreateEffect("assn_sfx_alert"), unit)
end
[/code]
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Looping Effect? (Some LUA involved)

Post by THEWULFMAN »

Why not just make the effect itself loop, and use RemoveEffect when you don't need it anymore?
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Looping Effect? (Some LUA involved)

Post by jedimoose32 »

Okay, I just did a little more reading on how Particle Editor works. It sounds like I change MaxParticles to -1 and that will make it infinite. But when I tried that it crashed PE. I guess I could just make this change manually by opening the .fx file in N++? Or am I going about this the wrong way?

Also, I'm going to have several of the same effect spawned in the same way. If I use RemoveEffect("assn_sfx_alert") will that remove all effects of the same type or is there some way that each instance of the effect is identified? (I actually do want to remove all of them simultaneously so that would work fine)

Edit: Ah, never mind. I'm an idiot. "MaxParticles(-1.0000,-1.0000);" worked fine. My question about RemoveEffect stands though. I used it as mentioned above (with the effect name as the argument) and it did nothing.
Post Reply