ItsMods

Full Version: Door example
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
can someone show me an example on how to use this

Code:
CreateDoors(open, close, xangle, yangle, zangle, size, height, hp, range)
{
        offset = (((size / 2) - 0.5) * -1);
        center = spawn("script_model", open, 1);
        center SetOwner( level );
        for(j = 0; j < size; j++){
                door = spawn("script_model", open + ((35, 0, 0) * offset), 1);
                door setModel(level.crateModelEnemy);
                door SetOwner( level );
                door LinkTo(center);
                for(h = 1; h < height; h++){
                        door = spawn("script_model", open + ((35, 0, 0) * offset) - ((0, 95, 0) * h), 1);
                        door setModel(level.crateModelEnemy);
                        door SetOwner( level );
                        door LinkTo(center);
                }
                offset += 1;
        }
        if(!isDefined(yangle)){
                Temp = VectorToAngles(open - close);
                yangle = Temp[1]-90;
        }
        center.angles = (xangle, yangle, 0-zangle);
        center.state = "open";
        center.maxhp = hp;
        center.hp = hp;
        center.range = range;
        center thread DoorThinkUse(open, close);
        //center thread DoorThinkRepair();
        center thread DoorUse();
        center thread ResetDoors(open, hp);
        wait 0.01;
}
Just imagine it beign a simple thread, but you just don't need to define "who" is using it, so a example of this would be,

Code:
Main()
{
CreateDoors((1337, 1337, 1337), (1313, 4124, 12.3), (0, 0, 0), (0, 0, 0), (0, 0, 0), 5, 20, 99, 190)
}

The thread has to be in the same gsc.
Also I would recommend that you thread it from where the "level" is active, not the player.
So it could be where the "level thread X" is located in the famous
_rank.gsc, in the Init() thread.
Download quarantine chaos zombie mod and look inside it.