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
Deactivating/activating billboards
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#1
Deactivating/activating billboards

Hey all, I have a cool idea to make an scary event in which the player sees a shadow of something sinister fly past a window.

The only problem is I need to deactivate the light billboards in sequence. My script for this is set up, but it uses SetEntityActive, and billboards are not considered entities. The script worked perfectly...but I used wine bottles :S

Does anyone know a way to deactivate them and then reactivate them in-sequence? Thanks for any tips!

Also, I'd like to post the actual script for this sequence. Can someone tell me how to put a box in the post that lets me put in the script? Thanks Big Grin Then you can see if there's a cleaner and shorter way to have it do what I want. Smile
(This post was last modified: 03-23-2011, 08:41 AM by palistov.)
03-23-2011, 08:35 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Deactivating/activating billboards

Tie the billboards to a light source, than close the lights.

03-23-2011, 12:48 PM
Website Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#3
RE: Deactivating/activating billboards

Sweet I'll give that a shot. Thanks.
03-23-2011, 08:25 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#4
RE: Deactivating/activating billboards

Hi. That worked perfectly, but I need some help with the code. I'll try posting what I've put together, but it is VERY sloppy, and actually crashed the game.

//BACKUP SHADOWRUN

void OnStart()
{
    AddEntityCollideCallback("Player", "triggershadowrun", "ShadowRun", false, 1);
    
    GiveItemFromFile("lantern", "lantern.ent");
            SetPlayerLampOil(100.0f);
}



//SHADOW RUN

//This is horrendous. It crashed the game. Haha. Anyways, my idea is to start a loop which checks a timer (which in the ideal event will actually only be about 0.5 sec long. And it sequentially disables each light source (there are 14) across the 0.5 seconds, and turns them back on shortly after. This will look like something flies past the window, and will hopefully scare peoples' socks off.


void ShadowRun(string &in asParent, string &in asChild, int alState)
{
    AddTimer("LightSequence", 15.0, "ASDF");
    AddLocalVarFloat("sequence", 0.0);
    SetLocalVarString("sequence", "s");
    AddLocalVarInt("timerinteger", GetTimerTimeLeft("LightSequence"));
    SetLocalVarString("timerinteger", "t");
    for(float s = 1; s < 2.4; s++)
    {
        AddTimer("Timer_"+s, -0.139+s, "deactivate_"+(14-t));
        AddTimer("reactivatetimer_"+(14-t), 14-t, "reactivatebb_"+(14-t));
    }
}

//OK all this mumbo jumbo below is the individual functions to disable each light source, and the billboards as well. I couldn't find any clever way to wrap this up into a single function. Help! :D


void deactivate_1(string &in asTimer)
{
    SetLightVisible("PointLight_1", false);
}

void deactivate_2(string &in asTimer)
{
    SetLightVisible("PointLight_2", false);
}

void deactivate_3(string &in asTimer)
{
    SetLightVisible("PointLight_3", false);
}

void deactivate_4(string &in asTimer)
{
    SetLightVisible("PointLight_4", false);
}

void deactivate_5(string &in asTimer)
{
    SetLightVisible("PointLight_5", false);
}

void deactivate_6(string &in asTimer)
{
    SetLightVisible("PointLight_6", false);
}

void deactivate_7(string &in asTimer)
{
    SetLightVisible("PointLight_7", false);
}

void deactivate_8(string &in asTimer)
{
    SetLightVisible("PointLight_8", false);
}

void deactivate_9(string &in asTimer)
{
    SetLightVisible("PointLight_9", false);
}

void deactivate_10(string &in asTimer)
{
    SetLightVisible("PointLight_10", false);
}

void deactivate_11(string &in asTimer)
{
    SetLightVisible("PointLight_11", false);
}

void deactivate_12(string &in asTimer)
{
    SetLightVisible("PointLight_12", false);
}

void deactivate_13(string &in asTimer)
{
    SetLightVisible("PointLight_13", false);
}

void deactivate_14(string &in asTimer)
{
    SetLightVisible("PointLight_14", false);
}

void reactivatebb_1(string &in asTimer)
{
    SetLightVisible("PointLight_1", true);
}

void reactivatebb_2(string &in asTimer)
{
    SetLightVisible("PointLight_2", true);
}

void reactivatebb_3(string &in asTimer)
{
    SetLightVisible("PointLight_3", true);
}

void reactivatebb_4(string &in asTimer)
{
    SetLightVisible("PointLight_4", true);
}

void reactivatebb_5(string &in asTimer)
{
    SetLightVisible("PointLight_5", true);
}

void reactivatebb_6(string &in asTimer)
{
    SetLightVisible("PointLight_6", true);
}

void reactivatebb_7(string &in asTimer)
{
    SetLightVisible("PointLight_7", true);
}

void reactivatebb_8(string &in asTimer)
{
    SetLightVisible("PointLight_8", true);
}

void reactivatebb_9(string &in asTimer)
{
    SetLightVisible("PointLight_9", true);
}

void reactivatebb_10(string &in asTimer)
{
    SetLightVisible("PointLight_10", true);
}

void reactivatebb_11(string &in asTimer)
{
    SetLightVisible("PointLight_11", true);
}

void reactivatebb_12(string &in asTimer)
{
    SetLightVisible("PointLight_12", true);
}

void reactivatebb_13(string &in asTimer)
{
    SetLightVisible("PointLight_13", false);
}

void reactivatebb_14(string &in asTimer)
{
    SetLightVisible("PointLight_14", false);
}

I'm looking over the code I posted. It's bad. I'm gonna have to start from scratch with the help of you guys Big Grin
(This post was last modified: 03-24-2011, 02:18 AM by palistov.)
03-24-2011, 02:17 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#5
RE: Deactivating/activating billboards

Did you try to flicker it?

03-24-2011, 04:30 AM
Website Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#6
RE: Deactivating/activating billboards

No haven't done that. It may cause me the same type of problems because I'll have to turn off the flicker, right? Either way that's a good idea I'll give that a shot. Thanks Tanshaydar
03-24-2011, 08:16 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#7
RE: Deactivating/activating billboards

Well, first of all, you made an integer and a string using the same name ("sequence"), that won't work.
Second thing: What is that "t" in your for-loop? The string? It doesn't work like that in Amnesia. First of all, you try to subtract a string from an integer, which would already throw an error. Second thing, "t" must be an integer instead of a string. Third thing is, you will need to use GetLocalVarInt to access it.

And a summarized function instead of all your 14 would probably look like this:
void deactivate(string &in asTimer)
{
SetLightVisible(asTimer, false);
}

and you call that function like that:

for (int i = 1; i <= 14; i++)
{
AddTimer("PointLight_"+i, i, "deactivate"); //this would disable one light each second
}

(This post was last modified: 03-24-2011, 06:11 PM by Pandemoneus.)
03-24-2011, 11:30 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#8
RE: Deactivating/activating billboards

Hey Pandemoneus! Big Grin

Yeah I know the script is horrid and I still don't fully understand the language. I saw the for(int i = 1; i <10; i++) script in the beginner tutorial on the wiki, but I assumed that I could use any variable I chose in place of 'i'. Anyways, thanks for clearing so much of this up.

Your suggested function looks great! I would just have the time in the AddTimer function related to its number, correct? Something like this:

AddTimer("PointLight_"+s, 0.08 * s, "deactivate");

I don't know if thats the proper way to multiply things in this script. Thanks so much to both of you for your help!! Big Grin
03-24-2011, 05:44 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#9
RE: Deactivating/activating billboards

It doesn't have to be i, but in common for-loops i is always used for that (you could name it ohhithere aswell). And yes that's the correct way to multiply, it would be 0.08 first, then 0.16, and so on. Note that this time length is pretty short though.

[edit]
Also just noticed that I missed the time top. ^_^

03-24-2011, 05:54 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#10
RE: Deactivating/activating billboards

Yeah I want them to flicker in sequence with the whole shabang happening withing a second. Scary things move fast Big Grin
It works PERFECTLY, Pandemoneus. You sir, are a great person!
(This post was last modified: 03-24-2011, 07:02 PM by palistov.)
03-24-2011, 06:50 PM
Find




Users browsing this thread: 1 Guest(s)