English Supply item spawn on gate field

7 replies
Goto Page
To the start Previous 1 Next To the start
Up
Ridho
User
Offline Off
hi all cookies

I wonder who can make script like:
supply item only spawn only when there's a gate field near the supply, if no gate field near the supply, the weapon won't be spawned/ the weapon will be disappeared

because I can't upload the example picture to imagehoster (maybe problem with my internet ) here's the link
Example Picture

ask me if the link is broken

I just did it by dropping the items on the gate field
thanks
Just PM me or chat (+62)8994518003 for necessary business

Admin/mod comment:

This is about a script. Moved. /DC
13.05.15 07:38:32 am
Up
Joni And Friends
User
Offline Off
You can use cs2d lua cmd object for it
Web | file File does not exist (15501) | file File does not exist (15463) | file cs2d [JAF] Adventure (19) | file File does not exist (15919)
13.05.15 11:51:41 am
Up
J192
User
Offline Off
Use http://imgur.com to temporarily host images. It's fast and efficient. Also, no sign-up and bullshit that doesn't let you directly link to the images. Images get deleted if nobody views for six months.

For the script, use the link user Joni And Friends provided. Try using the tile coordinates to check if a Gate Field is within a Supply.
13.05.15 12:54:33 pm
Up
Rainoth
Moderator
Offline Off
• Loop all buildings
• If supply is found, do x|y loop from -1 to 1
• Check if there's a building that's gatefield there
• If there isn't but there's a weapon near it, remove the weapon.

It's a tricky because I don't know how you could remove ONLY the item that the supply spawns... Still, that's more or less how I'd write it.
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
13.05.15 03:30:58 pm
Up
Ortimh
User
Offline Off
This code is to remove all items around supply or super supply. You can extend it though so items that supply spawns will be removed. It may throws errors because I'm really lazy to test it.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
for index, id in pairs(object(0, "table")) do
     if (object(id, "type") == 9 or object(id, "type") == 15) then
          for addtilex = -1, 1 do
               for addtiley = -1, 1 do
                    local tilex, tiley = object(id, "tilex") + addtilex, object(id, "tiley") +add tiley
                    
                    for index, itemid in pairs(item(0, "table")) do
                         if (item(itemid, "tilex") == tilex and item(itemid, "tiley") == tiley) then
                              if (objectat(tilex, tiley, 6) == 0) then
                                   parse("removeitem " .. itemid)
                              end
                         end
                    end
               end
          end
     end
end
I'm awesome ... and I really like cookies.
14.05.15 12:20:24 am
Up
TimeQuesT
User
Offline Off
There is one problem. Items dropped by players near the supplybox will be removed.
Muh
14.05.15 12:27:16 am
Up
Rainoth
Moderator
Offline Off
I suppose you could create a kind of type which would contain information like player ID, time dropped and so on and use those things to determine what is needed.
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
14.05.15 12:31:37 am
Up
TimeQuesT
User
Offline Off
yeah. Push item ids (dropped by players) into a table and check before removing them. (Of course do not forget to flush the table on round restart)
Muh
To the start Previous 1 Next To the start