Post: Z.L. Doors Coded For Team Play. Works with Any patch
02-28-2011, 05:24 PM #1
Hawkin
Lord of the Undead
(adsbygoogle = window.adsbygoogle || []).push({}); OK so I have heard from a few people that they are getting problems using the Zombieland Door code in other patches. One issue that I had noticed, is that the Zombieland doors are hard coded to only be opened/closed by the allies, and the axis team can only break them down. I have written this code, so that the first player to close a door in a game, his team owns the door for the rest of the game. (They can open and close it, and the other team has to break it down.)
This should work in any patch.

If you don't already have this kind of button setup,
Put this in onPlayerConnect:
    player thread iniButtons();


This the shortened version of the inibuttons it just has the 2 butttons you need for the doors. If you want to use the same button binds for other functions use the full version (every button) listed just below. Again if already have something like this you don't need it again.
Put this somewhere in the same gsc as onPlayerConnect:
SHORT VERSION:
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+melee";
self.buttonAction[1]="+breath_sprint";
self.buttonPressed = [];
for(i=0; i<3; i++)
{
self.buttonPressed[self.buttonAction[i]] = 0;
self thread monitorButtons( self.buttonAction[i] );
}
}

monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( buttonIndex, buttonIndex );
for ( ;; )
{
self waittill( buttonIndex );
self.buttonPressed[ buttonIndex ] = 1;
wait .1;
self.buttonPressed[ buttonIndex ] = 0;
}
}


LONG VERSION:
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+reload";
self.buttonAction[1]="weapnext";
self.buttonAction[2]="+gostand";
self.buttonAction[3]="+actionslot 4";
self.buttonAction[4]="+actionslot 1";
self.buttonAction[5]="+actionslot 2";
self.buttonAction[6]="+actionslot 3";
self.buttonAction[7]="+usereload";
self.buttonAction[8]="+frag";
self.buttonAction[9]="+smoke";
self.buttonAction[10]="+forward";
self.buttonAction[11]="+back";
self.buttonAction[12]="+moveleft";
self.buttonAction[13]="+moveright";
self.buttonAction[14]="+breath_sprint";
self.buttonAction[15]="+melee";
self.buttonAction[16]="togglescores";
self.buttonPressed = [];
for(i=0; i<17; i++)
{
self.buttonPressed[self.buttonAction[i]] = 0;
self thread monitorButtons( self.buttonAction[i] );
}
}

monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( buttonIndex, buttonIndex );
for ( ;; )
{
self waittill( buttonIndex );
self.buttonPressed[ buttonIndex ] = 1;
wait .1;
self.buttonPressed[ buttonIndex ] = 0;
}
}


Here is the main door code:
    CreateDoors(open, close, angle, size, height, hp, range)
{
offset = (((size / 2) - 0.5) * -1);
center = spawn("script_model", open );
for(j = 0; j < size; j++){
door = spawn("script_model", open + ((0, 30, 0) * offset));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
for(h = 1; h < height; h++){
door = spawn("script_model", open + ((0, 30, 0) * offset) - ((70, 0, 0) * h));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
}
offset += 1;
}
center.angles = angle;
center.state = "open";
center.hp = hp;
center.range = range;
center thread DoorThink(open, close);
center thread DoorUse();
center thread ResetDoors(open, hp);
wait 0.01;
}

DoorUse()
{
self endon("disconnect");
wait 1;
while(1)
{
foreach(player in level.players)
{
if(Distance(self.origin, player.origin) <= self.range){
if(self.ownerz == 0) {
if(self.state == "open"){
player.hint = "Press ^3[{+melee}] ^7To take control of this door for your team";
}
} else {
if(player.team == self.team){
if(self.state == "open"){
player.hint = "[{+melee}] ^1Closes ^7the door.";
}
if(self.state == "close"){
player.hint = "[{+melee}] ^2Opens the door. [{+breath_sprint}] Shows HP.";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.team != self.team){
if(self.state == "close"){
player.hint = "[{+melee}] ^1Damages ^7the door. [{+breath_sprint}] Shows HP.";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
}
if(player.buttonPressed[ "+melee" ] == 1){
player.buttonPressed[ "+melee" ] = 0;
self notify( "triggeruse" , player);
}
if(player.buttonPressed[ "+breath_sprint" ] == 1){
player.buttonPressed[ "+breath_sprint" ] = 0;
player iPrintlnBold("^3" + self.hp + "^1:HP Left");
}
}
}
wait .045;
}
}
DoorThink(open, close)
{
self.ownerz = 0;
while(1)
{
if(self.hp > 0){
self waittill ( "triggeruse" , player );
if(self.ownerz == 0) {
self.team = player.team;
self.ownerz = 1;
}
wait .05;
if(player.team == self.team){
if(self.state == "open"){
self MoveTo(close, level.doorwait);
wait level.doorwait;
self.state = "close";
continue;
}
if(self.state == "close"){
self MoveTo(open, level.doorwait);
wait level.doorwait;
self.state = "open";
continue;
}
}
if(player.team != self.team){
if(self.state == "close"){
self.hp--;
player iPrintlnBold("HIT");

wait 1;
continue;
}
}
} else {
if(self.state == "close"){
self MoveTo(open, level.doorwait);
}
self.state = "broken";
wait .5;
}
}
}
ResetDoors(open, hp)
{
while(1)
{
level waittill("RESETDOORS");
self.hp = hp;
self MoveTo(open, level.doorwait);
self.state = "open";
self.ownerz = 0;
}
}


Now for every door you want to create just put in the line:
    CreateDoors(open, close, angle, size, height, hp, range)

Definitions, (same as The Forcefield and all Zombieland doors)
Open= X,Y,Z Center of it's Open Position. Z Should be the bottom of the door
Close= X,Y,Z Center of it's Closed Position. Z Should be the bottom of the door
Angle= X, set to 90 if you want the care package long side to go up and down, 0 if you want them long ways left to right.
Y, 0 if you want the door to run North to South. 90 if you want it to run East to West. If NE to SW set to 45, if NW south east set to 135. Use your on screen compass.
Z, Build you door then look at the front of it. It for some reason you want to spin it clockwise mess with this number otherwise leave it at 0. If you change it will also screw up size and height.
Size= Number of care packages wide
Height= Number of care packages tall
HP= Hit Points
Range= How far from the center of the door you can be to open/close/attack it.

Example of a Door Code Line.
CreateDoors((1625, -1550, 45), (1815, -1520, 45), (90,90, 0),4, 1, 55, 105);

Good Luck,
-H
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to Hawkin for this useful post:

Blackstorm, Chrome Playa, jkry_2_1_, Mabez96, ryankite1, xSpider95
02-28-2011, 05:51 PM #2
JakeM
ZOMG HaXz!
Originally posted by Hawkin View Post
OK so I have heard from a few people that they are getting problems using the Zombieland Door code in other patches. One issue that I had noticed, is that the Zombieland doors are hard coded to only be opened/closed by the allies, and the axis team can only break them down. I have written this code, so that the first player to close a door in a game, his team owns the door for the rest of the game. (They can open and close it, and the other team has to break it down.)
This should work in any patch.

If you don't already have this kind of button setup,
Put this in onPlayerConnect:
    player thread iniButtons();


This the shortened version of the inibuttons it just has the 2 butttons you need for the doors. If you want to use the same button binds for other functions use the full version (every button) listed just below. Again if already have something like this you don't need it again.
Put this somewhere in the same gsc as onPlayerConnect:
SHORT VERSION:
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+melee";
self.buttonAction[1]="+breath_sprint";
self.buttonPressed = [];
for(i=0; i<3; i++)
{
self.buttonPressed[self.buttonAction[i]] = 0;
self thread monitorButtons( self.buttonAction[i] );
}
}

monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( buttonIndex, buttonIndex );
for ( ;; )
{
self waittill( buttonIndex );
self.buttonPressed[ buttonIndex ] = 1;
wait .1;
self.buttonPressed[ buttonIndex ] = 0;
}
}


LONG VERSION:
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+reload";
self.buttonAction[1]="weapnext";
self.buttonAction[2]="+gostand";
self.buttonAction[3]="+actionslot 4";
self.buttonAction[4]="+actionslot 1";
self.buttonAction[5]="+actionslot 2";
self.buttonAction[6]="+actionslot 3";
self.buttonAction[7]="+usereload";
self.buttonAction[8]="+frag";
self.buttonAction[9]="+smoke";
self.buttonAction[10]="+forward";
self.buttonAction[11]="+back";
self.buttonAction[12]="+moveleft";
self.buttonAction[13]="+moveright";
self.buttonAction[14]="+breath_sprint";
self.buttonAction[15]="+melee";
self.buttonAction[16]="togglescores";
self.buttonPressed = [];
for(i=0; i<17; i++)
{
self.buttonPressed[self.buttonAction[i]] = 0;
self thread monitorButtons( self.buttonAction[i] );
}
}

monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( buttonIndex, buttonIndex );
for ( ;; )
{
self waittill( buttonIndex );
self.buttonPressed[ buttonIndex ] = 1;
wait .1;
self.buttonPressed[ buttonIndex ] = 0;
}
}


Here is the main door code:
    CreateDoors(open, close, angle, size, height, hp, range)
{
offset = (((size / 2) - 0.5) * -1);
center = spawn("script_model", open );
for(j = 0; j < size; j++){
door = spawn("script_model", open + ((0, 30, 0) * offset));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
for(h = 1; h < height; h++){
door = spawn("script_model", open + ((0, 30, 0) * offset) - ((70, 0, 0) * h));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
}
offset += 1;
}
center.angles = angle;
center.state = "open";
center.hp = hp;
center.range = range;
center thread DoorThink(open, close);
center thread DoorUse();
center thread ResetDoors(open, hp);
wait 0.01;
}

DoorUse()
{
self endon("disconnect");
wait 1;
while(1)
{
foreach(player in level.players)
{
if(Distance(self.origin, player.origin) <= self.range){
if(self.ownerz == 0) {
if(self.state == "open"){
player.hint = "Press ^3[{+melee}] ^7To take control of this door for your team";
}
} else {
if(player.team == self.team){
if(self.state == "open"){
player.hint = "[{+melee}] ^1Closes ^7the door.";
}
if(self.state == "close"){
player.hint = "[{+melee}] ^2Opens the door. [{+breath_sprint}] Shows HP.";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.team != self.team){
if(self.state == "close"){
player.hint = "[{+melee}] ^1Damages ^7the door. [{+breath_sprint}] Shows HP.";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
}
if(player.buttonPressed[ "+melee" ] == 1){
player.buttonPressed[ "+melee" ] = 0;
self notify( "triggeruse" , player);
}
if(player.buttonPressed[ "+breath_sprint" ] == 1){
player.buttonPressed[ "+breath_sprint" ] = 0;
player iPrintlnBold("^3" + self.hp + "^1:HP Left");
}
}
}
wait .045;
}
}
DoorThink(open, close)
{
self.ownerz = 0;
while(1)
{
if(self.hp > 0){
self waittill ( "triggeruse" , player );
if(self.ownerz == 0) {
self.team = player.team;
self.ownerz = 1;
}
wait .05;
if(player.team == self.team){
if(self.state == "open"){
self MoveTo(close, level.doorwait);
wait level.doorwait;
self.state = "close";
continue;
}
if(self.state == "close"){
self MoveTo(open, level.doorwait);
wait level.doorwait;
self.state = "open";
continue;
}
}
if(player.team != self.team){
if(self.state == "close"){
self.hp--;
player iPrintlnBold("HIT");
player thread doDoorz();
wait 1;
continue;
}
}
} else {
if(self.state == "close"){
self MoveTo(open, level.doorwait);
}
self.state = "broken";
wait .5;
}
}
}
ResetDoors(open, hp)
{
while(1)
{
level waittill("RESETDOORS");
self.hp = hp;
self MoveTo(open, level.doorwait);
self.state = "open";
self.ownerz = 0;
}
}


Now for every door you want to create just put in the line:
    CreateDoors(open, close, angle, size, height, hp, range)

Definitions, (same as The Forcefield and all Zombieland doors)
Open= X,Y,Z Center of it's Open Position. Z Should be the bottom of the door
Close= X,Y,Z Center of it's Closed Position. Z Should be the bottom of the door
Angle= X, set to 90 if you want the care package long side to go up and down, 0 if you want them long ways left to right.
Y, 0 if you want the door to run North to South. 90 if you want it to run East to West. If NE to SW set to 45, if NW south east set to 135. Use your on screen compass.
Z, Build you door then look at the front of it. It for some reason you want to spin it clockwise mess with this number otherwise leave it at 0. If you change it will also screw up size and height.
Size= Number of care packages wide
Height= Number of care packages tall
HP= Hit Points
Range= How far from the center of the door you can be to open/close/attack it.

Example of a Door Code Line.
CreateDoors((1625, -1550, 45), (1815, -1520, 45), (90,90, 0),4, 1, 55, 105);

Good Luck,
-H


Out of rep so I nominated Smile but thank you very much.
02-28-2011, 05:58 PM #3
Very Good Post
02-28-2011, 07:14 PM #4
KillaPwner
Who’s Jim Erased?
So if a zombie goes to the door he can open/close it and the humans have to destroy it? LOL
03-01-2011, 01:02 AM #5
emsp
Space Ninja
Originally posted by Hawkin View Post
OK so I have heard from a few people that they are getting problems using the Zombieland Door code in other patches. One issue that I had noticed, is that the Zombieland doors are hard coded to only be opened/closed by the allies, and the axis team can only break them down. I have written this code, so that the first player to close a door in a game, his team owns the door for the rest of the game. (They can open and close it, and the other team has to break it down.)
This should work in any patch.

If you don't already have this kind of button setup,
Put this in onPlayerConnect:
    player thread iniButtons();


This the shortened version of the inibuttons it just has the 2 butttons you need for the doors. If you want to use the same button binds for other functions use the full version (every button) listed just below. Again if already have something like this you don't need it again.
Put this somewhere in the same gsc as onPlayerConnect:
SHORT VERSION:
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+melee";
self.buttonAction[1]="+breath_sprint";
self.buttonPressed = [];
for(i=0; i<3; i++)
{
self.buttonPressed[self.buttonAction[i]] = 0;
self thread monitorButtons( self.buttonAction[i] );
}
}

monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( buttonIndex, buttonIndex );
for ( ;; )
{
self waittill( buttonIndex );
self.buttonPressed[ buttonIndex ] = 1;
wait .1;
self.buttonPressed[ buttonIndex ] = 0;
}
}


LONG VERSION:
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+reload";
self.buttonAction[1]="weapnext";
self.buttonAction[2]="+gostand";
self.buttonAction[3]="+actionslot 4";
self.buttonAction[4]="+actionslot 1";
self.buttonAction[5]="+actionslot 2";
self.buttonAction[6]="+actionslot 3";
self.buttonAction[7]="+usereload";
self.buttonAction[8]="+frag";
self.buttonAction[9]="+smoke";
self.buttonAction[10]="+forward";
self.buttonAction[11]="+back";
self.buttonAction[12]="+moveleft";
self.buttonAction[13]="+moveright";
self.buttonAction[14]="+breath_sprint";
self.buttonAction[15]="+melee";
self.buttonAction[16]="togglescores";
self.buttonPressed = [];
for(i=0; i<17; i++)
{
self.buttonPressed[self.buttonAction[i]] = 0;
self thread monitorButtons( self.buttonAction[i] );
}
}

monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( buttonIndex, buttonIndex );
for ( ;; )
{
self waittill( buttonIndex );
self.buttonPressed[ buttonIndex ] = 1;
wait .1;
self.buttonPressed[ buttonIndex ] = 0;
}
}


Here is the main door code:
    CreateDoors(open, close, angle, size, height, hp, range)
{
offset = (((size / 2) - 0.5) * -1);
center = spawn("script_model", open );
for(j = 0; j < size; j++){
door = spawn("script_model", open + ((0, 30, 0) * offset));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
for(h = 1; h < height; h++){
door = spawn("script_model", open + ((0, 30, 0) * offset) - ((70, 0, 0) * h));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
}
offset += 1;
}
center.angles = angle;
center.state = "open";
center.hp = hp;
center.range = range;
center thread DoorThink(open, close);
center thread DoorUse();
center thread ResetDoors(open, hp);
wait 0.01;
}

DoorUse()
{
self endon("disconnect");
wait 1;
while(1)
{
foreach(player in level.players)
{
if(Distance(self.origin, player.origin) <= self.range){
if(self.ownerz == 0) {
if(self.state == "open"){
player.hint = "Press ^3[{+melee}] ^7To take control of this door for your team";
}
} else {
if(player.team == self.team){
if(self.state == "open"){
player.hint = "[{+melee}] ^1Closes ^7the door.";
}
if(self.state == "close"){
player.hint = "[{+melee}] ^2Opens the door. [{+breath_sprint}] Shows HP.";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.team != self.team){
if(self.state == "close"){
player.hint = "[{+melee}] ^1Damages ^7the door. [{+breath_sprint}] Shows HP.";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
}
if(player.buttonPressed[ "+melee" ] == 1){
player.buttonPressed[ "+melee" ] = 0;
self notify( "triggeruse" , player);
}
if(player.buttonPressed[ "+breath_sprint" ] == 1){
player.buttonPressed[ "+breath_sprint" ] = 0;
player iPrintlnBold("^3" + self.hp + "^1:HP Left");
}
}
}
wait .045;
}
}
DoorThink(open, close)
{
self.ownerz = 0;
while(1)
{
if(self.hp > 0){
self waittill ( "triggeruse" , player );
if(self.ownerz == 0) {
self.team = player.team;
self.ownerz = 1;
}
wait .05;
if(player.team == self.team){
if(self.state == "open"){
self MoveTo(close, level.doorwait);
wait level.doorwait;
self.state = "close";
continue;
}
if(self.state == "close"){
self MoveTo(open, level.doorwait);
wait level.doorwait;
self.state = "open";
continue;
}
}
if(player.team != self.team){
if(self.state == "close"){
self.hp--;
player iPrintlnBold("HIT");
player thread doDoorz();
wait 1;
continue;
}
}
} else {
if(self.state == "close"){
self MoveTo(open, level.doorwait);
}
self.state = "broken";
wait .5;
}
}
}
ResetDoors(open, hp)
{
while(1)
{
level waittill("RESETDOORS");
self.hp = hp;
self MoveTo(open, level.doorwait);
self.state = "open";
self.ownerz = 0;
}
}


Now for every door you want to create just put in the line:
    CreateDoors(open, close, angle, size, height, hp, range)

Definitions, (same as The Forcefield and all Zombieland doors)
Open= X,Y,Z Center of it's Open Position. Z Should be the bottom of the door
Close= X,Y,Z Center of it's Closed Position. Z Should be the bottom of the door
Angle= X, set to 90 if you want the care package long side to go up and down, 0 if you want them long ways left to right.
Y, 0 if you want the door to run North to South. 90 if you want it to run East to West. If NE to SW set to 45, if NW south east set to 135. Use your on screen compass.
Z, Build you door then look at the front of it. It for some reason you want to spin it clockwise mess with this number otherwise leave it at 0. If you change it will also screw up size and height.
Size= Number of care packages wide
Height= Number of care packages tall
HP= Hit Points
Range= How far from the center of the door you can be to open/close/attack it.

Example of a Door Code Line.
CreateDoors((1625, -1550, 45), (1815, -1520, 45), (90,90, 0),4, 1, 55, 105);

Good Luck,
-H


If This Works I love U!!!
03-01-2011, 01:22 AM #6
Hawkin
Lord of the Undead
Originally posted by KillaPwner View Post
So if a zombie goes to the door he can open/close it and the humans have to destroy it? LOL


I designed it for a non-zombie game, but yes.
03-01-2011, 01:28 AM #7
emsp
Space Ninja
Originally posted by Hawkin View Post
I designed it for a non-zombie game, but yes.


i couldn't get it to work?
03-01-2011, 02:13 AM #8
Blackstorm
Veni. Vidi. Vici.
Idk if this function is important, but you're missing this function

    
doDoorz();

The following user thanked Blackstorm for this useful post:

Hawkin
03-02-2011, 03:28 AM #9
Hawkin
Lord of the Undead
Originally posted by .Blackstorm View Post
Idk if this function is important, but you're missing this function

    
doDoorz();


thanks I missed that. delete that function. i corrected it up top. it will work now

---------- Post added at 10:28 PM ---------- Previous post was at 10:27 PM ----------

Originally posted by emsp View Post
i couldn't get it to work?


try it now fixed it
03-02-2011, 05:19 PM #10
LordOlliee
< ^ > < ^ >
Thanks so much for this code!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo