thread move_door(); //add this below maps\_zombiemode::main(); in _nazi_zombie_mapname.gsc
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
pos_closed = ""; //change here to your door closed position pos_open = ""; //change here to your door open position
door_is = true; //I'm assuming your door starts closed, if don't, change this to false
while(1) { trigger waittill("trigger");
if (door_is) { door MoveTo(pos_open, 0.5); } else { door MoveTo(pos_closed, 0.5); } wait .1; } }
pos_closed = ""; //change here to your door closed position pos_open = ""; //change here to your door open position
you mean change the coordinates of the door and not the script_vector right?
Sorry for not being very clear, I've done some changes in the code, use this one, is better
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false
while(1) { trigger waittill("trigger");
if (door_is) { door MoveTo(door.origin + (door.script_vector * -1), 0.5); } else { door MoveTo(door.origin + (door.script_vector), 0.5); } wait .1; } }
Just set the script_vector kvp in your door like a normal door.
Sorry for not being very clear, I've done some changes in the code, use this one, is better
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false
while(1) { trigger waittill("trigger");
if (door_is) { door MoveTo(door.origin + (door.script_vector * -1), 0.5); } else { door MoveTo(door.origin + (door.script_vector), 0.5); } wait .1; } }
Just set the script_vector kvp in your door like a normal door.
I'm a toldler when it comes to writing code, so thank you for your help! I can't test it since I'm on vacation, but I'm sure it works.
Don't forget to connect and disconnect paths on the door, and make sure the zombies have an alternative path around to the active zone the player could be in, or remove the zone that no player(s) is/are in.
Sorry for not being very clear, I've done some changes in the code, use this one, is better
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false
while(1) { trigger waittill("trigger");
if (door_is) { door MoveTo(door.origin + (door.script_vector * -1), 0.5); } else { door MoveTo(door.origin + (door.script_vector), 0.5); } wait .1; } }
Just set the script_vector kvp in your door like a normal door.
there's a problem, when I use this code the door keeps sliding further and further away instead of coming back.
there's a problem, when I use this code the door keeps sliding further and further away instead of coming back.
use this code (its the exact same apart from Linoxet fogot to add the state changes to make it open / close)
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false
while(1) { trigger waittill("trigger");
if (door_is) { door MoveTo(door.origin + (door.script_vector * -1), 0.5); door_is = false; // WARDOGSK93 - Door will slide other direction next time its triggered } else { door MoveTo(door.origin + (door.script_vector), 0.5); door_is = true; // WARDOGSK93 - Door will slide other direction next time its triggered } wait .1; } }
use this code (its the exact same apart from Linoxet fogot to add the state changes to make it open / close)
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false
while(1) { trigger waittill("trigger");
if (door_is) { door MoveTo(door.origin + (door.script_vector * -1), 0.5); door_is = false; // WARDOGSK93 - Door will slide other direction next time its triggered } else { door MoveTo(door.origin + (door.script_vector), 0.5); door_is = true; // WARDOGSK93 - Door will slide other direction next time its triggered } wait .1; } }
It works! (kinda) if you hit the button again while it's transitioning it will move it too far putting it out of place. I don't know if you can fix this or not but if you can I'd appreciate it.
It works! (kinda) if you hit the button again while it's transitioning it will move it too far putting it out of place. I don't know if you can fix this or not but if you can I'd appreciate it.
Oh, really sorry about that, I was very sleepy when I did the code, forgot some things Should work without any problems now
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false door_can_move = true;
while(1) { trigger waittill("trigger");
if (door_can_move) { if (door_is) { door_can_move = false; door MoveTo(door.origin + (door.script_vector * -1), 0.5); wait 0.5; door_can_move = true; door_is = false; // WARDOGSK93 - Door will slide other direction next time its triggered } else { door_can_move = false; door MoveTo(door.origin + (door.script_vector), 0.5); wait 0.5; door_can_move = true; door_is = true; // WARDOGSK93 - Door will slide other direction next time its triggered } } wait .1; } }
Oh, really sorry about that, I was very sleepy when I did the code, forgot some things Should work without any problems now
Code Snippet
Plaintext
move_door() //add this to the bottom of _nazi_zombie_mapname.gsc { door = GetEnt("YourDoorNameHere", "targetname"); //change YourDoorNameHere to your door targetname kvp trigger = GetEnt("YourTriggerNameHere", "targetname"); //change YourTriggerNameHere to your trigger targetname kvp
door_is = true; //I'm assuming your door starts closed, if don't, change this to false door_can_move = true;
while(1) { trigger waittill("trigger");
if (door_can_move) { if (door_is) { door_can_move = false; door MoveTo(door.origin + (door.script_vector * -1), 0.5); wait 0.5; door_can_move = true; door_is = false; // WARDOGSK93 - Door will slide other direction next time its triggered } else { door_can_move = false; door MoveTo(door.origin + (door.script_vector), 0.5); wait 0.5; door_can_move = true; door_is = true; // WARDOGSK93 - Door will slide other direction next time its triggered } } wait .1; } }