Forum

> > CS2D > Scripts > Object kill script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Object kill script

15 replies
To the start Previous 1 Next To the start

old Object kill script

Homam
User Off Offline

Quote
Hey guys, i was making a script then i didn't know how to make it, i try to fix it but nothing can help me, so i give up.

I want the script like that:

If i destroy a "Env_Breakable" a item appear, like money or a weapon.

I need this script!

Thanks.

old Re: Object kill script

Cure Pikachu
User Off Offline

Quote
The most basic one.
1
2
3
4
addhook("break","getitem")
function getitem(x,y)
	parse("spawnitem 10 "..x.." "..y) -- 10 is the weapon ID, in this case, the M3
end

old Re: Object kill script

Homam
User Off Offline

Quote
@Pikachu xD, Thanks! It works!

@Factis699, No i can't, i want the same tile (Of the breakable), to spawn the weapon/gold.

Edit: I can't make more than one. Anyscript that makes 2? or 3?
Edit 2: Ah, I know how to make it 2 or 3 now, Thanks!
edited 2×, last 13.05.11 12:06:05 pm

old Re: Object kill script

R a G e
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("break","getitem")
function getitem(x,y)
     parse("spawnitem 10 "..x.." "..y) -- 10 is the weapon ID, in this case, the M3
end

addhook("break","getitem")
function getitem(x,y)
     parse("spawnitem 10 "..x.." "..y) -- 10 is the weapon ID, in this case, the M3
end

old Re: Object kill script

Homam
User Off Offline

Quote
Like that:

1
2
3
4
5
6
7
8
9
addhook("break","getitem")
	function getitem(x,y)
		if (x == 1 and y == 48) then
		parse("spawnitem 1 1 48")
	end
		if (x == 11 and y == 48) then
		parse("spawnitem 3 11 48")
	end
end

old Re: Object kill script

kalis
User Off Offline

Quote
you can local s_x =1 -- spawn in X
     local s_y =1 -- Spawn in Y
parse("spawnitem 68 "..s_x.." "..s_y)
it will spawn item in tile 1,1

old Re: Object kill script

DannyDeth
User Off Offline

Quote
HoMaM, your code is incorrect, it won't work!
addhook() is a function, not a function definition, remove the extra end!

old Re: Object kill script

DannyDeth
User Off Offline

Quote
Wtf are you guys smoking?

EDIT: Fail, just bad tabbing. Nevermind.
edited 1×, last 15.05.11 02:38:46 pm

old Re: Object kill script

Yasday
User Off Offline

Quote
It's not really wrong, everybody has his own way to tab his script.

Edit:
1 function + 2 if statements
3 ends
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview