edited 1×, last 31.12.10 10:58:54 am
Forum
CS2D Scripts Spawn item in breakableSpawn item in breakable
14 replies 1
1
2
3
4
5
2
3
4
5
addhook("triggerentity","wtfbreak") function wtfbreak(x,y) if entity(50,40,"name") == name then parse("spawnitem 10 50 40") end
PS: Replace the word name with the name that you put to your entity....
edited 2×, last 30.12.10 09:24:11 pm
FN_Nemesis has written
here we go!
PS: Replace the word name with the name that you put to your entity....
1
2
3
4
5
2
3
4
5
addhook("triggerentity","wtfbreak") function wtfbreak(x,y) if entity(50,40,"name") == name then parse("spawnitem 10 50 40") end
PS: Replace the word name with the name that you put to your entity....
=( i need when breakable with XY tile breaks (62 25) in X 62 and Y 25 parse spawnitem 10 62 25
edited 1×, last 31.12.10 08:11:28 am
TimeQuesT has written
no you can't
Yes you can do that with map triggers
just put a breakable entity with
trigger "asd"
and item entity
in spawn select on trigger only
and write on name "asd"
and when you destroy that breakable that item will appear
6 lines in total, only 4 of which do something. Not hrad to make. Try reading info.txt, it is definitely a very useful and complete source of information, that is what I do whenever I need to research/confirm something about CS2D's Lua scripting engine. It helps a lot.
DannyDeth has written
1
2
3
4
5
6
2
3
4
5
6
addhook("triggerentity","wtfbreak") function wtfbreak(x,y) 	if( entity(x,y,"name")=="INSERT_ENTITY_NAME_HERE") then 		parse('spawnitem ID_OF_ITEM '..x..' '..y) 	end end
and this not work
the code is basically correct but you have to replace "triggerentity" with "break".
let me explain why it DOES NOT work with triggerentity: triggerentity is only called when an entity is triggered. breaking a breakable does NOT count as triggering. It can trigger entities (if you enter entity names in the trigger field of the breakable) but it normally doesn't.
so triggering only occurs when one or more entity names are in the trigger field of an entity (and if the trigger-action of this entity is performed). in this case the triggerentity event will be performed for all entities which have been triggered.
p.s.: entering the same value for name and trigger in your breakable in order to use triggerentity anyways does not work, because the breakable entity will be removed completely when it breaks. this means that it can not be triggered anymore.
edited 1×, last 31.12.10 11:11:20 am
edited 1×, last 31.12.10 11:14:12 am
1
2
3
4
5
6
2
3
4
5
6
addhook("break","wtfbreak") function wtfbreak(x,y) if(entity(x,y,"name")=="break1") then parse('spawnitem 10 '..x..' '..y) end end
edited 1×, last 31.12.10 11:27:10 am
They are:
1-Zombie
2-Headcrab
3-Snark
So, yeah.
1