Frictional Games Forum (read-only)
[MDL ED] Attaching lights to entities - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [MDL ED] Attaching lights to entities (/thread-23675.html)



Attaching lights to entities - HugoLafisques - 10-23-2013

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?


RE: Attaching lights to entities - Acies - 10-23-2013

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. :]


RE: Attaching lights to entities - HugoLafisques - 10-24-2013

wow, that's a pain in the ass

thanks for the help, i'll give it a go


RE: Attaching lights to entities - HugoLafisques - 10-24-2013

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" ?


RE: Attaching lights to entities - Acies - 10-24-2013

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'


RE: Attaching lights to entities - HugoLafisques - 10-25-2013

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


RE: Attaching lights to entities - Acies - 10-25-2013

Awesome!