OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: R.I.P-omega- on 17 Sep 2005, 15:34:05

Title: How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 17 Sep 2005, 15:34:05
Hi im makeing a mission and there is a point in the mission where the player needs to get on a scaffold and shoot from there, is there a way to make a trigger wrok from a certen hight?

for a instance if ill be under the trriger nothing will happen or if ill be on top of a triiger nothing will happen ethir only if im at the same hight of the trriger....

PS- mind my english  :)

Title: Re:How to make a trigger work at a certen hight?
Post by: Planck on 17 Sep 2005, 15:53:48
AFAIK triggers are not height specific, in other words they work whatever your height, as long as the subject enters the area covered by the trigger.

Edit:  Ummmmm......think I might have misunderstood the question..........never mind  ;D


Planck
Title: Re:How to make a trigger work at a certen hight?
Post by: bored_onion on 17 Sep 2005, 16:14:08
if its only for the player then put this in the condition field of the trigger (which is activated by player present):

Code: [Select]
this AND (getpos player select 2)==8
this should do it. it assumes that the player is called "player" and that the height you are after is about 8 (you can change this with testing). syntax not guaranteed.
Title: Re:How to make a trigger work at a certen hight?
Post by: macguba on 17 Sep 2005, 16:30:29
Don't use ==.     Use <= or >=, possibly in combination depending on exactly what you want.
Title: Re:How to make a trigger work at a certen hight?
Post by: bored_onion on 17 Sep 2005, 17:01:54
good point. otherwise you have to be at exactly 8. make it variable between 7 and 9 rather than a flat 8.

so:

Code: [Select]
this AND (getpos player select 2)<= 9 AND (getpos player select 2)>= 7
i think
Title: Re:How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 17 Sep 2005, 20:02:46
WoW guys you dont know how much you have helped me :D

BIIIIIG THX!
Title: How to make a trigger work at a certain height (2)
Post by: THobson on 17 Sep 2005, 21:27:40
Addendum to:
http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=25605

Take care with select 2 if the unit is in or over a building.  The distance then is measured from the unit down to the nearest usable floor.  So for example a unit on the top floor of a three floor building will have a getPos select 2 value of close to zero, just as it would if it was on the middle floor or the ground floor.

I will leave this open a little while before solving it in case there other comments.
Title: Re:How to make a trigger work at a certain height (2)
Post by: Kyle Sarnik on 18 Sep 2005, 02:25:42
Yea I was gonna suggest this but he hit the solve button before he actualy solved it... If a unit is on a building or scaffold, the z pos (getpos unit select 2) will register as 0, so you need to use a different method such as distance.
Title: Re:How to make a trigger work at a certain height (2)
Post by: R.I.P-omega- on 18 Sep 2005, 22:51:38
yea sorry for tha misstake i did :P i tryed it out and the trriger dosent work while im on the scaffold.

PS- shold i unsolve the topic or contunue posting on this one?


I merged this topic with the original topic and unsolved the original.......Planck
Title: Re:How to make a trigger work at a certen hight?
Post by: THobson on 18 Sep 2005, 23:12:05
To do this I placed a game logic high over the building (1000 m) and had a trigger covering the building.  I grouped the trigger with the player and had inthe condition field:

this and (player distance gameLogicName < 999.9)

Play with the last number to get it to fire on the correct floor.
Title: Re:How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 21 Sep 2005, 19:20:55
Quote
I grouped the trigger with the player


how do i do that?
Title: Re:How to make a trigger work at a certen hight?
Post by: macguba on 21 Sep 2005, 23:16:53
Click on Groups F2 at the top of hte Mission Editor Screen.   Click and hold on the trigger, then drag and drop a thin light blue line on to the group leader.
Title: Re:How to make a trigger work at a certen hight?
Post by: Triggerhappy on 22 Sep 2005, 03:45:15
be sure to check the activation conditions afterwards (the east/west present stuff) as they will change when grouped
Title: Re:How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 23 Sep 2005, 15:44:48
Quote
To do this I placed a game logic high over the building (1000 m) and had a trigger covering the building.  I grouped the trigger with the player and had inthe condition field:

this and (player distance gameLogicName < 999.9)

Play with the last number to get it to fire on the correct floor.

didnt work..... i did exactly what you said and still it didnt work :(
Title: Re:How to make a trigger work at a certen hight?
Post by: Pilot on 23 Sep 2005, 16:12:04
Did you set the height of the GameLogic?  To to this you will need to put the following code in the init field of the GameLogic:
this setpos [(getpos this select 0), (getpos this select 1), 1000]

-Student Pilot
Title: Re:How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 24 Sep 2005, 13:28:28
Quote
Did you set the height of the GameLogic?  To to this you will need to put the following code in the init field of the GameLogic:
this setpos [(getpos this select 0), (getpos this select 1), 1000]

-Student Pilot

yes i did still dosent work....
Title: Re:How to make a trigger work at a certen hight?
Post by: THobson on 24 Sep 2005, 14:12:46
I suggest you tell us exactly what you did.  Copy and paste the various fields of the trigger and the init field of the GL and describe the trigger fields that you can't copy.
Title: Re:How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 24 Sep 2005, 15:26:59
it works(my misstake i forgot to name the game logic...) BUT i need it to work on the TOP of the scaffold becuse it dose work BUT it all so works when im at the buttom of the scffolld...
Title: Re:How to make a trigger work at a certen hight?
Post by: Triggerhappy on 24 Sep 2005, 16:01:10
make the distance smaller until it works at the height you want
Title: Re:How to make a trigger work at a certen hight?
Post by: R.I.P-omega- on 24 Sep 2005, 21:13:10
well it works thx to you all you have helped me alot! :D