Forum

> > CS2D > Scripts > Two "?" about scripting.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Two "?" about scripting.

8 replies
To the start Previous 1 Next To the start

old Two "?" about scripting.

Andrew12357
User Off Offline

Quote
How do I block projectiles when they hit a barricade, like EnderCrypt's script?

Also, whenever a building is destroyed (made by players), it does not trigger the "break" hook, why? If there is a hook for this, please tell me!

old Re: Two "?" about scripting.

Bowlinghead
User Off Offline

Quote
objectkill does not return anything. But the "objectid" or "id" parameter could be thing what you are looking for:
cs2d lua cmd object
cs2d lua hook objectkill
cs2d lua cmd objecttype
1
2
3
4
5
6
7
8
--untested
addhook("objectkill","OG")
function OG(oid, pid)
	msg("Type: "..objecttype(object(oid,"type"), "name"))
	msg("Owner: "..object(oid,"player"))
	msg("X: "..object(oid,"x"))
	msg("Y: "..object(oid,"y"))
end

Edit:
Note that the objecttype describes what it is like turret, etc.
What you get here instead, is a dynamic object id. Those exist for each turret, barricade, etc.
edited 1×, last 02.09.21 02:39:15 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview