Skip to content

Instantly share code, notes, and snippets.

@BitDEVil2K16
Last active August 8, 2020 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BitDEVil2K16/ac1fa1e324dc58fb05512abad6512832 to your computer and use it in GitHub Desktop.
Save BitDEVil2K16/ac1fa1e324dc58fb05512abad6512832 to your computer and use it in GitHub Desktop.
utility portal_helper_util "Portal Utility" (
button open_portal "Portal Script Starten"
on open_portal pressed do
(
try (destroydialog ::gvp) catch()
rollout gvp "Vertex Position Speichern"
(
group "Nutzung"(
label info1 "1.) Gitter in Poly Gitter wandeln "
label info2 "2.) Vertex auswählen "
label info3 "3.) Position Speichern Klicken "
)
group "Einstellungen"(
spinner 'Room_From' "Von Raum:" range:[0,2147483647,1] type:#integer
spinner 'Room_To' "In Raum:" range:[0,2147483647,0] type:#integer
dropdownlist 'Portal_Flag' "Portal Flag:" items:#("0","4","9","64","66","74","772","1284","8192","8256","9216")
)
Global obj, dir_path, outFile, sv
/*button c_path "Datei wählen"*/
button c "Position Speichern" pos:[15,195] width:100 height:25
button pl "Plane erstellen" pos:[120,195] width:100 height:25
on pl pressed do
(
myplane = plane length:1 width:1 height:1 name:"Portal" lengthsegs:1 widthsegs:1
ConvertTo myplane Editable_Poly
select myplane
)
on c_path pressed do
(
dir_path = getSaveFileName caption:"Unter welchem namen Speichern" initialDir:(getDir #export) filename:"VertexPosition.txt"
outFile = createFile dir_path
)
on c pressed do
(
try(
selection.count == 1 and classof selection[1].baseobject == Editable_Poly
---
dir_path = getSaveFileName caption:"Unter welchem namen Speichern" initialDir:(getDir #export) filename:"VertexPosition.txt"
outFile = createFile dir_path
obj = selection[1].baseobject
local flags = Portal_Flag.selected
local fromRoom = Room_From.value
local toRoom = Room_To.value
format "Name: %\n\n" (selection[1].name) to:outFile
format "GTA5 Portal \(ytyp\): % % %\n\n" ("X") ("Y") ("Z") to:outFile
format "<Item>\n\t<roomFrom value=\"%\"/>\n\t<roomTo value=\"%\"/>\n\t<flags value=\"%\"/>\n\t<mirrorPriority value=\"0\"/>\n\t<opacity value=\"0\"/>\n\t<audioOcclusion value=\"0\"/>\n\t<corners content=\"vector3_array\">\n" (fromRoom) (toRoom) (flags) to:outFile
sv = for i in $.selectedVerts do
(
format "\t\t% % %\n" (i.pos.x) (i.pos.y) (i.pos.z) to:outFile
)
format "\t</corners>\n\t<attachedObjects/>\n</Item>" to:outFile
format "\n\nWorld Coords: X Y Z\n\n" to:outFile
gv = (polyOp.getVertSelection obj) as array
for i = 1 to gv.count do
(
v = (obj.GetVertex i)
format "% % %\n" v.x v.y v.z to:outFile
)
close outFile
)
catch(
messageBox "Es ist ein Fehler aufgetreten, nicht vergessen in ein Poly Gitter zu wandeln"
close outFile
destroydialog ::gvp
createdialog gvp style:#(#style_titlebar, #style_sysmenu, #style_toolwindow, #style_sunkenedge) fgcolor:yellow width:230 height:240
)
)
)
createdialog gvp style:#(#style_titlebar, #style_sysmenu, #style_toolwindow, #style_sunkenedge) fgcolor:yellow width:230 height:240
)
)
openUtility portal_helper_util
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment