Author Topic: fxLight to follow shot projectile  (Read 3812 times)

It'll also look pretty bad imo. What are you trying to achieve that you can't do with the default projectile light functionality?

not only that but particle effects basically glow in the dark so you could easily just attach a light with no corona and use a particle trail of your choosing and have it change sizes and stuff to emulate the light effect


It'll also look pretty bad imo. What are you trying to achieve that you can't do with the default projectile light functionality?
A flare.
ANT used an explosion with light to do this but the explosion is static so that won't work.

And yeah, the position loop does jack.
It just keeps throwing errors that i can't find the projectile.
« Last Edit: May 08, 2018, 10:37:45 AM by The 1 »

Post your onFire code

What are you trying to achieve that you can't do with the default projectile light functionality?
The default projectile light doesn't work over a network if I recall. Only works for the host or something like that.

make the projectile a bot with no model and set its damage level to 100 so that its put onto the corpse mask so players can't collide with it and then parent the body remove function to add an exception to that datablock you can attach a light to it and an image for an emitter and you can adjust its physics settings to make it behave more like you want

If only you could adjust it's gravity.

make the projectile a bot with no model and set its damage level to 100 so that its put onto the corpse mask so players can't collide with it and then parent the body remove function to add an exception to that datablock you can attach a light to it and an image for an emitter and you can adjust its physics settings to make it behave more like you want
lol this is probably the best approach.
Though i have absolutely no idea how bots work in blockland, let alone how to spawn them with a weapon.
And here is everything relevant about my OnFire function:
Code: [Select]
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
%p.setScale(%scale SPC %scale SPC %scale);

%light = new fxlight()
{
dataBlock = BrightLight;
enable = true;
iconsize = 1;
};
%light.updatePositionLoop(%p);
%light.attachToObject(%p);

%obj.spawnExplosion(TTBigRecoilProjectile,"4 4 4");
It works fine, some of the variables are declared elsewhere though. %light.updatePositionLoop and %light.attachToObject are the only ones that don't work.
attachToObject doesnt return an error anymore but still doesn't destroy the light alongside the projectile, and the update loop gives me the error mentioned before. And because the light is never destroyed, the loop keeps going forever.
Also, wtf is with torquescript's php-like variables and structure? Also, why is so much of all the game mechanics down to the engine and can't be modified? It would've been easier just to modify the original projectile code and remove the 20.0-unit limit on the projectile light.
« Last Edit: May 08, 2018, 11:06:20 PM by The 1 »

The default projectile light doesn't work over a network if I recall. Only works for the host or something like that.

Projectile light works over network games but light emitted by images don't (see: lantern item).

I'm having trouble moving fxLights lol. I don't really know how to describe it. Here's what I'm putting in console:

Code: [Select]
==>%light = new fxlight(){dataBlock = PlayerLight;enable = true;iconsize = 1; position = "0 0 15";}; %light.setTransform("0 0 20"); echo(%light);
23226
As you'd expect, it creates a light at 0 0 15 and then moves it to 0 0 20. However, putting this in after:
Code: [Select]
==>23226.setTransform("0 0 25");
Does nothing. The light still appears to be at 0 0 20. But,
Code: [Select]
==>echo(23226.getTransform());
0 0 25 1 0 0 0
After setting transform to 0 0 25, getTransform tells me it's at 0 0 25, but it doesn't actually appear to be at 0 0 25, it's still at 0 0 20.

It's weird because I've definitely moved lights around before using setTransform and I don't understand why this is happening.

I'm having trouble moving fxLights lol. I don't really know how to describe it. Here's what I'm putting in console:

Code: [Select]
==>%light = new fxlight(){dataBlock = PlayerLight;enable = true;iconsize = 1; position = "0 0 15";}; %light.setTransform("0 0 20"); echo(%light);
23226
As you'd expect, it creates a light at 0 0 15 and then moves it to 0 0 20. However, putting this in after:
Code: [Select]
==>23226.setTransform("0 0 25");
Does nothing. The light still appears to be at 0 0 20. But,
Code: [Select]
==>echo(23226.getTransform());
0 0 25 1 0 0 0
After setting transform to 0 0 25, getTransform tells me it's at 0 0 25, but it doesn't actually appear to be at 0 0 25, it's still at 0 0 20.

It's weird because I've definitely moved lights around before using setTransform and I don't understand why this is happening.
its because lights don't send their position over network once they've been established, because they aren't supposed to move unless they are attached to an object (although they aren't technically moving its just the object that is emitting the light that is moving)
although you could probably force an update by using %light.inspectPostApply(); I however would recommend against using this because I am not sure how well it will work over network with clients, the best approach would be to attach it to an object that is supposed to move