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
Woah... This shouldn't be happening..
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#1
Exclamation  Woah... This shouldn't be happening..

Okay.. so... It's kinda hard to explain. But..
I have a Collide callback set up to where when you run into it, 2 level doors disappear and monsters are spawned then swarm out of the "rooms" thing is, they aren't rooms, all that's behind the level doors is a a floor, So.. when I walk into the collide area, the monsters do spawn and the doors do disappear.. but both floors are gone.. as if there were no floors there to begin with. Help?

I'm also having a small key problem that goes along with this one, I have an if statement set.
void OnEnter()
{
"if (HasItem("key_1") == true)
{
AddEntityCollideCallback(blah, blah,blah)
}
}
thing is.. I'd have to leave the level then come back in (with the key) in order for the CollideCallback to activate, but the key is on the same map as the Collide area.

Here's teh. Script
/////////////////////////////
// Run first time starting map
void OnStart()
{
    AddEntityCollideCallback("Player", "ScriptArea_1", "LightArea", true, 1);
    AddEntityCollideCallback("Player", "ScriptArea_2", "LightArea_2", true, 1);
    SetLocalVarInt("IsDoorunLocked", 0);
        if (HasItem("girlsdormkey_1") == true)
     {
          RemoveItem("girlsdormkey_1");
          GiveItem("girlsdormkey_1", "key_tower.ent", "girlsdormkey", "", 1.0f);
     }
}

void LightArea(string &in asParent, string &in asChild, int alState)
{
    SetGlobalVarInt("music", 1);
    AddTimer("", 1.0f, "lightarea_1");
    AddTimer("", 2.0f, "lightarea_2");
    AddTimer("", 3.0f, "lightarea_3");
    AddTimer("", 4.0f, "lightarea_4");
}

void lightarea_1(string &in asTimer)
{
    SetLampLit("torch_static_green_8", true, true);
    SetLampLit("torch_static_green_1", true, true);
}

void lightarea_2(string &in asTimer)
{
    SetLampLit("torch_static_green_7", true, true);
    SetLampLit("torch_static_green_2", true, true);
}

void lightarea_3(string &in asTimer)
{
    SetLampLit("torch_static_green_6", true, true);
    SetLampLit("torch_static_green_3", true, true);
}

void lightarea_4(string &in asTimer)
{
    SetLampLit("torch_static_green_5", true, true);
    SetLampLit("torch_static_green_4", true, true);
}

void LightArea_2(string &in asParent, string &in asChild, int alState)
{
    AddTimer("", 0.5f, "lightarea_5");
    AddTimer("", 1.0f, "lightarea_6");
    AddTimer("", 1.5f, "lightarea_7");
    AddTimer("", 2.0f, "lightarea_8");
    AddTimer("", 2.5f, "lightarea_9");
    AddTimer("", 3.0f, "lightarea_10");
    AddTimer("", 3.5f, "lightarea_11");
    AddTimer("", 4.0f, "lightarea_12");
}

void lightarea_5(string &in asTimer)
{
    SetLampLit("torch_static_green_12", true, true);
    SetLampLit("torch_static_green_9", true, true);
}

void lightarea_6(string &in asTimer)
{
    SetLampLit("torch_static_green_11", true, true);
    SetLampLit("torch_static_green_13", true, true);
}

void lightarea_7(string &in asTimer)
{
    SetLampLit("torch_static_green_10", true, true);
    SetLampLit("torch_static_green_14", true, true);
}

void lightarea_8(string &in asTimer)
{
    SetLampLit("torch_static_green_15", true, true);
    SetLampLit("torch_static_green_20", true, true);
}

void lightarea_9(string &in asTimer)
{
    SetLampLit("torch_static_green_16", true, true);
    SetLampLit("torch_static_green_21", true, true);
}

void lightarea_10(string &in asTimer)
{
    SetLampLit("torch_static_green_17", true, true);
    SetLampLit("torch_static_green_22", true, true);
}

void lightarea_11(string &in asTimer)
{
    SetLampLit("torch_static_green_18", true, true);
    SetLampLit("torch_static_green_23", true, true);
}

void lightarea_12(string &in asTimer)
{
    SetLampLit("torch_static_green_19", true, true);
    SetLampLit("torch_static_green_24", true, true);
}


////////////////////////////
// Run when entering map
void OnEnter()
{
    AddUseItemCallback("", "girlsdormkey_1", "girlsdormdoor", "UsedKeyOnDoor_5", true);
    AddUseItemCallback("", "lloydskey_1", "lloydsoffice", "UsedKeyOnDoor_10", true);
    AddUseItemCallback("Unlock", "labkey_1", "labdoor", "UseKeyOnDoor_6", true);
    SetLevelDoorLockedText("labdoor", "Message", "lablocked");
    SetLevelDoorLockedText("girlsdormdoor", "Message", "girlsdormlocked");
    SetEntityPlayerInteractCallback("lloydsoffice", "InteractLloydsOffice", false);
    if (GetGlobalVarInt("music") == 0)
        {
        PlayMusic("02_amb_safe.ogg", true, 100.0, 0.0, 1, true);
        }
    else if (GetGlobalVarInt("music") == 1)
        {
            PlayMusic("09_amb_safe.ogg", true, 100.0, 0.0, 1, true);
        }
    if (HasItem("labkey_1") == true)
        {
            AddEntityCollideCallback("Player", "MonsterAttack", "MonsterAttackArea", true, 1);
            AddEntityCollideCallback("Player", "ScriptArea_4", "LightArea_3", true, 1);
            AddEntityCollideCallback("Player", "ScriptArea_5", "LightArea_4", true, 1);
            AddEntityCollideCallback("Player", "ScriptArea_6", "LightArea_5", true, 1);
        }
}
        
        
void InteractLloydsOffice(string &in asEntity)
{
    SetMessage("Message", "lloydsdoor", 0);
}


void UsedKeyOnDoor_5(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("girlsdormdoor", false);
    PlaySoundAtEntity("", "unlock_door", "girlsdormdoor", 0, false);
    RemoveItem("girlsdormkey_1");
}

void UseKeyOnDoor_6(string &in asItem, string &in asEntity)
{
    SetLocalVarInt("IsDoorunLocked", 1);
    SetLevelDoorLocked("labdoor", false);
    PlaySoundAtEntity("", "unlock_door", "labdoor", 0, false);
    RemoveItem("labkey_1");
}

void UsedKeyOnDoor_10(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("lloydsoffice", false, true);
    PlaySoundAtEntity("", "unlock_door", "lloydsoffice", 0, false);
    RemoveItem("lloydskey_1");
    SetMessage("Message", "lloydsdooropen", 0);
}

void StartCredits(string &in asEntity)
{
if(GetLocalVarInt("IsDoorunLocked") == 1)
{
FadeOut(2.0f);
StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}
}


void MonsterAttackArea(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 0.0f, "StartAttack");
}


void StartAttack(string &in asTimer)
{
PlaySoundAtEntity("boom", "break_wood_metal.snt", "boysdormdoor", 0.0f, false);
PlaySoundAtEntity("boom2", "break_wood_metal.snt", "girlsdormdoor", 0.0f, false);
SetEntityActive("boysdormdoor", false);
SetEntityActive("girlsdormdoor", false);
SetEntityActive("servant_brute_1", true);
SetEntityActive("servant_brute_2", true);
SetEntityActive("servant_brute_3", true);
SetEntityActive("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
SetEntityActive("servant_grunt_3", true);
SetEntityActive("enemy_suitor_malo_1", true);
}


void LightArea_3(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_16", false, true);
SetLampLit("candlestick_wall_15", false, true);
SetLampLit("candlestick_wall_14", false, true);
SetLampLit("candlestick_wall_1", false, true);
SetLampLit("candlestick_wall_2", false, true);
SetLampLit("candlestick_wall_3", false, true);
}


void LightArea_4(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_13", false, true);
SetLampLit("candlestick_wall_12", false, true);
SetLampLit("candlestick_wall_11", false, true);
SetLampLit("candlestick_wall_10", false, true);
SetLampLit("candlestick_wall_4", false, true);
SetLampLit("candlestick_wall_5", false, true);
SetLampLit("candlestick_wall_6", false, true);
SetLampLit("candlestick_wall_7", false, true);
AddTimer("", 0.0f, "SlamDoor1");
}


void LightArea_5(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_8", false, true);
SetLampLit("candlestick_wall_9", false, true);
SetLampLit("candlestick_wall_20", false, true);
SetLampLit("candlestick_wall_21", false, true);
SetLampLit("candlestick_wall_22", false, true);
SetLampLit("candlestick_wall_19", false, true);
SetLampLit("candlestick_wall_18", false, true);
SetLampLit("candlestick_wall_17", false, true);
AddTimer("", 0.0f, "SlamDoor2");
}


void SlamDoor1(string &in asTimer)
{
SetSwingDoorClosed("mansion_7", true, false);
}


void SlamDoor2(string &in asTimer)
{
SetSwingDoorClosed("mansion_4", true, false);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
    StopMusic(1.0f, 1);
    SetGlobalVarInt("music", 0);
}

P.S. Still having trouble with getting the demo to end, Help would really be appreciated.
(This post was last modified: 07-22-2011, 03:27 AM by Zypherzemus.)
07-22-2011, 03:26 AM
Find
Ouroboros Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jul 2011
Reputation: 0
#2
RE: Woah... This shouldn't be happening..

For the if with the key, you could probably place it inside the function that gets called, set it so that it doesn't auto remove and then in the if add
RemoveEntityCollideCallback(string& asParentName, string& asChildName);
And that would probably allow for it to be triggered without having to leave the map and only start when you want it to.

As for the floor... What kind of floor are you using? And though it's unlikely, did you accidentally forget to save adding the floors, or accidentally undo them or anything troublesome like that?


Edit: For the credits, if it's being used as a door interact, it would probably work if it were
void StartCredits(string &in asEntity)
{
if(GetSwingDoorLocked(asEntity) == false)
{
FadeOut(2.0f);
StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}
}
If it's not attached to the door that it's checking to be unlocked, asEntity could be changed to the name of the door, if it is on the door you want to check to see if it's unlocked, asEntity should work fine.
(This post was last modified: 07-22-2011, 04:21 AM by Ouroboros.)
07-22-2011, 04:14 AM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#3
RE: Woah... This shouldn't be happening..

For the key problem: Whaaaaaa? Could you please be a little more descriptive of what you mean?

For the floor problem: I'm using a masionbase floor (primitive). When I first tested it out, I actually went back to make sure I saved it, then I saved it several times over. Tried it again, and they still disappeared, I'm pretty sure I didn't undo anything.

For the Credits problem: The door itself isn't a swing door, it's a level door, I had another thread with about a length of 5 pages with people trying to help me out, but none of it seemed to work.
Last resort would be me making it a collide area instead of an interactive area, but I really wanna try interactive if possible.
07-22-2011, 04:52 AM
Find
Ouroboros Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jul 2011
Reputation: 0
#4
RE: Woah... This shouldn't be happening..

I see. In that case, in OnStart, change SetLocalVar to AddLocalVar.

For the key,


OnEnter()
{
...
    AddEntityCollideCallback(stuff, other stuff, FunctionA, false, 1);
...
}

void FunctionA(string &in asParent, string &in asChild, int alState)
{
if(HasItem("key_1"))
      {
      AddTimer("", 0, "startattack"
      RemoveEntityCollideCallback(string& asParentName, string& asChildName);
      }
}

Edit: Forgot to add the remove entity collide callback after the timer in the code.


For the floor, I'd set the door to inactive and turn the addcollidecallback into a comment, go over and see if it's there before it activates, and if it is then continue to check which of the involved code it is by commenting a piece, checking and just kind of continue like that. If it's not there at first, it may be a texture issue or something.
(This post was last modified: 07-22-2011, 05:22 AM by Ouroboros.)
07-22-2011, 05:16 AM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#5
RE: Woah... This shouldn't be happening..

I failed to mention this, but the script area for where the monsters spawn and the doors disappear, is in a general area, so you're going to be running over that script area alot, and I only want it to activate if you have the key to a specific door, that's why I used the "if" first instead of just a collide callback. I see what you're trying to tell me, but it wouldn't work that way since I want the script area to be active once you achieved a key.
Wow, it seems that everything that gets put behind the level door disappears with it, except the monsters, and walls (I think, haven't tried it yet)
(This post was last modified: 07-22-2011, 05:47 AM by Zypherzemus.)
07-22-2011, 05:44 AM
Find
Ouroboros Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jul 2011
Reputation: 0
#6
RE: Woah... This shouldn't be happening..

(07-22-2011, 05:44 AM)Snuffalofagus Wrote: I failed to mention this, but the script area for where the monsters spawn and the doors disappear, is in a general area, so you're going to be running over that script area alot, and I only want it to activate if you have the key to a specific door, that's why I used the "if" first instead of just a collide callback. I see what you're trying to tell me, but it wouldn't work that way since I want the script area to be active once you achieved a key.

But that's the point of setting off auto disable and manually disabling it only after it's effect starts when the player has the key. It will become active a lot, but it won't do anything until the key is in the player's inventory because of the if statement having the timer inside, with the manual disable also within. Hm... Well, the logic seems sound to me but, if you think it won't work then that is acceptable as well.

I think I've attempted it once( can't remember how it worked out), but you could possibly have a interact function attached to the key and then add the callback inside that function. So, that's an alternative suggestion I suppose.

Edit: Ah, that would do it. Perhaps consider static or locked swing doors?
(This post was last modified: 07-22-2011, 05:56 AM by Ouroboros.)
07-22-2011, 05:53 AM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#7
RE: Woah... This shouldn't be happening..

Ok, so I'm using your suggestion of the Interactive callback, and it works. (1/3) problems completed, Now it's just the floor and the credits. (Changed "SetLocalVarInt" to "AddLocalVarInt" but it still won't work)
07-22-2011, 06:13 AM
Find
Ouroboros Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jul 2011
Reputation: 0
#8
RE: Woah... This shouldn't be happening..

I'm trying to figure out what would cause the floor to disappear so I have no suggestion there, but for the credits I would add debug messages to unlocking the door
if(GetLocalVarInt("IsDoorunLocked") == 1)
{
AddDebugMessage("IsDoorunLocked equals 1", true);
}

And then another just above the credits along the lines of
AddDebugMessage("Credits should start", true);

That way, you would be able to tell whether or not it gets to the credits, or if the problem is the variable itself.

Edit: Did you accidentally alter the .mat file selected for the floors? Or intentionally alter it? If you did that might be the cause of it, the floor more or less turns invisible while still having the collision and such but still looking proper in the editor, is that the problem you have?
(This post was last modified: 07-22-2011, 06:47 AM by Ouroboros.)
07-22-2011, 06:35 AM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#9
RE: Woah... This shouldn't be happening..

Yes, that is the problem I'm having, it's in the editor, but when I run into the collision area, it disappears along with the door.

I'm kinda not working in a dev.enviorment, I'm just throwing that out there
07-22-2011, 02:12 PM
Find
Ouroboros Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jul 2011
Reputation: 0
#10
RE: Woah... This shouldn't be happening..

Aside from making the .mat file to use blank in the primitive option I couldn't cause the same effect so I suggest deleting the floor and then placing another, perhaps stretching one you already have to see if it disappears as well.

Since you're not using a dev set up, I guess I then suggest maybe placing like doors or boxes or something and disable them/unlock them instead of having debug messages, any visual way of testing whether it makes it to the function or not will do.
07-22-2011, 02:22 PM
Find




Users browsing this thread: 1 Guest(s)