UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: muffinmuncher115 on November 08, 2016, 09:00:12 pm

Title: How do I use SetLightingState?
Post by: muffinmuncher115 on November 08, 2016, 09:00:12 pm
Hi, I'm working on a new map and I'm having trouble using SetLightingState. Lighting states 1 and 2 are set to night, while I have lighting state 3 set to day. I'm trying to make the lighting state change to 3 with reckfullies shootable trigger script, but it doesn't seem to change. Could someone tell me how to set the map to lighting state 3 after all shootables are triggered?

Here is the code, the SetLightingState is towards the bottom.
Code Snippet
Plaintext
function init()
{
level.shootablesNeeded = 3;
level.shootablesCollected = 0;

level thread shootable_1();
level thread shootable_2();
level thread shootable_3();
}

function shootable_1()
{
    trig_1 = GetEnt("shootable_trigger_1", "targetname");
model_1 = GetEnt("shootable_model_1", "targetname");

trig_1 SetHintString("");
trig_1 SetCursorHint("HINT_NOICON");

while(1)
{
trig_1 waittill("trigger", player);

level.shootablesCollected++;

IPrintLn("Trigger 1 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_1 Delete();
model_1 Delete();
}

function shootable_2()
{
trig_2 = GetEnt("shootable_trigger_2", "targetname");
model_2 = GetEnt("shootable_model_2", "targetname");

trig_2 SetHintString("");
trig_2 SetCursorHint("HINT_NOICON");

while(1)
{
trig_2 waittill("trigger", player);

level.shootablesCollected++;

IPrintLn("Trigger 2 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_2 Delete();
model_2 Delete();
}

function shootable_3()
{
trig_3 = GetEnt("shootable_trigger_3", "targetname");
model_3 = GetEnt("shootable_model_3", "targetname");

trig_3 SetHintString("");
trig_3 SetCursorHint("HINT_NOICON");

while(1)
{
trig_3 waittill("trigger", player);

level.shootablesCollected++;

IPrintLn("Trigger 3 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_3 Delete();
model_3 Delete();
}

function shootables_done(player)
{
while(1)
{
self waittill(level.shootablesCollected >= level.shootablesNeeded);

if(level.shootablesCollected == level.shootablesNeeded)
{
// What ever code you want to execute once all shootables are collected
IPrintLn("All Shootables Collected");
SetLightingState( 3 );
}

break;
}
}
If someone can come up with a solution, I will credit you when I release the map, thanks in advance.
Title: Re: How do I use SetLightingState?
Post by: reckfullies on November 08, 2016, 11:10:26 pm
Hi, I'm working on a new map and I'm having trouble using SetLightingState. Lighting states 1 and 2 are set to night, while I have lighting state 3 set to day. I'm trying to make the lighting state change to 3 with reckfullies shootable trigger script, but it doesn't seem to change. Could someone tell me how to set the map to lighting state 3 after all shootables are triggered?

Here is the code, the SetLightingState is towards the bottom.
Code Snippet
Plaintext
function init()
{
level.shootablesNeeded = 3;
level.shootablesCollected = 0;

level thread shootable_1();
level thread shootable_2();
level thread shootable_3();
}

function shootable_1()
{
    trig_1 = GetEnt("shootable_trigger_1", "targetname");
model_1 = GetEnt("shootable_model_1", "targetname");

trig_1 SetHintString("");
trig_1 SetCursorHint("HINT_NOICON");

while(1)
{
trig_1 waittill("trigger", player);

level.shootablesCollected++;

IPrintLn("Trigger 1 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_1 Delete();
model_1 Delete();
}

function shootable_2()
{
trig_2 = GetEnt("shootable_trigger_2", "targetname");
model_2 = GetEnt("shootable_model_2", "targetname");

trig_2 SetHintString("");
trig_2 SetCursorHint("HINT_NOICON");

while(1)
{
trig_2 waittill("trigger", player);

level.shootablesCollected++;

IPrintLn("Trigger 2 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_2 Delete();
model_2 Delete();
}

function shootable_3()
{
trig_3 = GetEnt("shootable_trigger_3", "targetname");
model_3 = GetEnt("shootable_model_3", "targetname");

trig_3 SetHintString("");
trig_3 SetCursorHint("HINT_NOICON");

while(1)
{
trig_3 waittill("trigger", player);

level.shootablesCollected++;

IPrintLn("Trigger 3 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_3 Delete();
model_3 Delete();
}

function shootables_done(player)
{
while(1)
{
self waittill(level.shootablesCollected >= level.shootablesNeeded);

if(level.shootablesCollected == level.shootablesNeeded)
{
// What ever code you want to execute once all shootables are collected
IPrintLn("All Shootables Collected");
SetLightingState( 3 );
}

break;
}
}
If someone can come up with a solution, I will credit you when I release the map, thanks in advance.

The numbers for SetLightingState are messed up. I'm pretty sure 3 will set it to lighting state 2 so try using 4.
Title: Re: How do I use SetLightingState?
Post by: muffinmuncher115 on November 08, 2016, 11:58:06 pm
That didn't seem to work, do you think there's anything else that would work?
Title: Re: How do I use SetLightingState?
Post by: muffinmuncher115 on November 10, 2016, 11:49:23 am
Anyone? I really dont want all of the work I put in on the lighting for both times of day to go to waste.
Title: Re: How do I use SetLightingState?
Post by: reckfullies on November 10, 2016, 03:52:28 pm
Anyone? I really dont want all of the work I put in on the lighting for both times of day to go to waste.

Sorry about that, forgot that this wasn't the correct way to set a lighting state.

Add this to your #using section:
Code Snippet
Plaintext
#using scripts\shared\util_shared;

then change
Code Snippet
Plaintext
SetLightingState( 3 );
to
Code Snippet
Plaintext
level util::set_lighting_state(4); // If 4 doesn't work try 3 or 5.
Title: Re: How do I use SetLightingState?
Post by: muffinmuncher115 on November 10, 2016, 10:07:09 pm
Thank you so much, that fixed it.