Results 1 to 4 of 4

Thread: Triggers don't work properly

  1. #1
    ... connecting
    Join Date
    Aug 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Triggers don't work properly

    Hi all

    I have got such a annoying bugs in my custom map with triggers: damage and use_touch

    With triggers damage when I set them value like Melle_NO they still react on bash. Also when I have everything unselected, triggers won't work for any action (like shoot and bash) expect explosive. When I throw a granade into it, it suddenly works, but after that If I want to try bash or shoot again it still doesn't response.

    With triggers use_touch problem is that they are able to work after few time. There is no icon to press F and no hintstring. Only after some time when I move around trigger, it starts work. Time is differenece sometimes I have to wait 10 sec or 60.

    The majoriity of my triggers work properly but there are about 4 triggers that are bugged which I mentioned. I have around 50 triggers of all type (maybe amount is the problem).

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    What coordinates are these triggers on exactly? (xyz)
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. #3
    ... connecting
    Join Date
    Aug 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Trigger use_touch: (-2574, -494, 60) and second (-2574 -494 60).
    Triggers damage: (-1887, 861, 46)

    I used origin to check the coordinates

  4. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    I always disliked the Radiant triggers, so I created my own triggers, which I could also place in custom maps.

    Random dump of the script files used to create custom triggers with example code just re-discovered via Everything.exe:

    UTILS.gsc

    PHP Code:
    spawnXmodel(namepositiondir)
    {
        
    model spawn("script_model"position);
        
    model.angles = (0dir0);
        
    model setModel(name);

        return 
    model;
    }

    entityToGround()
    {
        
    entity self;

        
    trace bullettrace(entity.originentity.origin-(0,0,10000), falseundefined);
        if (
    trace["fraction"] < 1)
            
    entity.origin trace["position"];

    RANDOMBOX.gsc
    PHP Code:
    #include maps\BTM\UTILS;
    #include maps\BTM\TRIGGER;

    precache()
    {
        
    // init()
        
    game["hintstring_randombox_allies"] = &"^6Press {USE} to buy something!";
        
    game["hintstring_randombox_axis"] = &"^6You cant buy something!";
        
    // precache()
        
    precacheModel("xmodel/furniture_bathtub");
        
    precacheString(game["hintstring_randombox_allies"]);
        
    precacheString(game["hintstring_randombox_axis"]);
    }

    addRandomBox(posdir)
    {
        
    box spawnXmodel("xmodel/furniture_bathtub"posdir);
        
    box.angles = (0dir+900);
        
    box entityToGround();
        
    box spawnUseTrigger(
            ::
    BOX_onUse,
            
    game["hintstring_randombox_allies"],
            
    game["hintstring_randombox_axis"]
        );
    }

    BOX_onUse(player)
    {
        if (
    player.pers["team"] == "allies")
        {
            
    player iprintln("^6NICE DONE HUNTER");
            
    player openMenu("weapon_german");
        }
        if (
    player.pers["team"] == "axis")
        {
            
    player iprintln("^6NICE DONE ZOMBIE");
        }

    TRIGGER.gsc

    PHP Code:
    #include maps\BTM\UTILS;
    #include maps\BTM\HINTSTRING;

    spawnUseTrigger(function, hintstring_allieshintstring_axis)
    {
        
    entity self;

        
    entity.useTrigger true;

        
    trigger spawn("trigger_radius"entity.origin05050);

        
    entity.trigger trigger// for later movement/deletion etc.

        
    while (1)
        {
            
    trigger waittill("trigger"player);

            if (
    entity.useTrigger == false)
            {
                
    wait 0.10;
                continue;
            }

            if (
    player.pers["team"] == "allies")
                
    player thread displayHintString(hintstring_alliesentity);

            if (
    player.pers["team"] == "axis")
                
    player thread displayHintString(hintstring_axisentity);

            if (
    player safeUseButtonPressed())
            {
                
    entity [[function]](player);

                while (
    player safeUseButtonPressed())
                    
    wait 0.05;
            }
        }
    }

    spawnRadiusTrigger(function)
    {
        
    entity self;

        
    entity.useTrigger true;

        
    trigger spawn("trigger_radius"entity.origin05050);

        
    entity.trigger trigger// for later movement/deletion etc.

        
    while (1)
        {
            
    trigger waittill("trigger"player);

            if (
    entity.useTrigger == false)
            {
                
    wait 0.10;
                continue;
            }

            
    entity [[function]](player);
            
    wait 0.10;
        }
    }

    spawnMeleeTrigger(function, hintstring_allieshintstring_axis)
    {
        
    entity self;

        
    entity endon("endTriggerThread");

        
    entity.useTrigger true;

        
    trigger spawn("trigger_radius"entity.origin05050);

        
    entity.trigger trigger// for later movement/deletion etc.

        
    while (1)
        {
            
    trigger waittill("trigger"player);

            if (
    entity.useTrigger == false)
            {
                
    wait 0.10;
                continue;
            }

            if (
    player.pers["team"] == "allies")
                
    player thread displayHintString(hintstring_alliesentity);

            if (
    player.pers["team"] == "axis")
                
    player thread displayHintString(hintstring_axisentity);

            if (
    player safeMeleeButtonPressed())
            {
                
    entity [[function]](player);

                while (
    player safeMeleeButtonPressed())
                    
    wait 0.05;
            }
        }

    HINTSTRING.gsc

    PHP Code:
    displayHintString(hintstringentity)
    {
        
    player self;

        if ( ! 
    isDefined(player))
            return;

        if ( ! 
    isDefined(hintstring))
            return;

        if (
    isdefined(player.hintstring))
            return;

        
    player.hintstring newClientHudElem(player);
        
    player.hintstring.horzAlign "fullscreen";
        
    player.hintstring.vertAlign "fullscreen";
        
    player.hintstring.alignX "center";
        
    player.hintstring.alignY "middle";
        
    player.hintstring.320// 640
        
    player.hintstring.300// 480
        
    player.hintstring.fontScale 1.6// 1.1
        
    player.hintstring.alpha 1// zero to one
        
    player.hintstring setText(hintstring);

        
    player thread deleteHintString(entity);
    }

    deleteHintString(entity)
    {
        
    player self;

        while (
    isdefined(player) && isdefined(player.hintstring))
        {
            if (
    player isTouching(entity.trigger))
            {
                
    wait 0.10;
                continue;
            }

            
    player.hintstring destroy();
        }


    For the custom damage trigger stuff, libcod is needed: https://znation.nl/cod4script/setalive.htm
    timescale 0.01

  5. The Following User Says Thank You to kung foo man For This Useful Post:

    Whiskas (11th September 2016)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •