Forum

> > CS2D > Scripts > How I can find the position of an entity out?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How I can find the position of an entity out?

4 replies
To the start Previous 1 Next To the start

old How I can find the position of an entity out?

Bowlinghead
User Off Offline

Quote
Hello,
Here is my Question:
I've got a crazy question!
How can I check the position from an entity (e.g.: trigger_use) and if the position is 1,1 then msg("Hello")?

Example:
1
2
3
4
5
6
7
addhook("use","wtf")
function wtf(id,event,data,x,y)
	if [entity-x]==1 and [entity-y]==1 then
		msg("Hello")
	end
end
-- [entity-x] and [entity-y] is the command what I search!

I know its work with the map-editor but I want to make it per lua!

old Re: How I can find the position of an entity out?

DarkLight66
User Off Offline

Quote
im not sure if im right but i think that the hook "use" returns the player position, and since you dont need to be in the entity position to "use" it, then i think you should use this instead:

1
2
3
4
5
6
addhook("usebutton","wtf")
function wtf(id,x,y)
	if x==1 and y==1 then
		msg("Hello")
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview