Forum

> > CS2D > Scripts > Changing the menu commands, models ..
Forums overviewCS2D overview Scripts overviewLog in to reply

English Changing the menu commands, models ..

11 replies
To the start Previous 1 Next To the start

moved Changing the menu commands, models ..

Nikew
User Off Offline

Quote
Here I want to do that would be coming on my server, people chose rase (Example: orc, elf, humans, undead). And each in his team. The model will be let alone. Help plizzz
.

old Re: Changing the menu commands, models ..

Infinite Rain
Reviewer Off Offline

Quote
Okay i can help you!
Use that 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--First we need initArray function
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i] = 0
	end
return array
end

orc=initArray(32)
elf=initArray(32)
human=initArray(32)
undead=initArray(32)

--Make some menu when spawning
Addhook("spawn","chooserace")
function chooserace(id)
	menu("Choose race,Orc,Elf,Human,Undead")
end

--What happens when you choose race
addhook("menu","racecheck")
function racecheck(id,menu2,sel)
	if menu2=="Choose race" then
		if sel==1 then
			orc[id]=1
		end
		if sel==2 then
			elf[id]=1
		end
		if sel==3 then
			human[id]=1
		end
		if sel==4 then
			undead[id]=1
		end
	end
end

--That do players cant choose 5 classes in one time
addhook("ms100","unglitch")
function unglitch()
	for id=1,32 do
		if orc[id]==1 then
			human[id]=0
			elf[id]=0
			undead[id]=0
		end
		if elf[id]==1 then
			orc[id]=0
			undead[id]=0
			human[id]=0
		end
		if human[id]==1 then
			orc[id]=0
			elf[id]=0
			undead[id]=0
		end
		if undead[id]==1 then
			human[id]=0
			orc[id]=0
			elf[id]=0
		end
	end
end

--Now we need edit skills
addhook("spawn","skills")
function skills(id)
	if orc[id]==1 then
		parse("setmaxhealth "..id.." 150")
		parse("speedmod "..id,," -5")
	end
	if elf[id]==1 then
		parse("setmaxhealth "..id.." 50")
		parse("speedmod "..id.." +15")
	end
	if human[id]==1 then
		parse("setmaxhealth "..id.." 100")
		parse("speedmod "..id,," "0")
	end
	if undead[id]==1 then
		parse("setmaxhealth "..id.." 250")
		parse("speedmod "..id,," "-25")
	end
end
And THATS ALL!

Ps: Pm me if have a questions

old Re: Changing the menu commands, models ..

TimeQuesT
User Off Offline

Quote
-->Addhook("spawn","chooserace")
function chooserace(id)
menu("Choose race,Orc,Elf,Human,Undead")
end


-->

Addhook("spawn","chooserace")
function chooserace(id)
menu(id-->nil ?,"Choose race,Orc,Elf,Human,Undead") --i think you forgott to put there something O.o
end

old Re: Changing the menu commands, models ..

Infinite Rain
Reviewer Off Offline

Quote
Oops thanks...

that is right 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--First we need initArray function
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i] = 0
     end
return array
end

orc=initArray(32)
elf=initArray(32)
human=initArray(32)
undead=initArray(32)

--Make some menu when spawning
Addhook("spawn","chooserace")
function chooserace(id)
     menu(id,"Choose race,Orc,Elf,Human,Undead")
end

--What happens when you choose race
addhook("menu","racecheck")
function racecheck(id,menu2,sel)
     if menu2=="Choose race" then
          if sel==1 then
               orc[id]=1
          end
          if sel==2 then
               elf[id]=1
          end
          if sel==3 then
               human[id]=1
          end
          if sel==4 then
               undead[id]=1
          end
     end
end

--That do players cant choose 5 classes in one time
addhook("ms100","unglitch")
function unglitch()
     for id=1,32 do
          if orc[id]==1 then
               human[id]=0
               elf[id]=0
               undead[id]=0
          end
          if elf[id]==1 then
               orc[id]=0
               undead[id]=0
               human[id]=0
          end
          if human[id]==1 then
               orc[id]=0
               elf[id]=0
               undead[id]=0
          end
          if undead[id]==1 then
               human[id]=0
               orc[id]=0
               elf[id]=0
          end
     end
end

--Now we need edit skills
addhook("spawn","skills")
function skills(id)
     if orc[id]==1 then
          parse("setmaxhealth "..id.." 150")
          parse("speedmod "..id,," -5")
     end
     if elf[id]==1 then
          parse("setmaxhealth "..id.." 50")
          parse("speedmod "..id.." +15")
     end
     if human[id]==1 then
          parse("setmaxhealth "..id.." 100")
          parse("speedmod "..id,," "0")
     end
     if undead[id]==1 then
          parse("setmaxhealth "..id.." 250")
          parse("speedmod "..id,," "-25")
     end
end

old Re: Changing the menu commands, models ..

Nikew
User Off Offline

Quote
Does not work. Or I do not understand? I inserted the code in Lua from СS2D tibia. So so very good "soil" for the construction of the map. Inserted in the beginning and end. Tell me where.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview