need the code that makes a trigger respond to a event

  • 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.
Apr 27, 2001
886
0
0
42
Visit site
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)
 

tarquin

design is flawed
Oct 11, 2000
3,945
0
36
UK
www.planetunreal.com
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 :)
 
Apr 27, 2001
886
0
0
42
Visit site
Originally posted by Techno JF
I've had this problem myself. This is a flaw with ElevatorMovers that I really hate. Technically, there is no way to do it without scripting, but there is an actor construction that causes the same effect. Be warned; this construction is a little complex.

First, if you don't have one already, you need to make a hidden area that the player will never see. It should have a sufficient amount of space for things to move around in. After you've made it, put your ElevatorTrigger somewhere in that area, and change it's TriggerType value to TT_AnyProximity.

Make an AttachMover (something small) in that same area. Give it a very small StayOpenTime and a MoveTime of zero. Put a book (a good small item) near it and attach the book to the mover. Keyframe 1 of that AttachMover should move the book into the ElevatorTrigger's radius, thus causing it to be triggered.

Finally, go back to where you originally had the ElevatorTrigger. When you need the event to be called, make it trigger the AttachMover rather than the ElevatorTrigger.

Here's the full result of this construction. When you set off the event, the AttachMover will flash to it's other keyframe and then back. It will take the attached book with it. The book will touch the ElevatorTrigger and cause it to be triggered. The ElevatorTrigger will then make the ElevatorMover move appropriately.

You can use this area for multiple constructions like this, provided you're careful about where your books move with respect to your triggers. However, the reason for the book is that the mover touching the trigger won't cause anything to happen for some reason. I went through a lot of UnrealEd time trying to figure this idea out for my own reasons. I hope it helps.

seems a lot eazyer :)
and i can have a built in time delay for the doors to close
 

tarquin

design is flawed
Oct 11, 2000
3,945
0
36
UK
www.planetunreal.com
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 :)
 

Prisoner Number 9

New Member
Oct 9, 2001
6
0
0
The Island
Visit site
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
 

tarquin

design is flawed
Oct 11, 2000
3,945
0
36
UK
www.planetunreal.com
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 :)
 

Prisoner Number 9

New Member
Oct 9, 2001
6
0
0
The Island
Visit site
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.:)
 

Prisoner Number 9

New Member
Oct 9, 2001
6
0
0
The Island
Visit site
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
 
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.
 
Apr 27, 2001
886
0
0
42
Visit site
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: