[Release] [GSC] MapEdit
-
Simple MapEdit, don't wait for anything more, for now...
Special thanks to TTV_WIZEQC for the motivation to do this XD
This script worked without problems on servers:- TF-Infected TP #1
- TF-Infected TP #2
I use GSC functions for rotate crates, script not using fields for modification anglesUPDATED: Rewrited on GSC
Source (notepad++ bad formating code )// #include maps\mp\gametypes\_teams; // error init() { switch(GetDvar("mapname")) { case "mp_rust": CreateFloor((0, 0, 0), (512, 512, 0), false); createElevator((0, 0, 0), 512, (0, 0, 0)); break; case "mp_paris": thread createJumpZone((-1036.623, -739.0071, 145.1301), (0, 0, 1250)); thread createJumpZone((-1888.126, 632.3943, 289.125), (-250, 0, 1150)); break; case "mp_dome": thread createTeleportFlagPressedButton((0,0,-350), (500,0,900)); thread createTeleportFlag((0,125,-350), (500,0,1500)); break; } } createFloor(corner1, corner2, isInvisible) { width = corner1[0] - corner2[0]; if (width < 0) { width = width * -1; } length = corner1[1] - corner2[1]; if (length < 0) { length = length * -1; } bwide = floor(width / 50); blength = floor(length / 30); C = (corner2[0] - corner1[0], corner2[1] - corner1[1], corner2[2] - corner1[2]); A = (C[0] / bwide, C[1] / blength, 0); for (i = 0; i < bwide; ++i) { for (j = 0; j < blength; ++j) { crate = spawn("script_model", (corner1[0] + A[0] * i, corner1[1] + A[1] * j, corner1[2])); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); if(isInvisible) { crate hide(); } } } } createRamp(top, bottom, isInvisible) { distance = distance(top, bottom); blocks = ceil(distance / 30) + 1; A = ((top[0] - bottom[0]) / blocks, (top[1] - bottom[1]) / blocks, (top[2] - bottom[2]) / blocks); temp = vectorToAngles((top[0] - bottom[0], top[1] - bottom[1], top[2] - bottom[2])); BA = (temp[2], temp[1] + 90, temp[0]); for (b = 0; b <= blocks; ++b) { crate = spawn("script_model", (bottom[0] + A[0] * b, bottom[1] + A[1] * b, bottom[2] + A[2] * b)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = BA; if(isInvisible) { crate Hide(); } } } createWall(start, end, isInvisible) { D = Distance2D(start, end); H = Distance((0, 0, start[2]), (0, 0, end[2])); blocks = Ceil(D / 60); height = Ceil(H / 30); C = (end[0] - start[0], end[1] - start[1], end[2] - start[2]); A = (C[0] / blocks, C[1] / blocks, C[2] / height); TXA = A[0] / 4; TYA = A[1] / 4; angle = vectorToAngles(C); angle = (0, angle[1], 90); for (h = 0; h < height; ++h) { crate = spawn("script_model", (start[0] + TXA, start[1] + TYA, start[2] + 15 + A[2] * h)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = angle; if(isInvisible) { crate Hide(); } for (i = 0; i < blocks; ++i) { crate = spawn("script_model", (start[0] + A[0] * i, start[1] + A[1] * i, start[2] + 15 + A[2] * h)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = angle; if(isInvisible) { crate Hide(); } } crate = spawn("script_model", (start[0] + TXA * -1, start[1] + TYA * -1, start[2] + 15 + A[2] * h)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = angle; if(isInvisible) { crate Hide(); } } } createJumpZone(position, impulse) { level endon("game_ended"); zone = spawn("script_model", position); zone setModel("weapon_c4_bombsquad"); zone setCursorHint("HINT_NOICON"); zone setHintString("Press and hold ^1[{+activate}] ^7for jump"); zone makeUsable(); for (;;) { wait (.25); foreach (player in level.players) { dist = distance(player.origin, position); if (dist < 75 && player isOnGround() && player useButtonPressed()) { player setVelocity(impulse); } } } } createTeleportFlagPressedButton(startOrigin, endOrigin) { level endon("game_ended"); flagEnter = spawn("script_model", startOrigin); flagEnter setModel(getTeamFlagModel("allieschar")); flagEnter setCursorHint("HINT_NOICON"); flagEnter setHintString("Press and hold ^1[{+activate}] ^7for teleported"); flagEnter makeUsable(); flagExit = spawn("script_model", endOrigin); flagExit setModel(getTeamFlagModel("axischar")); flagExit setCursorHint("HINT_NOICON"); flagExit setHintString("Press and hold ^1[{+activate}] ^7for go back"); flagExit makeUsable(); curObjID = maps\mp\gametypes\_gameobjects::getNextObjID(); objective_add(curObjID, "active"); objective_position(curObjID, startOrigin); objective_icon(curObjID, "compass_waypoint_bomb"); for (;;) { wait (.5); foreach (player in level.players) { distEnter = distance(player.origin, startOrigin); if (distEnter < 75 && player isOnGround() && player useButtonPressed()) { player setOrigin(flagExit.origin); continue; } distExit = distance(player.origin, endOrigin); if (distExit < 75 && player isOnGround() && player useButtonPressed()) { player setOrigin(flagEnter.origin); continue; } } } } createTeleportFlag(startOrigin, endOrigin) { level endon("game_ended"); flagEnter = spawn("script_model", startOrigin); flagEnter setModel(getTeamFlagModel("allieschar")); flagExit = spawn("script_model", endOrigin); flagExit setModel(getTeamFlagModel("axischar")); curObjID = maps\mp\gametypes\_gameobjects::getNextObjID(); objective_add(curObjID, "active"); objective_position(curObjID, startOrigin); objective_icon(curObjID, "compass_waypoint_bomb"); for (;;) { wait (.25); foreach (player in level.players) { dist = distance(player.origin, startOrigin); if (dist < 75) { player setOrigin(endOrigin); } } } } createElevator(start, Z, angle) { floors = []; origin = spawn("script_origin", start + (0, 0, 45)); floor = spawn("script_model", start); floor setModel("com_plasticcase_enemy"); floor solid(); floor SetContents(1); floor CloneBrushmodelToScriptmodel(level.airDropCrateCollision); floor.angles = angle; floor linkTo(origin); for (i = 0; i < 4; i++) { offset = (0, 0, 0); if (i == 0) offset = (28, 30, 0); else if (i == 1) offset = (-28, 30, 0); else if (i == 2) offset = (28, -30, 0); else if (i == 3) offset = (-28, -30, 0); floor = spawn("script_model", start + offset); floor setModel("com_plasticcase_enemy"); floor CloneBrushmodelToScriptmodel(level.airDropCrateCollision); floor.angles = angle; floors[i] = floor; floor linkTo(origin); } for (;;) { wait (10); origin moveZ(Z, 5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player playerLinkTo(origin); player playerLinkedOffsetEnable(); } } wait (5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player setOrigin(player.origin + (0, 0, 10)); player unLink(); } } wait (10); origin moveZ(-1 * Z, 5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player playerLinkTo(origin); player playerLinkedOffsetEnable(); } } wait (5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player setOrigin(player.origin + (0, 0, 10)); player unLink(); } } } } getTeamFlagModel(teamChar) { return tableLookup("mp/factionTable.csv", 0, getMapCustom(teamChar), 10); }
You can test script now on maps: Resistance(jump zones, tree lunge), Rust (center map), Dome(flags teleporter)
CreateRamp(topOrigin, bottomOrigin, isInvisible); CreateFloor(originA, originB, isInvisible); CreateWall(originA, originB, isInvisible); Origins - is vector type [X, Y, Z] isInvisible - is bool type, false - visible, true - hide
Screenshots from servers
-
Really nice!
-
That's pretty pog
-
Nice release
-
Actually cool as fuck. Nice one OP.
-
Very neat!:)
-
S3VDITO amazing work bro, well thought.
-
updated: Rewritten from Chai to GSC
-
Added Elevator and Flag teleporter (telopter to/from by button)
// #include maps\mp\gametypes\_teams; // error init() { switch(GetDvar("mapname")) { case "mp_rust": CreateFloor((0, 0, 0), (512, 512, 0), false); createElevator((0, 0, 0), 512, (0, 0, 0)); break; case "mp_paris": thread createJumpZone((-1036.623, -739.0071, 145.1301), (0, 0, 1250)); thread createJumpZone((-1888.126, 632.3943, 289.125), (-250, 0, 1150)); break; case "mp_dome": thread createTeleportFlagPressedButton((0,0,-350), (500,0,900)); thread createTeleportFlag((0,125,-350), (500,0,1500)); break; } } createFloor(corner1, corner2, isInvisible) { width = corner1[0] - corner2[0]; if (width < 0) { width = width * -1; } length = corner1[1] - corner2[1]; if (length < 0) { length = length * -1; } bwide = floor(width / 50); blength = floor(length / 30); C = (corner2[0] - corner1[0], corner2[1] - corner1[1], corner2[2] - corner1[2]); A = (C[0] / bwide, C[1] / blength, 0); for (i = 0; i < bwide; ++i) { for (j = 0; j < blength; ++j) { crate = spawn("script_model", (corner1[0] + A[0] * i, corner1[1] + A[1] * j, corner1[2])); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); if(isInvisible) { crate hide(); } } } } createRamp(top, bottom, isInvisible) { distance = distance(top, bottom); blocks = ceil(distance / 30) + 1; A = ((top[0] - bottom[0]) / blocks, (top[1] - bottom[1]) / blocks, (top[2] - bottom[2]) / blocks); temp = vectorToAngles((top[0] - bottom[0], top[1] - bottom[1], top[2] - bottom[2])); BA = (temp[2], temp[1] + 90, temp[0]); for (b = 0; b <= blocks; ++b) { crate = spawn("script_model", (bottom[0] + A[0] * b, bottom[1] + A[1] * b, bottom[2] + A[2] * b)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = BA; if(isInvisible) { crate Hide(); } } } createWall(start, end, isInvisible) { D = Distance2D(start, end); H = Distance((0, 0, start[2]), (0, 0, end[2])); blocks = Ceil(D / 60); height = Ceil(H / 30); C = (end[0] - start[0], end[1] - start[1], end[2] - start[2]); A = (C[0] / blocks, C[1] / blocks, C[2] / height); TXA = A[0] / 4; TYA = A[1] / 4; angle = vectorToAngles(C); angle = (0, angle[1], 90); for (h = 0; h < height; ++h) { crate = spawn("script_model", (start[0] + TXA, start[1] + TYA, start[2] + 15 + A[2] * h)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = angle; if(isInvisible) { crate Hide(); } for (i = 0; i < blocks; ++i) { crate = spawn("script_model", (start[0] + A[0] * i, start[1] + A[1] * i, start[2] + 15 + A[2] * h)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = angle; if(isInvisible) { crate Hide(); } } crate = spawn("script_model", (start[0] + TXA * -1, start[1] + TYA * -1, start[2] + 15 + A[2] * h)); crate setModel("com_plasticcase_friendly"); crate CloneBrushmodelToScriptmodel(level.airDropCrateCollision); crate.angles = angle; if(isInvisible) { crate Hide(); } } } createJumpZone(position, impulse) { level endon("game_ended"); zone = spawn("script_model", position); zone setModel("weapon_c4_bombsquad"); zone setCursorHint("HINT_NOICON"); zone setHintString("Press and hold ^1[{+activate}] ^7for jump"); zone makeUsable(); for (;;) { wait (.25); foreach (player in level.players) { dist = distance(player.origin, position); if (dist < 75 && player isOnGround() && player useButtonPressed()) { player setVelocity(impulse); } } } } createTeleportFlagPressedButton(startOrigin, endOrigin) { level endon("game_ended"); flagEnter = spawn("script_model", startOrigin); flagEnter setModel(getTeamFlagModel("allieschar")); flagEnter setCursorHint("HINT_NOICON"); flagEnter setHintString("Press and hold ^1[{+activate}] ^7for teleported"); flagEnter makeUsable(); flagExit = spawn("script_model", endOrigin); flagExit setModel(getTeamFlagModel("axischar")); flagExit setCursorHint("HINT_NOICON"); flagExit setHintString("Press and hold ^1[{+activate}] ^7for go back"); flagExit makeUsable(); curObjID = maps\mp\gametypes\_gameobjects::getNextObjID(); objective_add(curObjID, "active"); objective_position(curObjID, startOrigin); objective_icon(curObjID, "compass_waypoint_bomb"); for (;;) { wait (.5); foreach (player in level.players) { distEnter = distance(player.origin, startOrigin); if (distEnter < 75 && player isOnGround() && player useButtonPressed()) { player setOrigin(flagExit.origin); continue; } distExit = distance(player.origin, endOrigin); if (distExit < 75 && player isOnGround() && player useButtonPressed()) { player setOrigin(flagEnter.origin); continue; } } } } createTeleportFlag(startOrigin, endOrigin) { level endon("game_ended"); flagEnter = spawn("script_model", startOrigin); flagEnter setModel(getTeamFlagModel("allieschar")); flagExit = spawn("script_model", endOrigin); flagExit setModel(getTeamFlagModel("axischar")); curObjID = maps\mp\gametypes\_gameobjects::getNextObjID(); objective_add(curObjID, "active"); objective_position(curObjID, startOrigin); objective_icon(curObjID, "compass_waypoint_bomb"); for (;;) { wait (.25); foreach (player in level.players) { dist = distance(player.origin, startOrigin); if (dist < 75) { player setOrigin(endOrigin); } } } } createElevator(start, Z, angle) { floors = []; origin = spawn("script_origin", start + (0, 0, 45)); floor = spawn("script_model", start); floor setModel("com_plasticcase_enemy"); floor solid(); floor SetContents(1); floor CloneBrushmodelToScriptmodel(level.airDropCrateCollision); floor.angles = angle; floor linkTo(origin); for (i = 0; i < 4; i++) { offset = (0, 0, 0); if (i == 0) offset = (28, 30, 0); else if (i == 1) offset = (-28, 30, 0); else if (i == 2) offset = (28, -30, 0); else if (i == 3) offset = (-28, -30, 0); floor = spawn("script_model", start + offset); floor setModel("com_plasticcase_enemy"); floor CloneBrushmodelToScriptmodel(level.airDropCrateCollision); floor.angles = angle; floors[i] = floor; floor linkTo(origin); } for (;;) { wait (10); origin moveZ(Z, 5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player playerLinkTo(origin); player playerLinkedOffsetEnable(); } } wait (5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player setOrigin(player.origin + (0, 0, 10)); player unLink(); } } wait (10); origin moveZ(-1 * Z, 5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player playerLinkTo(origin); player playerLinkedOffsetEnable(); } } wait (5); foreach (player in level.players) { dist = distance(player.origin, origin.origin); if (dist < 125) { player setOrigin(player.origin + (0, 0, 10)); player unLink(); } } } } getTeamFlagModel(teamChar) { return tableLookup("mp/factionTable.csv", 0, getMapCustom(teamChar), 10); }
-
S3VDITO Correct me if I'm wrong but I think the elevators should run it in a separate thread. Such that:
thread createElevator((0, 0, 0), 512, (0, 0, 0));
-
Kalitos oh, yes, because of the cycles inside the elevator, thread must be created, thanks
-
S3VDITO hey man not that known with code, i was able to change the position of the crates on rust to where i want, but i am unable to figure out how to make them smaller or bigger, or how to make multiple ones on the same map.
-