Forum

> > CS2D > Scripts > Weapon scan script pr0blem!
Forums overviewCS2D overview Scripts overviewLog in to reply

English Weapon scan script pr0blem!

6 replies
To the start Previous 1 Next To the start

old Weapon scan script pr0blem!

zazz
User Off Offline

Quote
Hey guys, i took from California Jail a weapon scan script, and putted it on my map, but for some reason it doesn't work, i added the tile x, and y. same sound names. i just don't get it..
What's the problem??

sound1 name: Alarm
sound2 name: Clear

They don't sound when you step in the tile

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
-----[ Created by EnderCrypt ]-----
AutoMapper = {}

Class(AutoMapper,function(func)
    self.map = {}
    x = 0
    while (x < const.map.xsize+1) do
        x = x + 1
        self.map[x] = {}
        y = 0
        while (y < const.map.ysize+1) do
            y = y + 1
            self.map[x][y] = func(x-1,y-1)
        end
    end
end)

function AutoMapper:get(x,y)--,default)
    x = x + 1
    y = y + 1
    --if (default == nil) then
        return self.map[x][y]
    --else
        --if ((x > 0) and (y > 0) and (x <= const.map.xsize) and (y <= const.map.ysize)) then
            --return self.map[x][y]
        --else
            --return default
        --end
    --end
end

-----[ Created by EnderCrypt ]-----
InspectAlarm = {}
InspectAlarm.specificTile = {}

function InspectAlarm.addSpecificTile(x,y,knife_trigger,weapon_trigger)
    local temp = {}
    temp.x = x
    temp.y = y
    temp.trigger = {knife=knife_trigger,weapon=weapon_trigger}
    InspectAlarm.specificTile[#InspectAlarm.specificTile+1] = temp
end

-- Add specific tiles HERE --

InspectAlarm.addSpecificTile(119,137,"Clear","Alarm")

-- end -- 

InspectAlarm.map = AutoMapper.new(function(x,y)
    local this = {}
    this.frame = tile(x,y,"frame")
    this.scanner = false
    return this
end)

local i = 0
while (i < #InspectAlarm.specificTile) do
    i = i + 1
    local tile_data = InspectAlarm.specificTile[i]
    local map_tile_data = InspectAlarm.map:get(tile_data.x,tile_data.y)
    map_tile_data.scanner = true
    map_tile_data.trigger = tile_data.trigger
end


hook("movetile",function(id,x,y)
    local tile_data = InspectAlarm.map:get(x,y)
    if tile_data.scanner then
        local weapons = playerweapons(id)
        if #weapons == 1 then
            -- just knife
            --msg("knife")
            parse("trigger "..tile_data.trigger.knife)
        else
            -- weapons
            --msg("weapon")
            parse("trigger "..tile_data.trigger.weapon)
        end
    end
end)

old Re: Weapon scan script pr0blem!

Nekomata
User Off Offline

Quote
don't include the "sfx". I know it's a bit ironic since you have to include it with gfx, but the directory for sound is already in the sfx folder, thus;

1
2
zAzz's Jail/HasWeapons.wav
zAzz's Jail/HasNoWeapons.wav

Also, for best practice, don't add spaces or quotes in folder names and keep it lowercased. So; 'zazz' or 'zazz-jail';
1
2
zazz/HasWeapons.wav
zazz/HasNoWeapons.wav

old Re: Weapon scan script pr0blem!

zazz
User Off Offline

Quote
Alright!, and btw.
What i'm trying to say is that, i just copied that script.
Added it in zAzz's Jail.lua, changed the tile X, and tile Y.
Created 2 sound enteties with "Clear" and "Alarm" as name.
But when i walk into the scanner nothing happens, i aldready tried everything!

This script is killing mee!

old Re: Weapon scan script pr0blem!

Nekomata
User Off Offline

Quote
removed. If you read what I wrote before this, screw it. This script is killing me too.

Here's an simpler one. I haven't tested it, give it a try nevertheless. But before that do this.

Go to your sfx folder.
1. Make a folder and name it zazz
2. Copy HasWeapon.wav and HasNoWeapon.wav to that folder.

So your directory drive paths should be like this;
1
2
[cs2d folder]\sfx\zazz\HasWeapon.wav
[cs2d folder]\sfx\zazz\HasNoWeapon.wav

Done? Okay, now the lua;
More >


Don't forget to replace the x and y values with your tile's coordinates.
And after you walk over the tile, if you don't hear anything then check the server's command line. Did it write "has weapon"/"has no weapon"?
edited 6×, last 14.11.15 11:00:49 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview