Forum

> > CS2D > Scripts > spawning image and wall after destroying issue
Forums overviewCS2D overview Scripts overviewLog in to reply

English spawning image and wall after destroying issue

No replies
To the start Previous 1 Next To the start

moved spawning image and wall after destroying issue

olieo
User Off Offline

Quote
So i'm trying to create a script to spawn a box for each player who is online and hide it randomly around the map for them to find and destroy, doing it for just one box is easy but trying to use one image to create 1 box for each player is confusing me...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("join","spawn_box")
addhook("objectkill","move_box")

box = {}

function spawn_box(id)
	wall_x = math.random(1,9)
	wall_y = math.random(1,9)
	parse("spawnobject 3 "..wall_x.." "..wall_y)
	box_image_x = wall_x*32+16
	box_image_y = wall_x*32+16
	box[id] = image("gfx/GreedRPG/box.bmp",box_image_x,box_image_y,3)
end

function move_box(id,p)
	if object(id,"type") == 3 then
move image at the coordinates of the destroyed wall i to new random position and create new wall i at the new image position if the player who created that box still exists...

is there also a way to make the walls unique so players can build their own without it interfering with this script?
thanks for any help

EDIT: Sorry I posted in the wrong section by mistake
edited 1×, last 01.06.15 05:58:25 pm

Admin/mod comment

Moved to right section /DC
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview