Author Topic: Attach emitter to an item  (Read 897 times)

I've spawned an emitter, I've set its position to the current position of my item (note, this is not an image in my hand, but an item moving around on the ground) but when the item moves, the emitter doesn't. How do I move both?

EDIT: mountObject does not work for emitters because emitters do not derive from ShapeBase.
This must be possible because the player jets are attatched to the player and vehicles can have emitters on them and so can weapons with the state system. All of these are shapebase and so are items so they should be able to as well, I just dont know how

DOUBLE EDIT: fxLight has attachToPlayer and attachToBrick. Where the hell are these functions for emitters?!
« Last Edit: February 11, 2013, 09:13:12 PM by DYLANzzz »

Okay, so I can attach an image to an item. Anyone know how to attach an emitter to an image? I'd be happier if I didnt have to add like 20 datablocks, one for each image but I figure one solutions is better than none at all

I believe there are default emotes in the Add-ons directory. Those have emitters. And if i remember correctly, mounting images to items do not work correctly. I learned this with Truce trying to get his buildable vehicle to work. I could be wrong.

I believe there are default emotes in the Add-ons directory. Those have emitters. And if i remember correctly, mounting images to items do not work correctly. I learned this with Truce trying to get his buildable vehicle to work. I could be wrong.
Hmm, well the emote has a lifetime, which isn't really what I was looking for. I tried messing with StaticShapes.setEmitter which didnt do anything.
If I end up going with the emotes, it just seems like a huge clusterforget. Its like, spawn a projectile, to spawn an explosion to spawn an emitter, attached to an item. If I have a lot of these at once, it seems pretty inefficient :/

If you want just the emitter, you could do BRICK.emitter.save(path); and look at that.

Use states?
Code: [Select]
stateEmitter[0] = AdminWandEmitterB;

Snippet :
Code: [Select]
datablock shapeBaseImageData(YourImage)
{
stateEmitter[1] = EmitterNameA;
stateEmitter[3] = EmitterNameB;
};

Then use
datablock particleEmitterData(EmitterNameA), etc, to define those emitters.

It sounds like he's talking about items, not images, though. The state system is irrelevant.

Snippet :
Code: [Select]
datablock shapeBaseImageData(YourImage)
{
stateEmitter[1] = EmitterNameA;
stateEmitter[3] = EmitterNameB;
};

Then use
datablock particleEmitterData(EmitterNameA), etc, to define those emitters.
Oooh, So you're saying to attach an image to an item, and then define each state as an emitter and then switch between images for different emitters? Very clever :)
Also, I did get images to mount to items, and I didn't get any problems, yet

Oooh, So you're saying to attach an image to an item, and then define each state as an emitter and then switch between images for different emitters? Very clever :)
Also, I did get images to mount to items, and I didn't get any problems, yet

Basically you have emitter states for the item's ImageData and when someone holds your tool in-game, the emitter looks like it is emitting from the item they are holding.

Basically you have emitter states for the item's ImageData and when someone holds your tool in-game, the emitter looks like it is emitting from the item they are holding.
Oh, this is supposed to come from an item object that's on the ground (not held by someone). I found that you can equip images to items that are sitting on the ground (without any problems so far but plornt said there may be some) and if I attach an emitter to the image while its mounted to the object, I think I can make the emitter follow the item.

EDIT: I can attach the image just fine, but everything from there is pretty glitchy. I got the wand image to do a 0.15 second emitter but from there, nothing. I can't even reproduce this weird little emitter on my own image datablock even though I pretty much have the exact same state setup. Oh well, I guess this just isnt possible :(
« Last Edit: February 13, 2013, 11:24:53 PM by DYLANzzz »

If you want just the emitter, you could do BRICK.emitter.save(path); and look at that.
Wait, what? I don't want to save the emitter to a file?
And back again to the player emote thing, it seems as though that doesn't follow the player. It spawns the projectile, which spawns the explosion but it only stays in one area.

I'm going to try one more thing. The confusion emote does something a lot different I just found. It sets an image on the player and maybe if I copy those exact state's itll work. If not then I really do think this is impossible unless some of the unworking game code is fixed.
EDIT: Didn't work. FML!

If anyone ever figures this out please for the love of god tell me how you did it.