No announcement yet.

listening for multiple events?

  • Filter
  • Time
  • Show
Clear All
new posts

    listening for multiple events?


    I read somewhere on unrealwiki that it is possible to make an object listen for multiple events, it doesn't say how this is done though. Can somebody help me with this?

    What I want to do is create an object that listenes for more than one event (in effect I want to add a couple of "tags" to my object).


    What events are you listening for?

    Unreal events usually call a pawn's event function like: Bump, HitWall, etc

    Or the pawn's controller like: SeePlayer, HearNoise, KilledBy, NotifyBump, HitWall, NotifyPhysicsVolumeChange, NotifyHeadVolumeChange, Falling, TakeDamage, ReceiveWarning


      Any event really, I've got a number of objects in my level that will broadcast an event when something happens. For example there are 2 radar towers (tower A and tower B): when tower A is destroyed then it broadcasts the event "towerAdestroyed', for tower B this is "towerBdestroyed".

      Now I want to create an object (a "guard" object) that will listen for both the "towerAdestroyed" and the "towerBdestroyed" event. When both events have been registered by this object then I'll do something like end the mission or initiate a new mission or event or whatever.

      How is an event fuction of an object linked to a certain event broadcast? The event to listen for in the "tag" of an object fires off the "event trigger()" function, can this be done for other functions as well in unrealscript or is this native code or what's going on here?


        You could just maintain state in some variables

        like btowerAdestroyed and btowerBdestroyed and every tick check whether or not they are both true and if so - cause whatever action you were after.

        Cause your code to set the variables to true when they're destroyed


          yeah I thought about that but I really don't want to check all those flags every single tick! But I do want it to be "precise" (in time)...
          That's why I figure I should simply have an object that can receive several different events (it has more than one "tag") and then do stuff when an event comes in.

          Right now I'm thinking about writing my own message/event system


            how about putting a layer in between?
            i mean 2 extra functions/objects that listen for A and B events respectively, and then call a function in the real object.

            first time it's called, it sets a variable, second time it knows both are destroyed...