Forum

> > CS2D > Scripts > Supply item spawn on gate field
Forums overviewCS2D overview Scripts overviewLog in to reply

English Supply item spawn on gate field

7 replies
To the start Previous 1 Next To the start

moved Supply item spawn on gate field

Ridho
User Off Offline

Quote
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

Admin/mod comment

This is about a script. Moved. /DC

old Re: Supply item spawn on gate field

J192
User Off Offline

Quote
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.

old Re: Supply item spawn on gate field

Rainoth
Moderator Off Offline

Quote
• 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.

old Re: Supply item spawn on gate field

Dousea
User Off Offline

Quote
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.
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

old Re: Supply item spawn on gate field

Rainoth
Moderator Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview