Data Realms Fan Forums
http://45.55.195.193/

Attaching Emitters to Bunker modules , Activate Emitters
http://45.55.195.193/viewtopic.php?f=73&t=19239
Page 1 of 1

Author:  BrainChild [ Tue Jul 13, 2010 7:18 pm ]
Post subject:  Attaching Emitters to Bunker modules , Activate Emitters

How do you attache a emitter to a bunker module and start the emitter by some sort of trigger ?
I know nothing about Lua

Author:  CaveCricket48 [ Tue Jul 13, 2010 7:25 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

It all depends on what you're trying to do. So, what are trying to do?

Author:  BrainChild [ Tue Jul 13, 2010 7:47 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

I want to make a fountain and waterfall , I want to attache a emitter that emits water to a bunker module but It has to be activated by some sort of console or something

Author:  Grif [ Tue Jul 13, 2010 7:57 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

Okay, this is gonna sound kinda complicated (probably more complicated than you can do with your current knowledge) but here's what I would do:

Create your bunker module as normal. Have it contain a child object MOSRotating that will be at the exact position of the future AEmitter.

Then run a one-shot Lua script on the MOSR, that executes the following code:
table.insert(waterfalls,self.Pos);

After that script is run, the MOSR can delete itself to cut down on object related lag (not a huge issue, but worth doing).

Now, assuming you're activating all of them at once, your code to replace them is going to look something like this:
for i, v in ipairs(waterfalls) do
local waterfall = CreateAEmitter("Waterfall Emitter");
waterfall.Pos = v;
MovableMan:AddParticle(waterfall);
end

A word of warning: There's more code than this that you're going to need, and this isn't perfect by a long shot. But you're asking for help, not for a finished script, so that's what I'm giving you.

Author:  BrainChild [ Tue Jul 13, 2010 8:10 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

SO I create a script that has
table.insert(waterfalls,self.Pos);
in and attach that to a MOSR that is the same as the child object then I create another Script with
Now, assuming you're activating all of them at once, your code to replace them is going to look something like this:
for i, v in ipairs(waterfalls) do
local waterfall = CreateAEmitter("Waterfall Emitter");
waterfall.Pos = v;
MovableMan:AddParticle(waterfall);
end
in and attach that to ?

so will this replace the child object with a emitter
I am trying to learn Lua but I learn by example and lots of info so the more I know what this does the better I understand how to implement this to something else , so is this 1 script or 2 is it attached to a MOSR or a Emitter

Author:  Grif [ Tue Jul 13, 2010 8:43 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

The first script (the table.insert) would be inside function Create(self) on an MOSRotating.

That MOSRotating is spawned as a Child Object (the .ini name for objects placed with bunker modules, like doors). If you set up the offsets for the MOSRotating relative to the bunkermodule correctly, then the position that it inserts into the global table will be the exact position for where you want the waterfalls.

Basically, what the script is doing is creating a big long list of all the waterfall bunkermodules. Then, when you activate the second script, it will look through the list, and create a waterfall emitter at the same position as all of the MOSRotatings on the bunkermodules.

The second script can be activated however you want; you didn't specify. It could be based on a weapon firing, or a certain actor spawning, or, if it's part of a scene, based on some certain scene condition. How any of that is done depends on what exactly you want.

The actual waterfall AEmitters probably will not require any scripting, at all. The MOSRs just need that short script with table.insert, and then whatever means you use to activate the waterfalls requires the second portion.

Author:  BrainChild [ Wed Jul 14, 2010 8:24 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

Okay so I made all the things that I need
so here I go

I made a child object and attached that to my bunker module it is attached at the right place but when I place the module it falls of
how do I fix that ? (If it matters)

so now I have to attache a Lua file to the MOSR
with this line
Code:
table.insert(waterfalls,self.Pos);


Then I made a emitter that emits the particle that I want now what ?
also How do I make it so that It activates when a actor is within 1000pixels of the Waterfall ?

thanks

Author:  carriontrooper [ Thu Jul 15, 2010 5:24 am ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

Use some big PinStrength to keep it from falling.

Author:  BrainChild [ Thu Jul 15, 2010 6:20 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

That worked thanks

Author:  411570N3 [ Fri Jul 16, 2010 8:14 am ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

Pin strength will be the amount of force required to make it move. Once it is moved, it acts as if it had no pinstrength, so if you want it to be especially robust in terms of interaction with other mods you may want to have it reset its position once every few frames via Lua.

Author:  BrainChild [ Fri Jul 16, 2010 2:23 pm ]
Post subject:  Re: Attaching Emitters to Bunker modules , Activate Emitters

How do I do that , if I can just get all the things working then I can take my time making it better so
#1 Get emitter to replace MOSR (ChildObject) ??????????
#2 create a trigger so that it activates when near waterfall ?????????
#3 Improve

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/