Handy Maxscript for effects...

n4gix

Resource contributor
The only thing Nick did not mention is that you have to click the MAXScript menu in GMax and then select "Run script", after which you can browse for the script file. But those menu names are quite obvious :D.
LOL! Thanks Arno. Sometimes even I miss the "blindingly obvious..." :cool:

Also, perhaps it should be mentioned that you have to actually place the script in the \scripts folder in your gamepack's sub-folder... :D
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

This script works in GMax, so that means it is before you export to MDL/BGL file.

When placing effects you do not have to use the tweaks for ground polygons either, so I think you should just export as normal MDL file with the effects placed. And do a seperate export selected for the ground polygons so you can tweak their code.
 

jtanabodee

Resource contributor
Hi everyone,
I just read about this and wondering if it can be use with objects. Like an elevated highway with light in the middle of the high way.
Best Regards,
jtanabodee
 
Thanks everso much for this script,
two questions, when the effect is placed, how big does the box have to be,
And does GMAX produce a effect file: EG. .fx file?

Thanks in anticipation!

Piran
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
I just read about this and wondering if it can be use with objects. Like an elevated highway with light in the middle of the high way.
Yes, should be possible as long as you place the dummy box at the right altitude.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi Piran,

when the effect is placed, how big does the box have to be
No, that does not matter. It is just a dummy object. The origin of the object is used for the position of the effect.

And does GMAX produce a effect file: EG. .fx file?
No, you have to select the existing FX file you want to use.
 
I don't know how to create the effect file .
After create the box and convert it to Editable Mesh . What's next ??? Please explain me the detail (how fool am I :confused:)
Thanks
 
Fs2004

Hi, I'm using FS2004
I used the Script and followed this article for creating a runway edge lights
http://www.fsdeveloper.com/wiki/index.php?title=Apron_lighting_using_effects_and_GMax

But when I exported to .MDL file (FS2004 gamepack) and compiled to .BGL file via FS2k2 Makemdl, I didnt see the light in FS (attached image) :confused:

Here is the edited script :
Code:
strAttachNumber = 0
           for obj in $box* do
           (
           	obj.name = ("attachpt_rwylights" + (strAttachNumber as string))
           	strBufferText = ("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> <FSMakeMdlData version=\"9.0\"><Attachpoint name=\"attachpt_rwylights" + (strAttachNumber as string) + "\"> <AttachedObject> <Effect effectName=\"fx_navwhi\" effectParams=\"\"/> </AttachedObject> </Attachpoint></FSMakeMdlData>")
           	setUserPropBuffer obj strBufferText
           	strAttachNumber += 1
           )
Please help me, thanks .
 

Attachments

Hi,

This is the method I use for all my Eiresim Scenery's.

First off though you will have to rename all your boxes "day" and then clone all these and call them "night"

You can actually write a script to do this automatically in gmax instead of renaming them all one by one.

The reason you will have two is that you need to create one set for day/night and another for dawn/dusk and the above is the easiest method.

Ok once the above is done save your gmax file and then run the following scripts

For dawn/dusk:

strAttachNumber = 0
for obj in $day* do
(
obj.name = ("attachpt_rwylights" + (strAttachNumber as string))
strBufferText = ("<?xml version=\"1.0\"
encoding=\"ISO-8859-1\" ?> <FSMakeMdlData
version=\"9.0\"><Attachpoint name=\"attachpt_rwylights" +
(strAttachNumber as string) + "\"> <AttachedObject> <Effect
effectName=\"fx_navwhi\" effectParams=\"DAWN=1;DUSK=1\"/>

</AttachedObject> </Attachpoint></FSMakeMdlData>")
setUserPropBuffer obj strBufferText
strAttachNumber += 1
)



and then for day/night:


strAttachNumber = 0
for obj in $day* do
(
obj.name = ("attachpt_rwylights" + (strAttachNumber as string))
strBufferText = ("<?xml version=\"1.0\"
encoding=\"ISO-8859-1\" ?> <FSMakeMdlData
version=\"9.0\"><Attachpoint name=\"attachpt_rwylights" +
(strAttachNumber as string) + "\"> <AttachedObject> <Effect
effectName=\"fx_navwhi\" effectParams=\"DAY=0;NIGHT=1\"/>

</AttachedObject> </Attachpoint></FSMakeMdlData>")
setUserPropBuffer obj strBufferText
strAttachNumber += 1
)




Terry
 
Dear Terry,
Thanks a lot . I have a question . I dont know about the way to rename all boxes into "day", and "night" using the script or...???

Another question : Because I dont want edit a coordinate from .XML file for using my lights as object library, then I export the .MDL file to .BGL by using FS2k2 makemdl.exe (my lights will put exactly based on my ground/apron polygons) . Is it a right way ???
I'll edit the script as you said .
Regards
 
Last edited:
To rename all the boxes just use this below (edit to your desire)..Mine renames anything called "day" to "hello"

strAttachNumber = 0
for obj in $day* do
(
obj.name = ("hello" + (strAttachNumber as
string))

)


For these lights please use the fs2004 gamepack. Just place your boxes/lights in gmax, run the scripts and export.
 
Hi again Terry,
Thanks a lot, I tried more and it worked :)
I consider the fx_navwhi.fx turn my lights to BLUE, with runway edge lights, I want to chose WHITE color, which fx file in FS's Effect folder should I select and how to make them brighter ???

Attached file
 

Attachments

Last edited:
Just one thing i want to talk about.

I used this script to ad the attachpoint settings to the dummys, in my case spheres cause the pivot is allready centered (modified the script to work with spheres).
Then i exported to .x and then to mdl via xtomdl (3dsmax), but when i quickly viewed the model via ModelConverterX i saw no attachpoints. So i compared the properties with the one in a gmax file that i have and found a differents.

This script adds: "<?xml version="1.0" encoding="ISO-8859-1" ?>..... ", but in the example i saw: "FSXML = <?xml version="1.0" encoding="ISO-8859-1" ?>...".
So the FSXML was missing. When i add this couple of signs the attachpoint shows up in MCX.

So for FSX i should add this to the script?
 
hi I use 3dsmax7

now

I edit effectboxwriter.ms in notepad and

strAttachNumber = 0
for obj in $box* do
(
obj.name = ("attachpt_Ltcewh" + (strAttachNumber as string))
strBufferText = ("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> <FSMakeMdlData version=\"9.0\"><Attachpoint name=\"attachpt_Ltcewh" + (strAttachNumber as string) + "\"> <AttachedObject> <Effect effectName=\"Ltcewh\" effectParams=\"DAWN=1;DUSK=1\"/> </AttachedObject> </Attachpoint></FSMakeMdlData>")
setUserPropBuffer obj strBufferText
strAttachNumber += 1
)
* ı create effect and rename "Ltcewh"

3DSMAX
* create box 0.30m, 0.30m, 0.30m
* right click convertto mesh
* select box and maxscript > run script > effectboxwriter.ms
* box autorename "attachpt_Ltcewh"
* aces tool > export lod > edit,create and export "ltcewh.X" file and drop it xtomdl
* library creator > new library > add mdl > "ltcewh.mdl"
* generate library "fspath\addon scenery\myscenery\scenery"

parse complete!

now

* I start FSX
* run object placament tool
* ADD > scenery > ltcewh add but no effect :(

what problems
 
When you right klick on the box(attachpoint) in 3ds max and choose Object Properties, what does it state under "User Defined"?

And mybe you also post your Effect, maybe there is the problem
 

jtanabodee

Resource contributor
I know this script for a long time. But this is the first time I try to use it.
In my airport, VTBS, there are 1366 taxi light pole and I have made all the poles already. The frame rate was 28-32. After I do all the attachments and import to the FSX, the frame rate drop by half to 17. Is that normal? Did I do something wrong? Do I need to do anything else?
 
This script helped me a lot but since i already had lots of different names applied to my objects and didnt want to rename them all i changed the script a bit to add the effects to all selected objects regardless of their names. I thought i share it here as well in case someone is in the same situation i was in. If someone else already uploaded something like this here please appologize for uploading the same thing again.
 

Attachments

nickw

Administrator
Staff member
Wow. This thread lit up when I left to raise the kids. Seems it's still doing well.

I've missed this stuff

New Flight Sim coming. Exciting times.
 
Top