CoD_Modern_Gamer

Insane-Known Member
Messages
44
Reaction score
15
Points
368
Im wondering if it's possible to spawn triggers with GSC.
If so, is it possible to place a trigger somewhere and buy a gun from it or open a door with it?
I hope I can link a trigger to one of the doors in Shadows of Evil just to test if it works to open it with a trigger spawned with GSC.
Btw dont worry about me needing the targetname or something like that, I have it so just make make an example that I can learn from. :grinning:
Thanks.
 

VerTical

CEO
Donator
Messages
0
Reaction score
-86
Points
664
Yes you can spawn But, I'm in holiday I can't Show you How to! :disappointed:
 
Last edited:

VerTical

CEO
Donator
Messages
0
Reaction score
-86
Points
664
Here @CoD_Modern_Gamer, Spawn your own Trigger :VerTical:

Script :

HTML:
spawnTrig(origin,width,height,cursorHint,string)
{
    trig = spawn("trigger_radius", origin, 1, width, height);
    trig setCursorHint(cursorHint, trig);
    trig setHintString( string );
    trig setvisibletoall();
    return trig;
}

function by Extinct!!!

have fun :smile:
 

CoD_Modern_Gamer

Insane-Known Member
Messages
44
Reaction score
15
Points
368
Here @CoD_Modern_Gamer, Spawn your own Trigger :VerTical:

Script :

HTML:
spawnTrig(origin,width,height,cursorHint,string)
{
    trig = spawn("trigger_radius", origin, 1, width, height);
    trig setCursorHint(cursorHint, trig);
    trig setHintString( string );
    trig setvisibletoall();
    return trig;
}

function by Extinct!!!

have fun :grinning:
How do I add target/targetname to trigger a door in a map?
EDIT: And how do I make a buyable weapon with a trigger.
EDIT2: As I tried to say but may not have said it good enough is that I want to add target and targetname to the trigger/weapon buy or other things that I might want to trigger/link together (maybe edit triggers in the world if possible).
I have tried to do something like this:
Code:
function buyableWeapon()
{
    trig = Spawn("trigger_use", (2300,-5350,180.75)); // This is right outside the first door in SoE for testing.
    trig.targetname = "weapon_upgrade";
    trig.target = "auto2197";
    trig.zombie_weapon_upgrade = "shotgun_pump";
    return trig;

    weap = Spawn("script_model", (2297.25, -5351, 178.75)); // This is right outside the first door in SoE for testing.
    weap.targetname = "auto2197";
    weap SetModel("wpn_t7_shotgun_spartan_world");
    return weap;
}
I dont know but this doesnt seem to work (if you can please tell me what is wrong and how to make it work). Btw dont misunderstand the code you gave me worked but here is the code I have tried to make work... :disappointed: Im not the best at coding but I feel like I have learned a bit since I started. I have learned from asking about things here on cabcon modding and from looking in the bo3 scripts that comes with the mod tools including the mod tools docs. :grinning:
 
Last edited:

CoD_Modern_Gamer

Insane-Known Member
Messages
44
Reaction score
15
Points
368
How do I add target/targetname to trigger a door in a map?
EDIT: And how do I make a buyable weapon with a trigger.
EDIT2: As I tried to say but may not have said it good enough is that I want to add target and targetname to the trigger/weapon buy or other things that I might want to trigger/link together (maybe edit triggers in the world if possible).
I have tried to do something like this:
Code:
function buyableWeapon()
{
    trig = Spawn("trigger_use", (2300,-5350,180.75)); // This is right outside the first door in SoE for testing.
    trig.targetname = "weapon_upgrade";
    trig.target = "auto2197";
    trig.zombie_weapon_upgrade = "shotgun_pump";
    return trig;

    weap = Spawn("script_model", (2297.25, -5351, 178.75)); // This is right outside the first door in SoE for testing.
    weap.targetname = "auto2197";
    weap SetModel("wpn_t7_shotgun_spartan_world");
    return weap;
}
I dont know but this doesnt seem to work (if you can please tell me what is wrong and how to make it work). Btw dont misunderstand the code you gave me worked but here is the code I have tried to make work... :disappointed: Im not the best at coding but I feel like I have learned a bit since I started. I have learned from asking about things here on cabcon modding and from looking in the bo3 scripts that comes with the mod tools including the mod tools docs. :grinning:
@CabCon Do you mind helping(if you can)?
 

VerTical

CEO
Donator
Messages
0
Reaction score
-86
Points
664
How do I add target/targetname to trigger a door in a map?
EDIT: And how do I make a buyable weapon with a trigger.
EDIT2: As I tried to say but may not have said it good enough is that I want to add target and targetname to the trigger/weapon buy or other things that I might want to trigger/link together (maybe edit triggers in the world if possible).
I have tried to do something like this:
Code:
function buyableWeapon()
{
    trig = Spawn("trigger_use", (2300,-5350,180.75)); // This is right outside the first door in SoE for testing.
    trig.targetname = "weapon_upgrade";
    trig.target = "auto2197";
    trig.zombie_weapon_upgrade = "shotgun_pump";
    return trig;

    weap = Spawn("script_model", (2297.25, -5351, 178.75)); // This is right outside the first door in SoE for testing.
    weap.targetname = "auto2197";
    weap SetModel("wpn_t7_shotgun_spartan_world");
    return weap;
}
I dont know but this doesnt seem to work (if you can please tell me what is wrong and how to make it work). Btw dont misunderstand the code you gave me worked but here is the code I have tried to make work... :disappointed: Im not the best at coding but I feel like I have learned a bit since I started. I have learned from asking about things here on cabcon modding and from looking in the bo3 scripts that comes with the mod tools including the mod tools docs. :grinning:
why you "return trig" not needed!
 

CoD_Modern_Gamer

Insane-Known Member
Messages
44
Reaction score
15
Points
368
why you "return trig" not needed!
But do you know how to add target, targetname, script_noteworthy, or other Radiant related properties?
Most tutorials are only covering how to do it in Radiant, how whould I do that in gsc?
 

CoD_Modern_Gamer

Insane-Known Member
Messages
44
Reaction score
15
Points
368
@CabCon Could you or someone who knows please awnser the unawnsered question from all the way at the top of the thread. :disappointed: How do I open specific door(s) that already exists in a map (assuming you need targetname and/or target for this)and how do I make buyable weapons using triggers in gsc. :confused:
The reason I made this topic was because I could not make the trigger work to begin with.
I tried to do something like this:
Code:
function buyableWeapon()
{
    trig = Spawn("trigger_use", (2300,-5350,180.75)); // This is right outside the first door in SoE for testing.
    trig.targetname = "weapon_upgrade";
    trig.target = "auto2197";
    trig.zombie_weapon_upgrade = "shotgun_pump";
    return trig;

    weap = Spawn("script_model", (2297.25, -5351, 178.75)); // This is right outside the first door in SoE for testing.
    weap.targetname = "auto2197";
    weap SetModel("wpn_t7_shotgun_spartan_world");
    return weap;
}
//Function to open
function door_think()
{
    self endon("kill_door_think");

    // maybe the door the should just bust open instead of slowly opening.
    // maybe just destroy the door, could be two players from opposite sides..
    // breaking into chunks seems best.
    // or I cuold just give it no collision

    cost = 0;
   
   
    self SetHintLowPriority( true );

    while( 1 )
    {
        switch( self.script_noteworthy )
        {
        case "local_electric_door":
                self zm_blockers::door_opened(cost,true);
           
            self setHintString("");

            //Else door can be closed
            wait 3;
            self zm_blockers::waittill_door_can_close();
            self zm_blockers::door_block();
            self zm_blockers::door_opened(cost,true);
           
            wait 3;
            continue;
           
        case "electric_door":
                self zm_blockers::door_opened(cost,true);
            //Else door can be closed
            wait 3;
            self zm_blockers::waittill_door_can_close();
            self zm_blockers::door_block();
                self zm_blockers::door_opened(cost,true);
            wait 3;
            continue;
            //self self_and_flag_wait( "power_on" );
            //self door_opened(cost);
            //return;

        case "electric_buyable_door":
//          self UseTriggerRequireLookAt();
            break;

        case "delay_door":  // set timer and explode
            self zm_blockers::door_delay();
            break;

        default:
                self [[level._default_door_custom_logic]]();
                break;
        }
        self zm_blockers::door_opened(cost);
        if(!level flag::get("door_can_close"))
        {
            break;
        }  
    }
}
function debris_think()
{
    if( isDefined( level.custom_debris_function ) )
    {
        self [[ level.custom_debris_function ]]();
    }  

    // cut the navmesh
    junk = getentarray( self.target, "targetname" ); 
    for( i = 0; i < junk.size; i++ )
    {  
        if( isdefined( junk[i].script_noteworthy ) )
        {
            if( junk[i].script_noteworthy == "clip" )
            {
                junk[i] disconnectpaths(); 
            }
        }
    }
   
    while( 1 )
    {
                   
            self notify( "kill_debris_prompt_thread" );
           
            // Okay remove the debris
            // delete the stuff
            junk = getentarray( self.target, "targetname" ); 

            // Set any flags called
            if( isdefined( self.script_flag ) )
            {
                tokens = Strtok( self.script_flag, "," );
                for ( i=0; i<tokens.size; i++ )
                {
                    level flag::set( tokens[i] );
                }
            }

            zm_utility::play_sound_at_pos( "purchase", self.origin );
            level notify ("junk purchased");

            move_ent = undefined;
            a_clip = [];
            for( i = 0; i < junk.size; i++ )
            {  
                junk[i] connectpaths(); 

                if( isdefined( junk[i].script_noteworthy ) )
                {
                    if( junk[i].script_noteworthy == "clip" )
                    {
                        a_clip[ a_clip.size ] = junk[i];
                        continue;
                    }
                }

                struct = undefined;
                if ( junk[i] IsZBarrier() )
                {
                    move_ent = junk[i];
                    junk[i] thread zm_blockers::debris_zbarrier_move();
                }
                else if( isdefined( junk[i].script_linkTo ) )
                {
                    struct = struct::get( junk[i].script_linkTo, "script_linkname" );
                    if( isdefined( struct ) )
                    {
                        move_ent = junk[i];
                        junk[i] thread zm_blockers::debris_move( struct );
                    }
                    else
                    {
                        junk[i] Delete();
                    }
                }
                else if( isdefined( junk[i].target) )
                {
                    struct = struct::get( junk[i].target, "targetname" );
                    if( isdefined( struct ) )
                    {
                        move_ent = junk[i];
                        junk[i] thread zm_blockers::debris_move( struct );
                    }
                    else
                    {
                        junk[i] Delete();
                    }
                }
                else
                {
                    junk[i] Delete();
                }
            }
           
            // Connect NavVolume traversals
            a_nd_targets = GetNodeArray( self.target, "targetname" );
            foreach( nd_target in a_nd_targets )
            {
 
                    LinkTraversal( nd_target );
               
            }

            // get all trigs, we might want a trigger on both sides
            // of some junk sometimes
            all_trigs = getentarray( self.target, "target" ); 
            for( i = 0; i < all_trigs.size; i++ )
            {
                all_trigs[i] delete(); 
            }

            for( i=0; i<a_clip.size; i++ )
            {
                a_clip[i] Delete();
            }
               
            if( isdefined( move_ent ) )
            {
                move_ent waittill( "movedone" );
            }
           
            break;
    }
}
Im about to give up on this. :disappointed:
 
Last edited by a moderator:

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,092
Reaction score
2,881
Points
1,103
@CabCon Could you or someone who knows please awnser the unawnsered question from all the way at the top of the thread. :disappointed: How do I open specific door(s) that already exists in a map (assuming you need targetname and/or target for this)and how do I make buyable weapons using triggers in gsc. :confused:
The reason I made this topic was because I could not make the trigger work to begin with.
I tried to do something like this:
Code:
function buyableWeapon()
{
    trig = Spawn("trigger_use", (2300,-5350,180.75)); // This is right outside the first door in SoE for testing.
    trig.targetname = "weapon_upgrade";
    trig.target = "auto2197";
    trig.zombie_weapon_upgrade = "shotgun_pump";
    return trig;

    weap = Spawn("script_model", (2297.25, -5351, 178.75)); // This is right outside the first door in SoE for testing.
    weap.targetname = "auto2197";
    weap SetModel("wpn_t7_shotgun_spartan_world");
    return weap;
}
Im about to give up on this. :disappointed:
Hi,
this is a function for open all doors and debris's:
Code:
function func_openallzombiedoors() {
    zombie_doors = GetEntArray( "zombie_door", "targetname" );
    zombie_debris = GetEntArray( "zombie_debris", "targetname" );
    if(isdefined(zombie_doors))
    {
        array::thread_all(zombie_doors, &door_think, true);
    }
    if (isDefined(zombie_debris))
    {
        array::thread_all(zombie_debris, &debris_think, true);
    }
}
The GetEntArray gets the doors or debris's from the map.
 
Top