like when you press the use button the menu comes out.
Forum
Scripts
Trigger function examplee
Trigger function examplee
5 replies
1

like when you press the use button the menu comes out.
Then easily place a trigger_use somewhere, notice its x- and y-coords. Then check the use() hook if you're standing on it's tile.
Done. If you still need an example then you should try things yourself.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("use","onUse")
function onUse(id,event,x,y)
	local x = x or player(id,"tilex")
	local y = y or player(id,"tiley")
	-- Events are 5
	if event == 1 then
		-- Hostage follow
	elseif event == 2 then
		-- Hostage stop
	elseif event == 3 then
		-- Defuse Bomb
	elseif event == 100 then
		-- Trigger Use
	elseif event == 150 then
		-- Dynamic Object
	else
		-- Press "E" without any wanted point
	end
end
In the case of "else", it's called when you didn't want to do anything, just it's called because the player pressed the "E"
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("use","onUse")
function onUse(id,event,x,y)
	local x = x or player(id,"tilex")
	local y = y or player(id,"tiley")
	if x == tile X and y == tile Y then
		-- Do your action
	end
end
Quote
like when you press the use button the menu comes out.
So he needs a trigger_use entity. Sorry bro.
1

Offline
