1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

need the code that makes a trigger respond to a event

Discussion in 'Programming' started by [L]the_Countess, Oct 21, 2001.

  1. [L]the_Countess

    [L]the_Countess Novice

    Joined:
    Apr 27, 2001
    Messages:
    886
    Likes Received:
    0
    for some reason the elevator trigger dusnt have it
    it only respond to actor proximity's

    and it need the elevator trigger to respond to a event

    i think it should be posible to add the code into the elevator script (and so make a new improved elevator trigger)
     
  2. tarquin

    tarquin design is flawed

    Joined:
    Oct 11, 2000
    Messages:
    3,945
    Likes Received:
    0
    I'd say subclass ElevatorTrigger & add a Trigger function there.

    quickest thing would be

    function Trigger( actor Other, pawn EventInstigator )
    {
    Touch( EventInstigator )
    }

    but it's a bit of a hack IMO.
    otherwise, just copy the contents of the Touch function into Trigger.


    There's probably a more elegant solution: a new calss with an extra TriggerType: TT_Remote or have two states... but it's more effort than it's worth :)
     
  3. [L]the_Countess

    [L]the_Countess Novice

    Joined:
    Apr 27, 2001
    Messages:
    886
    Likes Received:
    0
    seems a lot eazyer :)
    and i can have a built in time delay for the doors to close
     
  4. tarquin

    tarquin design is flawed

    Joined:
    Oct 11, 2000
    Messages:
    3,945
    Likes Received:
    0
    hidden area with books in?
    :eek:
    it's extremely ingeneous, I'll grant you, but it seems like bucketloads of work to me :D

    subclass the ElevatorTrigger, save in package 'MyLevel' so it's embedded in your map (like a screenshot, that way there's no mucking around with external packages), & add objects of the new class to your map.
    Factor in delays with a dispatcher.

    BTW, I did actually try this for a complex door & it worked fine, the only problem was the timings for the mover, but that was my fault not the method's :)
     
  5. Prisoner Number 9

    Prisoner Number 9 New Member

    Joined:
    Oct 9, 2001
    Messages:
    6
    Likes Received:
    0
    ingenius workarounds

    Countess, i love that descriptrion. Its the sort of thing im always doing, hidden areas with movers and spawned redeemers etc to get around the stupid logical obstacles in UT.
    Methinks its time to take up scripting and build a set of useful 'event tools'
    #9
     
  6. tarquin

    tarquin design is flawed

    Joined:
    Oct 11, 2000
    Messages:
    3,945
    Likes Received:
    0
    hmmmmmmmm....
    I wonder if it would be worthwhile to bring out a pack of useful extra classes for mappers.
    That way we wouldn't all have to keep re-creating them in our own little corners each time.
    I'll maybe go start a thread about this idea on the main coding board. Needs some life kicking into it :)
     
  7. Prisoner Number 9

    Prisoner Number 9 New Member

    Joined:
    Oct 9, 2001
    Messages:
    6
    Likes Received:
    0
    yes please

    ...er what would I have....

    a basic set of logical operators (some 'always relevant' or 'tick rate' whatever you call it..things like AND, OR, NOT, DELAY, GATE)
    for events, so we arent always messing about with elaborate ways to link things. And a comparator.

    Decent sequential logic...counters and so on.

    And (this is my own little invention:) a MoverManager.

    Movers are sort of ok in unreal, but the basic keys and interpolation sucks for most things but doors and rotators.
    What I would love to see is a kind of MoverManager that
    controls a mover on a more logical 3D level, maybe by letting the mapper put some script diectly in on a per instance basis.

    It would be great for all those jobs where a scripted pawn or wehicle code is a sledgehammer overkill, but you want a nice animation for something like a car pulling up.

    oh well , my 2p

    im gonna learn script instead of gassing about it anyway, i got into the chimeric tuts.:)
     
  8. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    I tried releasing a pack of various things a person could put in maps, but I doubt it ever got used.
     
  9. tarquin

    tarquin design is flawed

    Joined:
    Oct 11, 2000
    Messages:
    3,945
    Likes Received:
    0
    sounds good....
    is it still around?
    URL or link to a description? :)

    get it out, dust it down... relaunch it with promotion on the Ed board :D
     
  10. Prisoner Number 9

    Prisoner Number 9 New Member

    Joined:
    Oct 9, 2001
    Messages:
    6
    Likes Received:
    0
    Really, im not surprsied, you know this re-inventing the the wheel thing is a big problem in code. All the hard work you guys do gets wasted if its not catalogued, distributed/kept alive and so mappers generally dont get a hold of it:(

    Maybe do like mappers are doing now and compliling prefab collections and decoration banks...but for code nuggets...all the
    little bits, actors, objects and stuff that gets made for this or that mod or map ( and that the authors are happy to share) but never
    gets used again unless it has somewhere to live and a good reference to it.

    So many times I have been tempted tofire up the script editor, but then thought ...no there MUST be a way to do it with the normal actors...and sometimes there is, sometimes you have to be really ingenious, almost like a coder, like countess and the hidden movers. But how nice it would be to get stuck on a problem and be able to browse a library of new actors and discover....(made up example)

    event WasRecentTrigger (t1, event1, event2)

    [ event becomes true if either event1 or event2 is true within
    t1 seconds of one another]

    or something...

    practical things that solve mappers problems...:)
    Wish I knew enough script to get stuck in and heklp u but im learning ok.

    :D #9
     
  11. navboy

    navboy New Member

    Joined:
    Jan 5, 2001
    Messages:
    340
    Likes Received:
    0
    That's funny, in my current map i've got a bunch of movers that cannot be triggered from the ground area around them, you have to jump down on top of them from above for them to be triggered and move. But because of the way the mover code is written, even though there weren't bot paths running through the mover, the bots would attempt to reach the trigger by continually running into the side of it.

    So i changed the code and now they only try to trigger it if they're already standing on the mover. In the end, revisions like these don't seem significant to have as part of some collection ... on the other hand it sure would be nice if such choices were already offered in the default properties, and it always takes extra time to examine the code, find the best solution (sometimes stuff is packed away in unreachable engine functions), etc.
     
  12. [L]the_Countess

    [L]the_Countess Novice

    Joined:
    Apr 27, 2001
    Messages:
    886
    Likes Received:
    0
    didnt know this thread was still alive (only got a e-mail about it now)

    well this is what i got with my ultra n3wb13 c0d1ng sk1lls


    Code:
    //============================================================================= 
    // ElevatorTriggerPlus. 
    //============================================================================= 
    class ElevatorTriggerPlus expands Triggers; 
    
    // A special trigger devised for the ElevatorMover class, since 
    // detecting one trigger message is not enough to determine 2 or more 
    // different commands (like up/down). When an event 
    //triggers it, it sends a message to the ElevatorMover with the desired 
    // keyframe change and moving time interval. 
    
    var() int GotoKeyframe; 
    var() float MoveTime; 
    var() bool bTriggerOnceOnly; 
    
    // 
    // Called when something triggers the trigger. 
    // 
    function Trigger( actor Other, pawn EventInstigator ) 
    { 
      local ElevatorMover EM; 
      // Call the ElevatorMover's Move function 
      if( Event != '' ) 
        foreach AllActors( class 'ElevatorMover', EM, Event ) 
          EM.MoveKeyframe( GotoKeyFrame, MoveTime ); 
    
      if( bTriggerOnceOnly ) 
        // Ignore future touches. 
        SetCollision(False); 
    } 
    
    getting close to it wont set it off now
    only a event will

    to implament :
    open actor browser
    click on "triggers"
    click "class" --> "new script"
    package : MyLevel
    name : ElevatorTriggerPlus (if you change this you'll have to change all "ElevatorTriggerPlus" in the code aswell)
    put the code over the small code UT put there
    hit "tools" ---> "complile changed"
    now be sure to use the trigger in your level befor you save and exit or it wont save it (as it puts it in your level file)

    about a datebase for code stuff
    i like it :D
    maybe we can get a prefab site to host them aswell
     
    Last edited by a moderator: Oct 7, 2003

Share This Page