View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:04 am



Reply to topic  [ 11 posts ] 
 Attaching Emitters to Bunker modules , Activate Emitters 
Author Message
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post 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


Tue Jul 13, 2010 7:18 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Attaching Emitters to Bunker modules , Activate Emitters
It all depends on what you're trying to do. So, what are trying to do?


Tue Jul 13, 2010 7:25 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post 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


Tue Jul 13, 2010 7:47 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Tue Jul 13, 2010 7:57 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post 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


Tue Jul 13, 2010 8:10 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Tue Jul 13, 2010 8:43 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post 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


Wed Jul 14, 2010 8:24 pm
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post Re: Attaching Emitters to Bunker modules , Activate Emitters
Use some big PinStrength to keep it from falling.


Thu Jul 15, 2010 5:24 am
Profile YIM WWW
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Attaching Emitters to Bunker modules , Activate Emitters
That worked thanks


Thu Jul 15, 2010 6:20 pm
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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.


Fri Jul 16, 2010 8:14 am
Profile WWW
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post 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


Fri Jul 16, 2010 2:23 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.039s | 15 Queries | GZIP : Off ]