Home   Help Search Login Register  

Author Topic: fire trigger when on second floor  (Read 1280 times)

0 Members and 2 Guests are viewing this topic.

Offline mcnorth

  • Members
  • *
fire trigger when on second floor
« on: 16 Apr 2007, 09:24:26 »
I'm trying to get a trigger to fire when the player locates friendly troops on the second floor of a bombed out building. To do this I've placed an ammo crate on the second floor and am comparing the crates z co-ordinate to the player's z co-ordinate.
Code: [Select]
(GetPos aP) select 2 >= (GetPos crate) select 2The problem is that the player's z co-ordinate remains the same whether he's on the ground or on the second floor. Stranger yet, even though I put the ammo crate on the second floor with;
Code: [Select]
this setPos [getPos this select 0, getPos this select 1, (getPos this select 2)+ 5]the crate's z co-ordinate is a miniscule negative number.

Attached is a mini mission where radio alpha displays the player's z co-ordinate and radio bravo displays the crate's. Apparently I'm barking up an empty tree and would really appreciate someone pointing me the right direction.

Thanks guys.

Offline Cheetah

  • Former Staff
  • ****
Re: fire trigger when on second floor
« Reply #1 on: 16 Apr 2007, 16:54:03 »
You might have to use modelToWorld in order to get the right coordinates.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline mcnorth

  • Members
  • *
Re: fire trigger when on second floor
« Reply #2 on: 16 Apr 2007, 20:47:28 »
Cheetah, You are a GOD and undoubtedly saved me boatloads of headache. I'd have never found that.

Thanks

problem solved

here's the code if anyone else is interested.
Code: [Select]
(aP modelToWorld (GetPos aP)) select 2 >= (crate modelToWorld (GetPos crate)) select 2(where the crate sits on the second floor for a reference point.)