logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Unreal Ed Coop Map Dilemma (Read 1961 times)
XtCPhoenix
New Member
*
Offline


Oldunreal member

Posts: 8
Location: USA
Joined: Apr 14th, 2013
Gender: Male
Unreal Ed Coop Map Dilemma
Apr 21st, 2015 at 7:41pm
Print Post  
For a Coop map I am working on, I have 4 objectives (which I want to be able to be triggered in any order).  Once all 4 objectives have been completed, an exit door is triggered to open…

My goal: After the (whichever) 1st objective is completed, I am looking to have 1 skaarj enemy spawn near each of the 3 remaining objectives (3 skaarj total).  Once the 2nd objective is triggered, to have 1 skaarj spawn near each of the 2 remaining objectives (2 skaarj total).  And finally, once the 3rd objective is triggered, have 1 skaarj spawn near the single remaining objective.  In other words, there should always be 1 skaarj guarding the 2nd objective the player approaches, 2 skaarj guarding the 3rd, and 3 skaarj guarding the 4th.

It is straightforward to do this if the players MUST complete the objectives in a designated order, but I can’t seem to wrap my head around how to do this when the players may complete the objectives in ANY order.

Failure 1 (may confuse you): I experimented having 3 triggers on top of one another AT each objective (main triggers) that activate their own trigger near that room’s exit (perimeter triggers), which would in turn be linked to their own thingfactory/spawnpoints near the other 3 objectives.  These 3 main triggers would also need to deactivate each main trigger at the other 3 objectives that corresponds to the objective you are currently at.  A circular reference persisted, however, and this didn't work.

Failure 2: I also experimented using counters, with each objective having the same event name and linked to 4 counters.  When the ‘1’ counter is triggered (any 1 of the objectives is complete), 1 skaarj spawns near the other 3 objectives, etc.  However, a spawn point for this factory would obviously need to be placed at ALL 4 objectives, and I was not aware of a way to deactivate a spawnpoint and assure the 3 skaarj only spawn at the 3 spawnpoints near the remaining 3 objectives.

Any help would be greatly appreciated!  Thanks!
  
Back to top
 
IP Logged
 
Lurker
New Member
*
Offline


UnrealEd Modder, Mapper
& Coder since 1998

Posts: 38
Location: Germany
Joined: Mar 3rd, 2015
Gender: Male
Re: Unreal Ed Coop Map Dilemma
Reply #1 - Apr 22nd, 2015 at 12:59pm
Print Post  
Hello XtCPhoenix.

First off, let me throw in the reason for this dilemma in just one sentence from a coder's perspective:

Triggers in UnrealEngines have common single-bool states (True/False) and not multi-bool states (Flags) to begin with!

Now this may sound confusing too. Let me explain what this sentence means, so you and others will easily understand the nature of the problem and be able to wrap your head around it...

For a simpler illustration let's say the goal is to enter 4 rooms and press a single switch in each room in a special pre-defined order to activate a teleporter in a 5th room and exit the level. The goal is divided into 4 objectives:

Objective 1 is to press Switch 1 in Room 1 first.
Objective 2 is to press Switch 2 in Room 2 second.
Objective 3 is to press Switch 3 in Room 3 third.
Objective 4 is to press Switch 4 in Room 4 at last.
After Objective 4 is completed then exit teleporter is activated.

Such complex processes can be achieved by using normal Triggers and Dispatchers in UnrealEd and setting them up in a "Domino Effect" type of way. This means first all triggers and dispatchers are deactivated by setting the bInitiallyActive bool state of each trigger and dispatcher to FALSE! Except the first ones in Room 1 since this is the beginning of the ordered sequence anyway.

1. When Switch 1 is pressed then it activates Switch 2 in Room 2.
2. When Switch 2 is pressed then it activates Switch 3 in Room 3.
3. When Switch 3 is pressed then it activates Switch 4 in Room 4.
4. When Switch 4 is pressed then it activates exit teleporter in Room 5.

However, as you have already explained and found out yourself, there is a major failure in all this!

Because Triggers have single-bool states and not multi-bool states, thus they have only one state (either activated or deactivated), don't know the state of the previous trigger (which activated the current trigger), thus the pre-defined order is useless and won't work when a player activates the Switches in a different order. In fact, a player can completely screw up and cheat the whole ordered sequence by walking in Room 3 and pressing Switch 3 first to activate Switch 4 in Room 4 and then pressing Switch 4 to activate the exit teleporter in Room 5, totally ignoring the other Rooms 1-2 and Switches 1-2.

So what can you do about this problem? This is your actual question now easily illustrated.

The answer is: Unfortunately there is no work-around in UnrealEd with the standard Trigger and Dispatcher classes, neither with the Counter class. You have to code your own core Trigger type class from scratch to accomplish this effect!

I call it a MultiStateTrigger which is chained to other MultiStateTriggers in order to force complex ordered Event dispatches. No Unreal modder has ever coded anything like this, so you can be the first one, or I could do it in my spare time...  Wink

Here's a code example (no actual working code, just for illustration purpose):

Code
Select All
class MultiStateTrigger extends Triggers
	native;

// For triggers that are activated/deactivated by other triggers. (Multi-States 1..4)
var(MST) bool bInitiallyActive1;
var(MST) bool bInitiallyActive2;
var(MST) bool bInitiallyActive3;
var(MST) bool bInitiallyActive4;
var(MST) byte RequiredActiveStates;
var(MST) string RequiredBoolFlag; // 4 flag bits (0 = False, 1 = True)
...

defaultproperties
{
     bInitiallyActive1=False
     bInitiallyActive2=False
     bInitiallyActive3=False
     bInitiallyActive4=False
     RequiredActiveStates=4
     RequiredBoolFlag="1111"
} 



A MultiStateTrigger would dispatch its Event Tag only when 2 (minimum) to 4 (maximum) of the Trigger bool states are set to TRUE/Active/ON. (or when number of RequiredActiveStates is reached and RequiredBoolFlag is matched)

From an internal code execution perspective this will work as following:

1. Each 4 bool states of all MultiStateTriggers 1 to 4 are initially set to FALSE (bInitiallyActiveX=False, X = 1..4).
2. When MultiStateTrigger 1 is touched/activated then MultiStateTrigger 1 (bInitiallyActive1=True) sets the states of MultiStateTrigger 2 (bInitiallyActive1..2=True).
3. When MultiStateTrigger 2 is touched/activated then it self-checks whether its own bInitiallyActive1..2 are set to TRUE and only then sets the states of next MultiStateTrigger 3 (bInitiallyActive1..3=True).
4. When MultiStateTrigger 3 is touched/activated then it self-checks whether its own bInitiallyActive1..3 are set to TRUE and only then sets the states of next MultiStateTrigger 4 (bInitiallyActive1..4=True).
5. When MultiStateTrigger 4 is touched/activated then it self-checks whether its own bInitiallyActive1..4 are all set to TRUE and only then activates exit teleporter.

As you can read, from a programming perspective it is not so simple and requires complex re-coding of the core Trigger class in UnrealEngine1. Complex Functions such as "self-check of InitiallyActiveStates" and "setting or toggling of 1 to 4 InitiallyActiveStates of other MultiStateTriggers" (Chain Effect) have to be implemented to make it work.

As I already said, nobody has coded such a complex Trigger type yet. In my opinion it is very hard to do, because you also have to code a function which always knows the InitiallyActiveStates 1..4 of all the other MultiStateTriggers which it is chained to and knows what to do next, based on this information. Most likely this can be achieved by giving all 4 InitiallyActiveStates in each MultiStateTrigger its own Tag to be verified individually.

I hope this helps to better understand your dilemma and how it can be solved with advanced coding skills.
« Last Edit: Apr 22nd, 2015 at 2:29pm by Lurker »  
Back to top
WWW  
IP Logged
 
Lurker
New Member
*
Offline


UnrealEd Modder, Mapper
& Coder since 1998

Posts: 38
Location: Germany
Joined: Mar 3rd, 2015
Gender: Male
Re: Unreal Ed Coop Map Dilemma
Reply #2 - Apr 22nd, 2015 at 1:35pm
Print Post  
Quote:
For a Coop map I am working on, I have 4 objectives (which I want to be able to be triggered in any order).


Hmm.. I have read through your initial post again and noticed that you said "to be triggered in any order".
Before I make your problem more complex than it is, I ask you to be more specific about your problem...

Do you mean the objectives can be completed in any order or do you want them to be completed in a special order?

Because if you want them to be completed in any order then you can accomplish this with the normal Trigger and Dispatcher classes in UnrealEd, using single bInitiallyActive state in each trigger, and ignore everything which I just wrote in my previous reply posting.

So or so, the dilemma is simple to understand but not so simple to solve.
  
Back to top
WWW  
IP Logged
 
XtCPhoenix
New Member
*
Offline


Oldunreal member

Posts: 8
Location: USA
Joined: Apr 14th, 2013
Gender: Male
Re: Unreal Ed Coop Map Dilemma
Reply #3 - Apr 22nd, 2015 at 1:56pm
Print Post  
Thanks for the reply, Lurker.

To clarify, I would like the objectives to be able to be completed in ANY order (3, 2, 4, 1 or 1, 2, 3, 4 or 4, 2, 1, 3...etc)

A Failure #3 I had (which I did not type out in my original post, as was similar to failure #1) did involve dispatchers, but I may have linked the dispatchers to the main/perimeter triggers incorrectly.

I'm thinking through how this would work...
  
Back to top
 
IP Logged
 
Lurker
New Member
*
Offline


UnrealEd Modder, Mapper
& Coder since 1998

Posts: 38
Location: Germany
Joined: Mar 3rd, 2015
Gender: Male
Re: Unreal Ed Coop Map Dilemma
Reply #4 - Apr 22nd, 2015 at 2:21pm
Print Post  
Right. The so-called base capabilites of UnrealEngine do not feature Trigger states to be verified in a specific order, only to activate Triggers and Events in a pre-defined order using Dispatcher, RoundRobin and basic Unreal Trigger types.

You have to code your own Trigger class to accomplish your goal and force strict execution order (see MultiStateTrigger example in my initial reply). Or you may look for a hidden work-around which nobody has discovered yet, although I doubt that such work-around exists with the base Unreal classes.

If you intend your trigger sequence to be activateable (is that a proper word?) in ANY order then you can accomplish this with the base Unreal Triggers, Dispatchers and/or Counters, as previously said.
  
Back to top
WWW  
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Unreal Ed Coop Map Dilemma
Reply #5 - Apr 24th, 2015 at 1:47am
Print Post  
3 triggers at each objectives (+ the main one)

Each trigger goes to a dispatcher that spawns stuff for each other objectives.

When an objective is completed, you also need to shut off the relevant triggers so that they don't spawn monsters where you don't want to. Thats why there are 3 triggers at each objectives instead of just 1.

Handle every spawning with an independant CreatureFactory-SpawnPoints, all of which are hidden and activated by triggers/dispatchers as necessary.

With this setup, once you completed 3 objectives, the 4th would have had monsters spawned 3 times, so there would be 3 skaarj by the time you get to it.

I do not understand where the problem lies? I know this stuff can be confusing to use, but it all sounds very possible without any custom classes.


You can even go more complex and use counters with trigger and activatable triggers to completely customize how things spawns depending on the order, but I do not believe that you asked for something that complex.

Again, none of this should require custom classes.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo