Frictional Games Forum (read-only)

Full Version: Attaching lights to entities
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I've been messing around in the amnesia model editor for a little while and managed to attach some lights and billboards to the grunt model; but I'm running into a problem when the grunt despawns - the lights and billboards aren't deactivated as well, leaving me with some floating lights at wherever in the map the enemy was.

Any ideas?
Manually deactivate the lights. Not sure there is 'an easy way' to do this.

Bind the billboards of the grunt to a light (all in the modeleditor). I know that setting the color of the pointlight 'black' hides the billboards;
void FadeLightTo(string& asLightName, float afR, float afG, float afB, float afA, float afRadius, float afTime);

The name of the pointlight would be "servant_grunt_1_pointlight_1" - I hope you understand the naming convention.

I'm not sure if;
void SetLightVisible(string& asLightName, bool abVisible);
Works as well.

It appears as if this can be set up to work 'automatically', by using the callbackfunc specified in the 'entity' tab of the leveleditor of the grunt/brute;
OnAutoDisabled (hover mouse on the white blank).

Best of luck - I'm not huge on scripting so someone else will have to step in, in case this general overview doesn't do it. :]
wow, that's a pain in the ass

thanks for the help, i'll give it a go
For some reason i'm getting the error 'OnAutoDisable' is not a valid data type?

I'm probably doing this completely wrong, but here's my function:

Code:
void enemylight(string &in EntityName, OnAutoDisabled)
{    
FadeLightTo("servant_grunt_light", 0, 0, 0, 0, 0, 0.1);
}

Edit:

Also in the model editor would the light be named pointlight_1, then outside of that it would be referred to as "servant_grunt_1_pointlight_1" ?
In response to your edit - yes. So, the light needs to be renamed in the script you provided.

Also, I dug through old scripts to find the correct format - tried to 'translate' into something for you:


void enemylight(string &in EntityName, string &in Type)
{
if(Type == "OnAutoDisabled")
{
FadeLightTo("servant_grunt_1_light_1", 0, 0, 0, 0, 0, 0.1);
}
}

(Keep in mind that the editors like to add an underscore and a number on names!).

The script assumes that you named your pointlight = 'light'
Awesome man, it works! thanks a lot for the help, I searched for ages on documentation for this kind of stuff but couldn't find anything
Awesome!