Forum

> > CS2D > Scripts > Trigger menu.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Trigger menu.

12 replies
To the start Previous 1 Next To the start

old Trigger menu.

Glix
User Off Offline

Quote
It's possible to make with lua like when you press trigger in map then it activates menu. then you can add into menu different button what activates different triggers,dynwalls etc?

old Re: Trigger menu.

Glix
User Off Offline

Quote
user Jynxxx has written
Yes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==115 and y==133 then
          menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
     end
end

addhook("menu","_menu")
function _menu(id,menu,button)
if menu =="Trigger" then
	if button == 1 then
		parse("trigger zombies404")
		msg("©255000000Zombies!!")
	end
	elseif button == 2 then
		parse("trigger vortigaunt404")
		msg("©255000000ALiEEnS!!")
	end
	elseif button == 3 then
		parse("trigger headcrab404")
		msg("©255000000Headcrabs!")
	end
	elseif button == 4 then
		parse("trigger soldier404")
		msg("©255000000oMg?!")
	end
end

What wrong with this then?

old Re: Trigger menu.

EndDead
User Off Offline

Quote
EDIT:
oops you posted while i was posting, anyway
Whats wrong with your script is missing 2 ends (maybe)
Add 2 ends at the bottom
--------------------------------------------------------
Old Post:
Yes, heres an example:
1
2
3
4
5
6
7
8
9
addhook("use","enddead_use")
function enddead(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==47 and y==11 then -- Replace 47 by tile X and 11 by tile Y for menu 1
          menu(id,"Menu,Tigger 1,Tigger 2")
     elseif x==25 and y==41 -- Replace 25 by tile X and 41 by tile Y
          menu(id,"Menu 2,Tigger 3,Tigger 4)
     end
end
and example of how can you toggle walls or buttons:
1
2
3
4
5
6
7
8
9
10
11
addhook("menu","enddead_menu")
function enddead_menu(id,title,buton)
     if title=="Menu" then
          if buton==1 then
               parse("toggle ButtonNameOrDynWallName") -- replace ButtonNameOrDynWallName by the name of the dynwall/button entity in the map
          elseif buton==2 then
               parse("toggle ButtonNameOrDynWallName") -- same
end
end
end
end
I didn't add an example for menu 2, try it yourself!

Good luck.

old Re: Trigger menu.

ExecL
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("serveraction","A")
function A(id,action)
	if action == 1 then
		menu(id,"Menu,Dynwall")
	end
end

addhook("menu","B")
function B(id,title,button)
	if button == 1 then
		parse("trigger dynwall")
	end
end

Here this works.

old Re: Trigger menu.

Black Wolf
User Off Offline

Quote
Still don't work… plz help me out i sucks i scripting...
1
2
3
4
5
6
7
8
9
10
addhook("use","enddead_use")
function enddead_use(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==115 and y==133 then -- Replace 47 by tile X and 11 by tile Y for menu 1
          menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
     elseif x==25 and y==41 -- Replace 25 by tile X and 41 by tile Y
          menu(id,"Menu 2,Tigger 3,Tigger 4)
end
end
end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("menu","enddead_menu")
function enddead_menu(id,title,buton)
     if title=="Trigger" then
          if buton==1 then
				parse("trigger zombies404")
				msg("©255000000Zombies!!") -- replace ButtonNameOrDynWallName by the name of the dynwall/button entity in the map
			elseif buton==2 then
				parse("trigger vortigaunt404")
				msg("©255000000ALiEEnS!!")	
			elseif button == 3 then
				parse("trigger headcrab404")
				msg("©255000000Headcrabs!")	
			elseif button == 4 then
				parse("trigger soldier404")
				msg("©255000000oMg?")
end
end
end
end
end
end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("menu","enddead_menus")
function enddead_menus(id,title,buton)
     if title=="Menu 2" then
          if buton==1 then
				parse("trigger zombies404")
				msg("©255000000Zombies!!") -- replace ButtonNameOrDynWallName by the name of the dynwall/button entity in the map
			elseif buton==2 then
				parse("trigger vortigaunt404")
				msg("©255000000ALiEEnS!!")	
			elseif button == 3 then
				parse("trigger headcrab404")
				msg("©255000000Headcrabs!")	
			elseif button == 4 then
				parse("trigger soldier404")
				msg("©255000000oMg?")
end
end
end
end
end
end

old Re: Trigger menu.

ExecL
User Off Offline

Quote
user Glix has written
Still doesn't work...


Use my one

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("serveraction","A")
function A(id,x,y)
     local x,y=player(id,"tilex"),player(id,"tiley")
	if x==10 and y==10 then -- change this
          menu(id,"Menu,Dynwall")
     end
end

addhook("menu","B")
function B(id,title,button)
     if button == 1 then
          parse("trigger dynwall")
     end
end

old Re: Trigger menu.

EndDead
User Off Offline

Quote
Ok i wasted my time and tested in-game, and heres the full script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==51 and y==9 then -- Replace 51 by tile X and 9 by tile Y for menu 1
          menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
     elseif x==25 and y==41 then -- Replace 25 by tile X and 41 by tile Y
          menu(id,"Menu 2,Tigger 3,Tigger 4")
     end
end

addhook("menu","enddead_menu")
function enddead_menu(id,title,buton)
     if title=="Tigger" then
          if buton==1 then
                    parse("trigger zombies404")
                    msg("©255000000Zombies!!") -- replace ButtonNameOrDynWallName by the name of the dynwall/button entity in the map
               elseif buton==2 then
                    parse("trigger vortigaunt404")
                    msg("©255000000ALiEEnS!!")     
               elseif button == 3 then
                    parse("trigger headcrab404")
                    msg("©255000000Headcrabs!")     
               elseif button == 4 then
                    parse("trigger soldier404")
                    msg("©255000000oMg?!!")
end
end
end
edited 2×, last 26.08.12 09:27:23 am

old Re: Trigger menu.

Black Wolf
User Off Offline

Quote
user EndDead has written
Ok i wasted my time and tested in-game, and heres the full script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==51 and y==9 then -- Replace 51 by tile X and 9 by tile Y for menu 1
          menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
     elseif x==25 and y==41 then -- Replace 25 by tile X and 41 by tile Y
          menu(id,"Menu 2,Tigger 3,Tigger 4")
     end
end

addhook("menu","enddead_menu")
function enddead_menu(id,title,buton)
     if title=="Tigger" then
          if buton==1 then
                    parse("trigger zombies404")
                    msg("©255000000Zombies!!") -- replace ButtonNameOrDynWallName by the name of the dynwall/button entity in the map
               elseif buton==2 then
                    parse("trigger vortigaunt404")
                    msg("©255000000ALiEEnS!!")     
               elseif button == 3 then
                    parse("trigger headcrab404")
                    msg("©255000000Headcrabs!")     
               elseif button == 4 then
                    parse("trigger soldier404")
                    msg("©255000000oMg?!!")
end
end
end


Thank you my lord!

EDIT :
Fuck this i give up. none of these work!

old Re: Trigger menu.

ExecL
User Off Offline

Quote
user Black Wolf has written
user EndDead has written
Ok i wasted my time and tested in-game, and heres the full script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==51 and y==9 then -- Replace 51 by tile X and 9 by tile Y for menu 1
          menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
     elseif x==25 and y==41 then -- Replace 25 by tile X and 41 by tile Y
          menu(id,"Menu 2,Tigger 3,Tigger 4")
     end
end

addhook("menu","enddead_menu")
function enddead_menu(id,title,buton)
     if title=="Tigger" then
          if buton==1 then
                    parse("trigger zombies404")
                    msg("©255000000Zombies!!") -- replace ButtonNameOrDynWallName by the name of the dynwall/button entity in the map
               elseif buton==2 then
                    parse("trigger vortigaunt404")
                    msg("©255000000ALiEEnS!!")     
               elseif button == 3 then
                    parse("trigger headcrab404")
                    msg("©255000000Headcrabs!")     
               elseif button == 4 then
                    parse("trigger soldier404")
                    msg("©255000000oMg?!!")
end
end
end


Thank you my lord!

EDIT :
Fuck this i give up. none of these work!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
addhook("use","_use")
function _use(id,x,y)
     local x,y=player(id,"tilex"),player(id,"tiley")
     if x==51 and y==9 then
          menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
     elseif x==16 and y==7 then 
          menu(id,"Menu 2,Tigger 3,Tigger 4")
     end
end

addhook("menu","_menu")
function _menu(id,title,button)
     if title=="Tigger" then
          if button == 1 then
                    parse("trigger zombies404")
                    msg("©255000000Zombies!!")
               elseif button == 2 then
                    parse("trigger vortigaunt404")
                    msg("©255000000ALiEEnS!!")     
               elseif button == 3 then
                    parse("trigger headcrab404")
                    msg("©255000000Headcrabs!")     
               elseif button == 4 then
                    parse("trigger soldier404")
                    msg("©255000000oMg?!!")
				end
		end
end

Fixed.

old Re: Trigger menu.

Jynxxx
User Off Offline

Quote
Some people need to work on tabbing.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
	local x,y=player(id,"tilex"),player(id,"tiley")
	if x==115 and y==133 then
		menu(id,"Trigger,Apocalypse|Zombie's,Aliens|Vortigaunt's,Headcrabs|Headcrab's,4 Ops|Soldier's")
	end
end

addhook("menu","_menu")
function _menu(id,menu,button)
	if menu =="Trigger" then
		if button == 1 then
			parse("trigger zombies404")
			msg("©255000000Zombies!!")
		elseif button == 2 then
			parse("trigger vortigaunt404")
			msg("©255000000ALiEEnS!!")
		elseif button == 3 then
			parse("trigger headcrab404")
			msg("©255000000Headcrabs!")
		elseif button == 4 then
			parse("trigger soldier404")
			msg("©255000000oMg?!")
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview