Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing Lantern Spotlight color mid game
Reminiscity Offline
Member

Posts: 81
Threads: 16
Joined: Jan 2013
Reputation: 2
#1
Changing Lantern Spotlight color mid game

HELLO FRIENDS!

Is it possible to change lantern spotlight color mid game? Or deactivate one spotlight and activate another?

I bet the answer is no but I would kill myself with a spoon if I found out it was possible after I released my mod.

If I remember correctly I saw at least two spotlights in the AMFP lantern entity file one of which was deactivated. I think it was used to create the flickering when pigs were nearby.

My mod Amadeus
03-22-2016, 07:44 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Changing Lantern Spotlight color mid game

It MIGHT be possible. You should try using, for example, SetLightVisible("lantern_SpotLight_1", false);. Basically input the light name like [EntityName]_[LightName]. That should fetch the light name from within that entity. Make sure both match.

As for color, try using FadeLightTo() instead.

03-22-2016, 09:49 PM
Find
Fatalist Offline
Member

Posts: 122
Threads: 8
Joined: Dec 2012
Reputation: 8
#3
RE: Changing Lantern Spotlight color mid game

It must work:
SetLightVisible("PlayerHands_SpotLight_1", false);

03-26-2016, 04:39 AM
Find
Reminiscity Offline
Member

Posts: 81
Threads: 16
Joined: Jan 2013
Reputation: 2
#4
RE: Changing Lantern Spotlight color mid game

I can't get it to work Sad

The lantern entity name is "lantern_mandus". I find this method a bit wierd because how would the engine know what is the entity name and what is the spotlight name when its only separated with an underscore? And in this case the entity name has an underscore in it which makes things even wierder.

SetLightVisible("lantern_mandus_SpotLight_2", false);

My mod Amadeus
03-26-2016, 02:49 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#5
RE: Changing Lantern Spotlight color mid game

(03-26-2016, 02:49 PM)Reminiscity Wrote: I can't get it to work Sad

The lantern entity name is "lantern_mandus". I find this method a bit wierd because how would the engine know what is the entity name and what is the spotlight name when its only separated with an underscore? And in this case the entity name has an underscore in it which makes things even wierder.

SetLightVisible("lantern_mandus_SpotLight_2", false);

Do what Fatalist wrote above.

SetLightVisible("PlayerHands_SpotLight_1", false);

Be sure to check the Model Editor to see which spotlight you want to fade, and make sure it is the correct spotlight you're referencing.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-26-2016, 03:34 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Changing Lantern Spotlight color mid game

Yes, the entity name must be the lantern entity that is held, not the item you pick up. Is it called PlayerHands though? I thought that was the entity name of the hand entity, which doesn't hold the light.

The entity is within the /models folder. The default entity file is named hand_lantern.ent and the MFP one is lantern_mandus.ent. To me, that would make sense to put mandus_lantern_SpotLight_2 (SpotLight_1 is ambient, whereas SpotLight_2 is the beam).

[Image: 6XN65u4.png]

Try to see if you can use this method for changing light properties to a simple entity, like a torch. It should work. The hand objects might be a bit different though. I've never done it myself.

Edit: Hang on a sec. You named your script to use "lantern_mandus..." not "mandus_lantern...". That might be the issue.

(This post was last modified: 03-26-2016, 06:03 PM by Mudbill.)
03-26-2016, 06:00 PM
Find
Reminiscity Offline
Member

Posts: 81
Threads: 16
Joined: Jan 2013
Reputation: 2
#7
RE: Changing Lantern Spotlight color mid game

SetLightVisible("PlayerHands_SpotLight_1", false);

IT WORKS!!!! I WROTE THE WRONG SPOTLIGHT NAME xD There was a hidden spotlight inside the lantern model.

This is so awesome. Thank you all for your help!

There's one problem tho. When you lower the lantern and then use it again the color of the lights resets to default values Sad

My mod Amadeus
(This post was last modified: 03-26-2016, 06:26 PM by Reminiscity.)
03-26-2016, 06:19 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: Changing Lantern Spotlight color mid game

Simply use SetLanternLitCallback() to make sure all genetics are injected properly when they pull it out.

03-26-2016, 08:09 PM
Find
Reminiscity Offline
Member

Posts: 81
Threads: 16
Joined: Jan 2013
Reputation: 2
#9
RE: Changing Lantern Spotlight color mid game

Managed to solve this. This is what I had to do.

void OnStart()
{

SetLanternLitCallback("lanternColor");

}

void lanternColor(bool abLit)
{

AddTimer("lanternTimer", 0.3f, "changeLanternColor");

}

void changeLanternColor(string &in asTimer){

FadeLightTo("PlayerHands_SpotLight_1", 0.1, 0.35, 0.5, 0.7, -1, 0);
FadeLightTo("PlayerHands_SpotLight_2", 0.1, 0.35, 0.5, 0.7, -1, 0);
FadeLightTo("PlayerHands_PointLight_1", 0.1, 0.35, 0.5, 0.5, -1, 0);

}

My mod Amadeus
03-26-2016, 08:26 PM
Find




Users browsing this thread: 1 Guest(s)