1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FS2004 gmax fs9 attach point tool

Discussion in 'GMax and 3DS Max' started by AeroFiles, 3/5/12.

  1. AeroFiles

    AeroFiles

    Joined:
    13/5/09
    Messages:
    308
    Country:
    faroeislands
    I can't use the attach point tool in gmax for fs9.
    is there some place to download it?
    in fsx verson it works fine.
  2. JRobinson

    JRobinson

    Joined:
    30/8/07
    Messages:
    912
    Country:
    unitedstates
    One thing I just noticed is that for some reason since the installation of the FSX gamepack I now have an "FSTools" option on the menu bar which was never there in the FS2004 version previously and it doesn't work with the FS2004 gamepack.

    In the past you had to click "MaxScript > Run Script" and then navigate to gmax\gamepacks\fs2004\scripts and load "AttachToolGmax.ms" to attach anything to an FS9 model. This approach seems to still work with my installation anyway so maybe it will work for you as well?

    Jim
  3. AeroFiles

    AeroFiles

    Joined:
    13/5/09
    Messages:
    308
    Country:
    faroeislands
    Does not work for me.
    It wants me to find the attach point tool which I find.
    It then wants me to navigate to teh Effects folder of fs9.

    Then the attach point tool opens but when I click remove crash boxes I get the error, Unknown property 'name' in undefined.



    Code:
    Welcome to MAXScript.
    
    -- Error occurred in attachNocrash()
    --  Frame:
    -- Error occurred in attachNocrash()
    --  Frame:
    
    
    Found it in: gmax\gamepacks\fs2004\scripts and load "AttachToolGmax.ms" as mentioned by you
    
    
    This is how the script looks like:
    
    
    --Set up Flightsim Effects Directory
    fsRoot = getSavePath caption:"Flightsim Effects Directory"
    if fsRoot == undefined then
    (
    	fsRoot = "C:\\Program Files\\Microsoft Games\\Flight Simulator 9\\Effects\\"
    )
    
    --Set up Rollouts
    attachTool = newRolloutFloater "Attach Point Tool!" 300 400
    Rollout extraRollout "Attach params:"
    (
    )
    Rollout extraRollout2 "Attach Objects:"
    (
    )
    
    --Set up array function
    objArray =#()
    fn fixArrayNames objArray =
    (
    	for i = 1 to objArray.count do
    	(
    		objName = getFileNameFile objArray[i]
    		objArray[i] = objName
    	)
    )
    
    --Set up array of effects
    effectsList = getFiles (fsRoot + "\\*.fx")
    insertItem "None" effectsList 1
    fixArrayNames effectsList
    
    --Set up function to  attach names
    attachType = "attachpt_"
    attachName = "Default"
    attachText = "Default"
    fn attachPart attachType attachName attachText =
    (
    	if $ == undefined then
    	(
    		messagebox "Please select an object to use as attach point"
    		return false
    	)
    	if skipToString ($.name as stringstream) (getfilenamefile maxfilename) != undefined then
    	(
    		messageBox "Please do not attach to your main objects, this will blow them away."
    		return false
    	)
    	fullXML = ("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> <FSMakeMdlData version=\"9.0\">" + attachText + "</FSMakeMdlData>")
    	setUserPropBuffer $ fullXML
    	$.name = (attachType + attachName)
    )
    --Get GUID from GUID to names.txt
    fn getGUID objName fullObjectName = 
    (
    	fileIn = openFile (fsRoot + "\\tools\\utils\\bin\\GUID_to_names.txt")
    	skipToString fileIn fullObjectName
    	skipToString fileIn "0"
    	objectGuid = readLine fileIn
    	objGUID = ((substring objectGUID 1 8) + (substring objectGUID 12 8) + (substring objectGUID 23 8) + (substring objectGUID 34 8))
    	attachText = ("<Attachpoint name=\"attachpt_" + objName + "\"> <AttachedObject> <LibraryObject name=\"" + objGUID + "\" scale=\"1.0\"/> </AttachedObject> </Attachpoint>")
    	attachPart "attachpt_" objName attachText
    )
    --Main Rollout tool
    Rollout attachRollout "Attach!"
    (
    	radiobuttons attachTypes "Attach Type:" labels:#("Effect","Object","Platform","Empty","No Crash") columns:1 default:0
    	on attachTypes changed attachNewState do
    	(
    		removeRollout extraRollout attachTool
    		removeRollout extraRollout2 attachTool
    		if attachTypes.state == 1 then
    		(
    			Rollout extraRollout "Attach Effect"
    			(
    				edittext effectName "Effect Name:" fieldWidth:200
    				dropdownlist attachedEffect "Effect to attach:" items:effectsList height:30
    				edittext effectParams "Effect Params:" fieldwidth:180 height:100
    				button attachEffect "Attach an Effect!"
    				on attachEffect pressed do
    				(
    					attachText = ("<Attachpoint name=\"attachpt_" + effectName.text + "\"> <AttachedObject> <Effect effectName=\"" + attachedEffect.selected + "\" effectParams=\"" + effectParams.text + "\"/> </AttachedObject> </Attachpoint>")
    					attachPart "attachpt_" effectName.text attachText
    				)
    			)
    			addRollout extraRollout attachTool
    		)
    		if attachTypes.state == 2 then
    		(
    			Rollout extraRollout "Attach Library Object"
    			(
    				edittext objectName "Object Name:" fieldWidth:200
    				edittext attachedCustom "Custom GUID:" fieldwidth:200
    				button attachCustom "Attach an object!"
    				on attachCustom pressed do
    				(
    					attachText = ("<Attachpoint name=\"attachpt_" + objectName.text + "\"> <AttachedObject> <LibraryObject name=\"" + attachedCustom.text + "\" scale=\"1.0\"/> </AttachedObject> </Attachpoint>")
    					attachPart "attachpt_" objectName.text attachText
    				)
    			)
    			addRollout extraRollout attachTool
    		)
    		if attachTypes.state == 3 then
    		(
    			Rollout extraRollout "Set up a platform!"
    			(
    				edittext platformName "Platform Name:" fieldwidth:180
    				dropdownlist surfaceType "Surface Type:" items:#("CONCRETE","GRASS","WATER","GRASS_BUMPY","ASPHALT","SHORT_GRASS","LONG_GRASS","HARD_TURF","SNOW","ICE","URBAN","FOREST","DIRT","CORAL","GRAVEL","OIL_TREATED","STEEL_MATS","BITUMINUS","BRICK","MACADAM","PLANKS","SAND","SHALE","TARMAC","WRIGHT_FLYER_TRACK","last") height:30
    				button createPlatform "Create a platform!"
    				on createPlatform pressed do
    				(
    					attachText = ("<Platform name=\"platform_" + platformName.text + "\" surfaceType=\"" + surfaceType.selected + "\" /> <NoCrash/> ")
    					attachPart "platform_" platformName.text attachText
    				)
    			)
    			addRollout extraRollout attachTool
    		)
    		if attachTypes.state == 4 then
    		(
    			Rollout extraRollout "Attach beacon or other empty!"
    			(
    				edittext emptyName "Name of empty:" fieldwidth:100
    				button attachBeacon "Attach an empty!"
    				on attachBeacon pressed do
    				(
    					attachText = ("<Attachpoint name=\"attachpt_" + emptyName.text + "\"> </Attachpoint>")
    					attachPart "attachpt_" emptyName.text attachText
    				)
    			)
    			addRollout extraRollout attachTool
    		)
    		if attachTypes.state == 5 then
    		(
    			Rollout extraRollout "Remove Crash Boxes from object!"
    			(
    				button attachNocrash "Remove Crash Boxes!"
    				on attachNocrash pressed do
    				(
    					attachText = ("<NoCrash/>")
    					attachPart "" $.name attachText
    				)
    			)
    			addRollout extraRollout attachTool
    		)
    	)
    )
    addRollout attachRollout attachTool
    Last edited: 4/5/12
  4. JRobinson

    JRobinson

    Joined:
    30/8/07
    Messages:
    912
    Country:
    unitedstates
    I've never used the attach tool to remove crash boxes, but I just tried it and got no errors. I initially tried to remove the crash box from [object]_LOD_100 and got a warning telling me not to attach nocrash to my main objects because it would "blow them away", but then I renamed it [object] instead, and was allowed to attach the nocrash without incident.

    There's an "AttachTool.doc" in gmax\gamepacks\fs2004\docs, nocrash is explained on page 13, looks like a PITA to me. It appears it's purpose is to remove crash boxes from part of the geometry where you'd keep the crash boxes on the remaining geometry (i.e. a platform). IIRC you can specify nocrash globally in the makemdl.cfg.

    Your maxscript appears to be identical to mine from a quick glance of the first few lines.

    I use MCX to remove crash boxes from my FSX models, in fact it's a fixed setting in MCX, and I remove crash boxes from every model I process through it (because I once gained several FPS when I removed crash boxes from a vegetation object that I'd placed hundreds of times).

    Jim
  5. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,235
    Country:
    unitedstates
    Jim, in that case it would appear that you've not kept your GMax gamepack folder structure such that each version's tools are isolated from each other as they must be...
    Notice that I have four separate folders for GMax, and four separate Desktop Icons to load GMax configured to use only one Gamepack folder.
  6. JRobinson

    JRobinson

    Joined:
    30/8/07
    Messages:
    912
    Country:
    unitedstates
    Thanks Bill, actually I didn't install the FS9 gamepack, I copied the FS2002 and FS2004 gamepack installations from my old XP machine so maybe that's the problem. Here's what my directory structure looks like:

    Code:
    C:\MSFS\gmax\gamepacks\fs2002
    C:\MSFS\gmax\gamepacks\fs2004
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack
    
    C:\MSFS\gmax\gamepacks\fs2002\FS2002_SDK
    C:\MSFS\gmax\gamepacks\fs2002\images
    C:\MSFS\gmax\gamepacks\fs2002\plugins
    C:\MSFS\gmax\gamepacks\fs2002\scenes
    C:\MSFS\gmax\gamepacks\fs2002\scripts
    C:\MSFS\gmax\gamepacks\fs2002\texture
    C:\MSFS\gmax\gamepacks\fs2002\FS2002_SDK\BGLC_SDK
    
    C:\MSFS\gmax\gamepacks\fs2004\docs
    C:\MSFS\gmax\gamepacks\fs2004\extras
    C:\MSFS\gmax\gamepacks\fs2004\plugins
    C:\MSFS\gmax\gamepacks\fs2004\scenes
    C:\MSFS\gmax\gamepacks\fs2004\scripts
    C:\MSFS\gmax\gamepacks\fs2004\texture
    C:\MSFS\gmax\gamepacks\fs2004\tools
    C:\MSFS\gmax\gamepacks\fs2004\scenes\texture
    
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\Plugins
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\scenes
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\scripts
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\textures
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\scenes\Clouds
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\scenes\Oil_Rig_Sample
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\scripts\startup
    C:\MSFS\gmax\gamepacks\FSX_GmaxGamePack\textures\DDSFiles
    The "target" field of my FS2004 shortcut looks like this:

    %GMAXLOC%Gmax.exe -i gamepacks\FS2004\gmax.ini -p gamepacks\FS2004\plugin.ini

    Do you have the following files in gmax\ui\macroscripts BTW? These are the only files I'm finding outside of the gamepacks folder that appear to be FS related and they show today as their file date, nearly every other file in the gmax directory has a file date of 11/1/2002.

    Tools-AnimationManager.mcr
    Tools-AttachPointTool.mcr
    Tools-FSCloudTool.mcr
    Tools-LODNameTool.mcr

    How they got there I have no clue, they aren't present in the "Microsoft Flight Simulator X SDK\SDK\Environment Kit\Modeling SDK\FSX_GmaxGamePack" folder which I copied directly into the gmax folder. They appear to be responsible for the FSTools menu in FS20004, and if I try to use these tools, I get a "-- No ""+"" function for undefined" error with what appears to be the exact code from the respective .mcr script displaying in a small window beneath the error alert.

    Also, on very rare occasions I've noticed the FSX version will load without the FSTools menu, but that's only happened once or twice and closing & re-starting gmax has always taken care of that problem. Either way, both gamepacks seem to work correctly with the exception of the FSTools menu in FS9. I've got all the FSX material options for FSX, standard & multi-materials only for FS9, and oddly enough the FSTools menu isn't there when running the FS2002 gamepack, however I haven't exported anything for FS2002 since moving to Win7 so don't know if that one works correctly or not (don't really care, if you know what I mean :) ).

    Guess I should delve deeper and see why I have an FSTools menu for FS9, honestly I hadn't even noticed prior to seeing this thread. I'm leaning towards "If it ain't broke, don't fix it", lol.

    (...oh, and the BGLC_SDK is something I put there myself long ago, it's not necessarily supposed to be there)

    Jim
  7. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,235
    Country:
    unitedstates
    Okay, now I'm puzzled. I see now that even I have an "FS Tools" item on the top menu bar, and see the same "error message(s)" when attempting to use any of them.

    Yes, I too have the same macroscripts in the C:\gmax\ui\macroscripts subfolder. I'm going to assume they were placed there during the installation of the FSX SDK, although for some reason my GMax-FS9 installation is calling for them from the FS Tools menu entry!

    Since I've never had any occasion to use any of those "tools" in my FS9 aircraft modeling, I simply never even noticed the new menu entry! :eek:

    My shortcut's Target is:
    C:\gmax\gmax.exe -q -i gamepacks\FS2004\gmax.ini -p gamepacks\FS2004\plugin.ini

    My plugin.ini is:
    [Directories]
    Standard gmax plug-ins=StdPlugs\
    Additional gmax plug-ins=plugins\
    FS2004=gamepacks\FS2004\plugins\
    [Help]

    In any case, I've now edited my Custom UI and removed the problematic "FS Tools" menu entirely. When I can make some time, I'll figure out how to create a Macroscript to generate a new "FS Tools" menu item with the only two FS9 scripts: Attachpoint and CloudShapes... ;)
    Last edited: 5/5/12
  8. JRobinson

    JRobinson

    Joined:
    30/8/07
    Messages:
    912
    Country:
    unitedstates
    I moved those four files out temporarily, then I statrted the FSX gamepack and it put them all right back again so apparently there's something in one of the FSX scripts that does that. What's really odd is that I double clicked gmax.exe in the root folder and it still loaded with an FSTools menu! Odder (is that a word?) still, is that the FSTools menu is absent when you start the FS20002 gamepack :eek: .

    Oh well, works fine as it is so I think I'll just build some models, lol :) .


    Always enjoy the discussion with ya Bill,

    Jim

Share This Page