Forum

> > CS2D > Scripts > my map script doesn't work
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch my map script doesn't work

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt my map script doesn't work

zazz
User Off Offline

Zitieren
Hey usS, sorry for bothering again.
When i try to run a weapon detector script in my map, it doesn't work. it has the same name as my map, and it's in maps folder aswell.

Soushi made this script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--Scanner location, input in tile format!
tilex = 119
tiley = 137
--Enter your mapname here
mapName = 'zAzz_Jail'

addhook("movetile","movetile_hook")
function movetile_hook(id ,playerx ,playery)
     if map("name") == mapName then
          if tilex == playerx and tiley == playery then
               local weapons = playerweapons(id)
               if #weapons > 1 then
                    parse('trigger "hasWeapons"')
               else
                    parse('trigger "hasNoWeapons"')
               end
          end
     end
end

It doesn't trigger the sound when i step in the tile.
All this kind of scripts aren't working in my map
What the hell is the problem?

Luamap is enabled
Other maps have the same scripts and they work.
But no one seems to work in my map..

alt Re: my map script doesn't work

Cure Pikachu
User Off Offline

Zitieren
• Does the map have any sound entities named "hasWeapons" and "hasNoWeapons" (case sensitive)?
• Does the said entities are configured properly and have audible sound?
Mehr >

alt Re: my map script doesn't work

Cure Pikachu
User Off Offline

Zitieren
@user zazz: The code I just provided won't work, duh, I am just making a point there.

Removing the redundant part leaves us with this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--Scanner location, input in tile format!
tilex = 119
tiley = 137

addhook("movetile","movetile_hook")
function movetile_hook(id,playerx,playery)
	if playerx == tilex and playery == tiley then
		local weapons = playerweapons(id)
		if #weapons > 1 then
			parse('trigger "hasWeapons"')
		else
			parse('trigger "hasNoWeapons"')
		end
	end
end

alt Re: my map script doesn't work

Rainoth
Moderator Off Offline

Zitieren
@user zazz: Just debug it then. You'll see where the script goes stuck and if it isn't stuck anywhere, it's the fault of map/user/entities.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
print("ding")
--Scanner location, input in tile format!
tilex = 119
tiley = 137

addhook("movetile","movetile_hook")
function movetile_hook(id,playerx,playery)
print("dong")
     if playerx == tilex and playery == tiley then
	print("tic")
          local weapons = playerweapons(id)
          if #weapons > 1 then
		print("tac")
               parse('trigger "hasWeapons"')
          else
               parse('trigger "hasNoWeapons"')
		print("toe")
          end
     end
end

Ding :3

// If anyone wonders why it wasn't working, he was using wrong encoding. Now everything works.
1× editiert, zuletzt 29.11.15 17:04:30
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht