Jump to content

Welcome to Omni-bot Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Lifts

- - - - -

  • Please log in to reply
15 replies to this topic

#1
BOK Naerling

BOK Naerling

    Senior Member

  • Members
  • 221 posts
Well, I was working on Goldrush-GA, but got stuck with the lifts. I've tried looking for some examples like xfsu, over the top and special delivery, but they're all quite different and quite frankly I don't understand what the hell is happening.
The lifts should be accessible for both teams and it can be called from downstairs and upstairs. Some help please?
Uploaded the files to assembla.
Come visit the : )BOK( : Clan!
: )BOK( : #1 FUN XPSAVE IP: 85.25.141.112:27960 (maps like Oasis, Goldrush, Fueldump, Supply Depot, Venice...)
: )BOK( : #2 FUN XPSAVE IP: 85.25.141.112:27961 (also Venice, Oasis, Streets of Italy, Transmitter, Braundorf, Radar Summer...).

http://www.bok-clan.nl

#2
crapshoot

crapshoot

    Administrator

  • Administrators
  • 1,890 posts
i'll set them up later tonight. in the meantime, i commited fixes for the hitching in game related to the traceline threads.

#3
BOK Naerling

BOK Naerling

    Senior Member

  • Members
  • 221 posts
I see, thanks! :D
I didn't notice the hitches though.

Had some troubles with the doors... They only open one way so bots got crushed constantly. Luckily they stay open, that's why I had to remove the door flags (otherwise they'll close it and be crushed again next time). Moving some waypoints might fix the crushing problem though.
But just for the record: What exactly is this and how does it work? [highlight=gm]vel = ToVector(trigger.Action);

if (vel.y > 0)[/highlight]Does it check if the door moves or if it's in place?

I just noticed there's still 4 switches in the script, those are leftovers from my former attempts at making the lifts work and can be deleted.
Edit: Deleted the switches and comments, moved some waypoints.
Come visit the : )BOK( : Clan!
: )BOK( : #1 FUN XPSAVE IP: 85.25.141.112:27960 (maps like Oasis, Goldrush, Fueldump, Supply Depot, Venice...)
: )BOK( : #2 FUN XPSAVE IP: 85.25.141.112:27961 (also Venice, Oasis, Streets of Italy, Transmitter, Braundorf, Radar Summer...).

http://www.bok-clan.nl

#4
crapshoot

crapshoot

    Administrator

  • Administrators
  • 1,890 posts
if you look at debugtriggers output for a mover, sometimes the Action value is a string of 3 space seperated numbers:
[highlight=gm]<---> Trigger: TagName: ELV1DOORa_goto Action: -35.02 0.00 0.00 Entity: (770:1) Activator: (-1:0)[/highlight]

so here we have a string of -35.02 0.00 0.00 for trigger.Action assuming your trigger function is set up so the var is called trigger:
[highlight=gm]mytrigger = function(trigger) { }, [/highlight]

since we want to reference only one of the numbers in that string (the first one in this case) we convert it to a vector with:
[highlight=gm]vel = ToVector(trigger.Action);[/highlight]

if you add a print(vel); to the map script after that you will see that it was converted from the string to a vector3. Output for this one should be:
[highlight=gm]Vector3(-35.02,0.00,0.00)[/highlight]

Vector3 types are set up as Vector3(x, y, z). Meaning you can reference each of the 3 values by checking x, y, or z. In this case, you can add the following prints to see it:
[highlight=gm]print(vel.x); // result is -35.02
print(vel.y); // result is 0
print(vel.z); // result is 0[/highlight]

this is useful for mover triggers since typically the same x, y, or z value changes based on which way the mover is going. so in this example, lets say that first debugtrigger output was for a door closing. the trigger function would look like this to detect both opening and closing:
[highlight=gm]mytrigger = function(trigger)
{
vel = ToVector(trigger.Action);

if(vel.x < 0) // vel.x is -35.02
{
print("Door Closing");
}
else // vel.x is 35.02 (assumed)
{
print("Door Opening");
}
},[/highlight]

#5
VargaTom

VargaTom

    Junior Member

  • Members
  • PipPipPip
  • 84 posts
  • LocationNorth of Hungary

Hi,

But what about lifts, with 3 levels?

When lift moves from level 1 to level 2 vectors are 0.00 0.00 50.00

and moves from #2 level to #3 level vectors are 0.00 0.00 50.00

Can I use triggers like to Tank (region triggers)? If yes, which piece of lift will activate region trigger? (ORIGIN?)



#6
palota

palota

    Senior Member

  • Administrators
  • 536 posts

If lift has 3 levels, you can use function GetEntPosition to get current position of the lift.

position = GetEntPosition(trigger.Entity).z;
direction = ToVector(trigger.Action).z;

  • VargaTom and Mateos like this

#7
d00d

d00d

    Senior Member

  • Members
  • 1,413 posts
  • LocationEssen, Germany

Can I use triggers like to Tank (region triggers)?

Here is an example that uses region triggers:
global Map =
{
	// Initialize Map.ElevatorPosition with 0
	ElevatorPosition = 0,

	Movers =
	{
		// keep the elevator
		"MOVER_elevator",
	},

	// Trigger tables for the elevator.
	// These keep track of the elevator's position.
	ElevatorLevel1 =
	{
		Name = "ElevatorLevel1",
		TriggerOnEntity = GetGoal("MOVER_elevator").GetEntity(),
		OnEnter = function( ent )
		{
			if ( Map.ElevatorPosition != 1 )
			{
				Map.ElevatorPosition = 1;
				Util.MapDebugPrint( "Elevator at level " + Map.ElevatorPosition );
			};
		},
		OnExit = function( ent )
		{
			Map.ElevatorPosition = 0; //moving/unknown
		},

	},

	ElevatorLevel2 =
	{
		Name = "ElevatorLevel2",
		TriggerOnEntity = GetGoal("MOVER_elevator").GetEntity(),
		OnEnter = function( ent )
		{
			if ( Map.ElevatorPosition != 2 )
			{
				Map.ElevatorPosition = 2;
				Util.MapDebugPrint( "Elevator at level " + Map.ElevatorPosition );
			};
		},
		OnExit = function( ent )
		{
			Map.ElevatorPosition = 0; //moving/unknown
		},
	},

	ElevatorLevel3 =
	{
		Name = "ElevatorLevel3",
		TriggerOnEntity = GetGoal("MOVER_elevator").GetEntity(),
		OnEnter = function( ent )
		{
			if ( Map.ElevatorPosition != 3 )
			{
				Map.ElevatorPosition = 3;
				Util.MapDebugPrint( "Elevator at level " + Map.ElevatorPosition );
			};
		},
		OnExit = function( ent )
		{
			Map.ElevatorPosition = 0; //moving/unknown
		},
	},

};

global OnMapLoad = function()
{

	// Trigger regions for the elevator
	l_1 = OnTriggerRegion( Vec3(-5870,-2325,-220), 20, Map.ElevatorLevel1 );
	l_2 = OnTriggerRegion( Vec3(-5870,-2325,180), 20, Map.ElevatorLevel2 );
	l_3 = OnTriggerRegion( Vec3(-5870,-2325,590), 20, Map.ElevatorLevel3 );

};

If yes, which piece of lift will activate region trigger? (ORIGIN?)

I don't know. I usually experiment with the values until I get the result I want.
  • VargaTom and Mateos like this

#8
palota

palota

    Senior Member

  • Administrators
  • 536 posts

Sphere region triggers are activated when center point is inside the sphere. The center point is usually not same as origin !

AABB region triggers are activated when bounding box intersects the region. The bounding box can be much bigger than entity and then the trigger is activated too soon.

All region triggers (OnTriggerRegion) must compare coordinates every frame. That's why it's better to use goto triggers (OnTrigger) which don't need any CPU usage.


  • d00d, VargaTom and Mateos like this

#9
VargaTom

VargaTom

    Junior Member

  • Members
  • PipPipPip
  • 84 posts
  • LocationNorth of Hungary

Hi,

somebody can help me how to trigger some event in Omni-Bot ( for example when bot push a button and activate some trigger (call elevator) in original gamescript )?



#10
MickyP[MW]

MickyP[MW]

    Senior Member

  • Members
  • 526 posts

This normally works to show hidden triggers

/bot debugtriggers

See the wiki page here for further details

 

http://omni-bot.invi...?title=Triggers


  • d00d and VargaTom like this
Posted Image

#11
d00d

d00d

    Senior Member

  • Members
  • 1,413 posts
  • LocationEssen, Germany

When you press the button in game while debugtriggers is on, you'll (usually) see something like this:

<---> Trigger: TagName: ele1_button_press Action: pushed Entity: (698:1) Activator: (-1:0)

Copy the 'ele1_button_press' part and register a callback function for the button in OnMapLoad:

OnTrigger( "ele1_button_press", Map.ElevatorButtonPressed );

Then add the necessary code to the ElevatorButtonPressed function in the Map table.

 

Here is a simplified example script:

global Map =
{
	Debug = 1, // set to 1 so printing debug messages to the screen is enabled

	ElevatorButtonPressed = function( trigger )
	{
		// add some useful code here

		Util.MapDebugPrint( "Debug info: The elevator button was pressed." );
	},
};

global OnMapLoad = function()
{
	// The text inside the quotes should be what you see
	// when you press the button while debugtriggers is on.
	OnTrigger( "ele1_button_press", Map.ElevatorButtonPressed );
};

global OnBotJoin = function( bot )
{
};


  • VargaTom and MickyP[MW] like this

#12
VargaTom

VargaTom

    Junior Member

  • Members
  • PipPipPip
  • 84 posts
  • LocationNorth of Hungary

Thanks for response!


Edited by VargaTom, 10 July 2015 - 10:26 PM.

  • d00d likes this

#13
VargaTom

VargaTom

    Junior Member

  • Members
  • PipPipPip
  • 84 posts
  • LocationNorth of Hungary

hi,

on this site:

http://omni-bot.invi...rough_UseSwitch

what is different between Timeout = 2000, and sleep(1.5); times?



#14
palota

palota

    Senior Member

  • Administrators
  • 536 posts

Timeout value is used only if bot fails to press switch. It can happen if bot is pushed by another player or if switch does not have the AimPosition property defined. Timeout prevents bot to stuck and press switch indefinitely.

Wait function is called after bot successfully pressed the switch. Bot waits until the Wait function returns true. The sleep function is useful for doors or gates if you exactly know how long bot must wait.


  • d00d and VargaTom like this

#15
VargaTom

VargaTom

    Junior Member

  • Members
  • PipPipPip
  • 84 posts
  • LocationNorth of Hungary

Hi,

first thanks again for d00d (on june 10 2015) very nice post!

And now:

In some cases, BOTs want to go through the locked door of the lift. This is a normal thing?

When a BOT starts  at a spawnpoint and he want to go through an open lift door but when he arrival to liftdoors well the doors were  closed during this time (because another BOT called for elevator, by he pressed an other button) The BOT, which started at spawnpoint will receive this new information (doors are closed) or they therefore want to go through the locked door?


#16
d00d

d00d

    Senior Member

  • Members
  • 1,413 posts
  • LocationEssen, Germany

I'm not perfectly sure I understand you, but as a general rule, bots only have the information about their environment that the waypointer/scripter gives them. Is there a waypoint inside the lift? If yes, does it have the blockwall flag?

It is really difficult to discuss all this without seeing the map. Could you attach your waypoints/script here and post a link to the map?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users