
chinoy316 wrote:Hey Pdub, could you kindly tell us how to open a .nk2m file or a .nk2f file (whatever's needed) into the 3ds max 9? I still can't figure it out.
 
 fn ReadFileStr fp=(
   string=ReadString fp
   --print string
   if (string=="2KM") then return "2KM"
    else ( MessageBox ("Please Select the Correct File!") title:"Error" beep:false;return false)
)
struct MYORC(
numV2,vert2=#(),
face2=#(),numF2,newobj,n,
   fn ImpWEP fp i=(
      numV2=ReadLong fp
      for n=1 to numV2 do(
         vert2[n]=[readfloat fp,readfloat fp,readfloat fp]
      )
      numF2=ReadLong fp
      for n=1 to numF2 do (
         a=(ReadShort fp)+1;b=(ReadShort fp)+1;c=(ReadShort fp)+1
         face2[n]=[a,b,c]
         if a>numV2 or a<0 then (print("a="+a as string+"fp="+(ftell fp) as string) )
      )
      --create object
      newobj=mesh name:"01" vertices:vert2 faces:face2
         defaultVCFaces newobj
         newobj.Material=getMeditMaterial 1
         select $01;
         modPanel.addModToSelection (Normalmodifier ()) ui:on
         $.modifiers[#Normal].flip = off
         $.modifiers[#Normal].unify = on
         maxOps.CollapseNode $ off
   ),--End Weapon impobj
   fn wrPoint3 fp outP3=(--write point3 data
      WriteFloat fp outP3.x
      WriteFloat fp outP3.y
      WriteFloat fp outp3.z
   ),
   fn wrshort3 fp in3=(
      WriteShort fp (in3.x-1)
      WriteShort fp (in3.y-1)
      WriteShort fp (in3.z-1)
   ),
   fn ExpWEP fp out i numobj type=(
         numV=GetnumVerts out[i]
         writelong fp numV
         --write verts data
         for n=1 to numV do
         (
            wrpoint3 fp (GetVert out[i] n)
         )
         --write faces data
         numF=GetnumFaces out[i]
         WriteLong fp numF
         for n=1 to numF do (
            wrshort3 fp (GetFace out[i] n)
         )
   MessageBox("100% Complete") title:"Saving File" beep:false
   )--End Weapon Export
)
fn objfilt obj=(
isKindof obj Editable_mesh
)
global typestr            
macroscript IFF_N2KM category:"NBA2K-Model"
(
try (destroyDialog IFF-N2KM) catch() -- this is up here since it doesn't always work at the end
rollout IFF_N2KM "IFF-N2KM"
(
   button impwep "Open N2KM File"
   button expwep "Save N2KM File"
   group "English Version:"
   (
      label titleLabel "NBA2K9 IFF TOOL Editing"
      HyperLink add0 "Made By Zsword" align:#center address:"mailto:jemizhuu@hotmail.com" color:blue hoverColor:red
      label txtdata "2009-03-14"
   )
   on impwep pressed do
   (
      local impzsw fname = getOpenFileName types:"*.n2km (*.n2km)|*.n2km|" caption:"Select File"
         if fname == undefined then return NULL
         fp =  fopen fname "rb"
         typestr=ReadFileStr fp
         if typestr==false then return false
         else (
            if typestr!="2KM" then ( messagebox("100% Complete") title:"Saving File" beep:false;return false)
         )
         max reset file
         setMeditMaterial 1 (standardMaterial selfIllumAmount:0)
         global numobj
         numobj=1;
         global mesh1=#()
         for i=1 to numobj  do (
            mesh1[i]=MYORC i
            mesh1[i].ImpWEP fp i
         )
         actionMan.executeAction 0 "369"
         fclose fp
   )--End Import Wep
   on expwep pressed do
   (
      out=#()
      out=selectByName title:"Select File" ButtonText:"Save" filter:objfilt obj
      if out==undefined then return false
      numsel=out.count
      if numsel!=1 then (messagebox("File Incomplete") title:"´Error" beep:false;return false)
      local export fname = getSaveFileName types:"*.n2km (*.n2km)|*.n2km|" caption:"Complete"
         if fname == undefined then return NULL
         fp = fopen fname "wb"
         WriteString fp "2KM"
         type=0
         for i=1 to numsel do (
            mesh2=MYORC i
            mesh2.ExpWEP fp out i numobj type
         )
         fclose fp
   )--End Export   Wep
)--End Rollout
createDialog IFF_N2KM width:240 height:240 pos:[905,407] style:#(#style_titlebar, #style_sysmenu, #style_minimizebox)
)--End Script  
   
   
   
   
   
   
 
 
   
   
   
   
   
  













 
   
  





+[Double LC] wrote:I'll try to modify the Chinese character into to English... CREDIT to ORIGINAL CREATOR !!!
- Code: Select all
fn ReadFileStr fp=(
string=ReadString fp
--print string
if (string=="2KM") then return "2KM"
else ( MessageBox ("Please Select the Correct File!") title:"Error" beep:false;return false)
)
struct MYORC(
numV2,vert2=#(),
face2=#(),numF2,newobj,n,
fn ImpWEP fp i=(
numV2=ReadLong fp
for n=1 to numV2 do(
vert2[n]=[readfloat fp,readfloat fp,readfloat fp]
)
numF2=ReadLong fp
for n=1 to numF2 do (
a=(ReadShort fp)+1;b=(ReadShort fp)+1;c=(ReadShort fp)+1
face2[n]=[a,b,c]
if a>numV2 or a<0 then (print("a="+a as string+"fp="+(ftell fp) as string) )
)
--create object
newobj=mesh name:"01" vertices:vert2 faces:face2
defaultVCFaces newobj
newobj.Material=getMeditMaterial 1
select $01;
modPanel.addModToSelection (Normalmodifier ()) ui:on
$.modifiers[#Normal].flip = off
$.modifiers[#Normal].unify = on
maxOps.CollapseNode $ off
),--End Weapon impobj
fn wrPoint3 fp outP3=(--write point3 data
WriteFloat fp outP3.x
WriteFloat fp outP3.y
WriteFloat fp outp3.z
),
fn wrshort3 fp in3=(
WriteShort fp (in3.x-1)
WriteShort fp (in3.y-1)
WriteShort fp (in3.z-1)
),
fn ExpWEP fp out i numobj type=(
numV=GetnumVerts out[i]
writelong fp numV
--write verts data
for n=1 to numV do
(
wrpoint3 fp (GetVert out[i] n)
)
--write faces data
numF=GetnumFaces out[i]
WriteLong fp numF
for n=1 to numF do (
wrshort3 fp (GetFace out[i] n)
)
MessageBox("100% Complete") title:"Saving File" beep:false
)--End Weapon Export
)
fn objfilt obj=(
isKindof obj Editable_mesh
)
global typestr
macroscript IFF_N2KM category:"NBA2K-Model"
(
try (destroyDialog IFF-N2KM) catch() -- this is up here since it doesn't always work at the end
rollout IFF_N2KM "IFF-N2KM"
(
button impwep "Open N2KM File"
button expwep "Save N2KM File"
group "English Version:"
(
label titleLabel "NBA2K9 IFF TOOL Editing"
HyperLink add0 "Made By Zsword" align:#center address:"mailto:jemizhuu@hotmail.com" color:blue hoverColor:red
label txtdata "2009-03-14"
)
on impwep pressed do
(
local impzsw fname = getOpenFileName types:"*.n2km (*.n2km)|*.n2km|" caption:"Select File"
if fname == undefined then return NULL
fp = fopen fname "rb"
typestr=ReadFileStr fp
if typestr==false then return false
else (
if typestr!="2KM" then ( messagebox("100% Complete") title:"Saving File" beep:false;return false)
)
max reset file
setMeditMaterial 1 (standardMaterial selfIllumAmount:0)
global numobj
numobj=1;
global mesh1=#()
for i=1 to numobj do (
mesh1[i]=MYORC i
mesh1[i].ImpWEP fp i
)
actionMan.executeAction 0 "369"
fclose fp
)--End Import Wep
on expwep pressed do
(
out=#()
out=selectByName title:"Select File" ButtonText:"Save" filter:objfilt obj
if out==undefined then return false
numsel=out.count
if numsel!=1 then (messagebox("File Incomplete") title:"´Error" beep:false;return false)
local export fname = getSaveFileName types:"*.n2km (*.n2km)|*.n2km|" caption:"Complete"
if fname == undefined then return NULL
fp = fopen fname "wb"
WriteString fp "2KM"
type=0
for i=1 to numsel do (
mesh2=MYORC i
mesh2.ExpWEP fp out i numobj type
)
fclose fp
)--End Export Wep
)--End Rollout
createDialog IFF_N2KM width:240 height:240 pos:[905,407] style:#(#style_titlebar, #style_sysmenu, #style_minimizebox)
)--End Script
open the file using Notepad... Copy the code and paste...






RESULT:
AGAIN !!! CREDIT TO ORIGINAL CREATOR








Za man wrote:Thanks for the answer bro but can you please tell me where i can find that file. THANKS IN ADVANCE.




Return to NBA 2K9 Tutorials & FAQs
Users browsing this forum: No registered users and 1 guest