creating objects through message

is it possible to create objects by use of a message? like say mario hits cube, cube sends message at collision to empty which creates a coin.

this is kinda (ok so it’s exactly) what im trying to do.

i currently have both the character, the cube and the empty on the same layer, and the coin at a different layer.

i tried just having the cube create the coin, which worked but then the coin got stuck in the cube.

if it would help i can give u the file.

thanks alot!

yeah i think i can make it like what you want just give me a link or send it to my email [email protected]

yeah sure…just be warned, it’ll be in wireframe cuz there are no textures yet…oh and “mario” is called “jule”.

here it is: http://www.freewebs.com/medigital/jule.blend

thanks

sorry i looked at it but it could take some time to figure this out… plus im busy so ill work on it later.

don’t use the message sensor because it sends two messages… rather use the copy property sensor instead… so you make a property change value base on a collision with something… (theres an property actuator that can add or subtract numbers of a property)… (there is also good documentation on what all these sensors do etc) then you have your empty that has an always sensor connected to a copy property actuator… (so it always copies the value from the object testing for a colision…)

then you also have a property sensor that checks to see if the poperty value has changed… this is hooked up to your add object actuator… so what happens is on collision the property changes (another object copies this info) and uses it to add in something… so it’s is like sending a message…

ok thanks…still trying to work out exactly what u mean but ill check on the documentation and work it out.

i atleast know what u mean in concept…never thought of that so thanks again.

EDIT

hmmmm…if it’s possible could u be a little more specific? which property logic brick goes with which object?

currently at collision the cube that is hit adds 1 to a property. then i have the empty always copying the property from the cube that the character hits. at the same time the empty is checking for a change in this property. if there is a change then the empty creates the coin object.

yup that sounds correct…

currently at collision the cube that is hit adds 1 to a property. then i have the empty always copying the property from the cube that the character hits. at the same time the empty is checking for a change in this property. if there is a change then the empty creates the coin object.

in slighly more detail…
then with your empty (the one that adds stuff in!) you use a property sensor… and set it so that when your “property” does -not equal 1 (there are quite few different setting in the prpoperty sensor u can use)… hook it to an “and” controller… hook this to an “add object actuator”… and when your property changes to anything other than 1 it should fire and add the object…

I hope that makes things clearer but it does sound like you have the hang of it…

someone also suggested a workaround for the message sensors remember it sends 2 messages)… they said you could get it send 0.5… so that 0.5 sent twice = 1 and then you do the whole not equal to one thing to add in objects etc… my way does use a lot more logic bricks… which might slow stuff down… but having a message sensor that works properly (ie sends only 1 message at a time) would be nice cos that is how I would prefer to do it…

hmmm…still not getting it…

here’s what i have:

http://www.freewebs.com/medigital/coinbox.jpg

http://www.freewebs.com/medigital/coincreator.jpg

maybe it’d be best if u edited the file and then uploaded it back so i could see. but thanks alot for taking the time to explain it.

EDIT

i cheated. i just hooked up the logic bricks directly. it works, but im guessing this sort of action is looked down upon. so figuring out the other way would be best.

EDIT 2

and when i try to make another “coinbox”, it just puts coinbox.001 in the exact same place as coinbox.

can I download it on that link earlier in this thread?

okay I can see from your screen shots that you haven’t added in any properties… you are just searching for stuff that isn’t there…? click on the big “ADD PROPERTY” button… it will add in a property… you will have to change the name from it’s default… you can have different types of properties… i would use an interger ie. whole number (no decimals)… the documentation tells you what types there are and what there uses are…

also the object that will be added in can’t be visible… put it on a seperat layer and hide it