Scripts / Reference to other entity

Author
Message
Juande
13
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 11th Jul 2015 17:29
Hi,

I am trying Lua and I have a question about Lua.

I know that 'e' is to make reference to the involved entity. But, I want to make reference to other entity. I mean, how can i say the next condition:

"if the current entity is in a specific zone then...."

I have a trigger zone and a box entity. I want to move the box (using bullets) to this trigger zone and at this moment say "congratulations", for example.

Thanks!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Jul 2015 19:23
This thread would be best place in Script sub-forum, maybe some mod can move it.
There you'll get more help than here.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 11th Jul 2015 22:07
Without semi-complex scripting?

Get the "e" number of the item from bottom left of the editor when you mouseover.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Juande
13
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 12th Jul 2015 07:25
Ok. Sorry for asking in the wrong subforum and thanks for moving it.

!nullptr, I have already try with that number and always, i get error.

I have written this test:



The error is: error running function scriptbank\test.lua:9: attempt to index field '?' (a nil value)

With 'e', i don't get this error and it Works.

What is wrong?

Thanks!
PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 12th Jul 2015 07:53 Edited at: 12th Jul 2015 07:56
You'd have to have more than 7000 entities to have that number.

I'd suggest you are using the obj id not the "e" - it should be first number on the left. If your map is low population, it's probably anything from 1 to 10.

It would have worked with "e" because that is the entity the script is attached to, not the one you want.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Juande
13
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 12th Jul 2015 09:46
Ok. On the left, I can see {2 [70002]...}. I thought 70002 was my object number. Now, with "[2]" Works perfectly.

Thanks a lot.
PM

Login to post a reply

Server time is: 2024-12-22 01:22:49
Your offset time is: 2024-12-22 01:22:49