ItsMods

Full Version: my Doors close, but not open.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, i have a probelem with my Doors! I can close, but no open Sad Important my Mod, is no with Zombi!

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;
}

DoorThink(open, close)
{
        while(1)
        {
                if(self.hp > 0){
                        self waittill ( "triggeruse" , player );
                        if(player.team == "allies"){
                                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 == "axis"){
                                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;
                }
        }
}

DoorUse(range)
{
        self endon("disconnect");
        while(1)
        {
                foreach(player in level.players)
                {
                        if(Distance(self.origin, player.origin) <= self.range){
                                if(player.team == "allies"){
                                        if(self.state == "open"){
                                                player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door";
                                        }
                                        if(self.state == "close"){
                                                player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door";
                                        }
                                        if(self.state == "broken"){
                                                player.hint = "^1Door is Broken";
                                        }
                                }
                                if(player.team == "axis"){
                                        if(self.state == "close"){
                                                player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door";
                                        }
                                        if(self.state == "broken"){
                                                player.hint = "^1Door is Broken";
                                        }
                                }
                                if(player.buttonPressed[ "+activate" ] == 1){
                                        player.buttonPressed[ "+activate" ] = 0;
                                        self notify( "triggeruse" , player);
                                }
                        }
                }
                wait .045;
        }
}

ResetDoors(open, hp)
{
        while(1)
        {
                level waittill("RESETDOORS");
                self.hp = hp;
                self MoveTo(open, level.doorwait);
                self.state = "open";
        }
}

Code:
CreateDoors((565, 1540, 295), (653, 1540, 295), (90, 90, 0), 3, 2, 15, 60);
The reason are those things, you need that function, the one that makes the .buttonpressed thing

Code:
if(player.buttonPressed[ "+activate" ] == 1){
                                        player.buttonPressed[ "+activate" ] = 0;
Okay, my Doors working! THX for your Tipp! Next Problem.... no Text

Code:
"Close the door"
"Open the door"



(10-07-2011, 16:31)body_guard Wrote: [ -> ]Okay, my Doors working! THX for your Tipp! Next Problem.... no Text

Code:
"Close the door"
"Open the door"


Awesome music in the background :p
Did you use the sound thingy I added for testing in the chaotic invasion 2 mod, or was it just the sound of your music you were listening to when fraps recorded while you played? :p
Recorded with Fraps, and music added

My Doors working! [open close + Text + all Teams] I found this fuc.... Zombi Bugs ^^



THX to Yamato - nice Tipp!

/please close