Forum

> > CS2D > Scripts > My script can't access
Forums overviewCS2D overview Scripts overviewLog in to reply

English My script can't access

3 replies
To the start Previous 1 Next To the start

Poll Poll

What is my problem?

Only registered users are allowed to vote
Screamers.lua
0.00% (0)
Servertransfer.lua
100.00% (4)
Page.lua
0.00% (0)
4 votes cast

old Poll My script can't access

brofistmsia
User Off Offline

Quote
I use Starkkz screamers 'make your own screamers lua' to make a screamer called Jeff the Killer
But it does not succeed, i don't know why. There are three lua i made need to show all of you.
I will show you my screamers.lua, it didn't work, it doesn't come out.

screamers lua:
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
function Createjeffthekiller()
	local jk = CreateScreamer()
	jk.name = "Jeff the Killer"
      jk.imagepath = "gfx/brofistmsia/jeff the killer/jeff the killer.png"
      jk.screenpath = "gfx/brofistmsia/jeff the killer/jeff the killer.jpg"
      jk.screamsoundpath = "sfx/jeff the killer/go to sleep.ogg"
      jk.frontAppear = true
      jk.alwaysMove = false
      jk.alwaysScream = true
      
      
      jk.forceScream = true
      jk.viewDamage = {2, 5}
      jk.defaultDamage = {1, 3}
      jk.damageDistance = 380
      jk.autoDamageDist = 32

     
      jk.followDistance = 400
      jk.minFollowDistance = 64
      jk.moveDistance = 8

     
      jk.viewDistance = 300
      jk.viewAngle = 90

     -- ambient sound in map
     screamer.ambient = {path = "sfx/jeff the killer/ambient.ogg"}
     
     return screamer
end


And the pages.lua, i didn't know why it is succeed, but the pages i set was not found.

pages lua:
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
87
88
89
90
91
92
collected_objects = 0
collected_limit = 0

function CollectObject(id,x,y)
	if not ObjectCollected(x, y) then
		if not object_collected[x] then object_collected[x] = {} end
		object_collected[x][y] = true
		collected_objects = collected_objects + 1

		if server_screamer then
			server_screamer:setAppearPercent(collected_objects/collected_limit)
		end

		if ObjectImageType(x, y) then
			parse("triggerposition "..x.." "..y)
		else
			freeimage(EntityImage(x, y))
		end

		if collected_objects >= collected_limit then
			parse("sv_restart 5")
			msg("Collected all objects!")
		else
			msg("Collected "..collected_objects.."/"..collected_limit.." objects")
		end
	end
end

function ObjectCollected(x,y)
	if object_collected[x] then
		return object_collected[x][y]
	end
end

function ObjectImageType(x,y)
	return entity(x, y, "typename") == "Env_Sprite" or entity(x, y, "typename") == "Env_Image"
end

function ObjectExists(x, y)
	for _, e in pairs(object_list) do
		if e.x == x and e.y == y then return true end
	end
	return false
end

addhook("use","on_collect_object")
function on_collect_object(id)
	local x, y = player(id,"tilex"), player(id,"tiley")
	if ObjectExists(x, y) then
		CollectObject(id, x, y)
	end
end

function EntityImage(x,y)
	for k, e in pairs(object_list) do
		if e.x == x and e.y == y then return object_image[k] end
	end
end

function EntityObject(x,y)
	return entity(x, y, "name") == "page" or string.sub(entity(x, y, "name"), 1, 7) == "object_"
end

object_collected = {}
object_list = {}
object_image = {}
function InitObjectList()
	for _, e in pairs(entitylist()) do
		if entity(e.x, e.y, "exists") then
			if EntityObject(e.x, e.y) then
				table.insert(object_list, e)
				collected_limit = collected_limit + 1
			end
		end
	end
end

addhook("startround","GeneratePageImage")
function GeneratePageImage()
	collected_objects = 0
	object_image = {}
	object_collected = {}
	for k, e in pairs(object_list) do
		if not ObjectImageType(e.x, e.y) then
			object_image[k] = image("gfx/brofistmsia/jeff the killer/page", 0, 0, 0)
			imagepos(object_image[k], e.x*32+16, e.y*32+16, 0)
		end
	end
end

InitObjectList()
GeneratePageImage()


And the last one, the servertransfer.lst, is this one of the problem?

servertransfer.lst
1
2
3
4
gfx/brofistmsia/jeff the killer/jeff the killer.jpg
gfx/brofistmsia/jeff the killer/jeff the killer.png
gfx/brofistmsia/jeff the killer/page.png
sfx/jeff the killer/go to sleep.ogg


Please check it out of me, course i am a newbie to lua. Help me to correct it and please post it
at my Private Message. Thank you for your help.

old maybe

Junior3534
User Off Offline

Quote
Sorry,im not good scripter,maybe .jpg its problem?
I don't seen photos with .jpg in CS2D...

old Re: My script can't access

Starkkz
Moderator Off Offline

Quote
I belive you have forgotten to put this.

1
SetScreamerFormat("maptype_", Createjeffthekiller)
Try replacing maptype_ with your map type.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview