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
Script area map change?
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#1
Script area map change?

I tried before and it never ending up working, I want my character to fall into a hole, hit the script area and then map change. Here is the script I have for the whole map.
void OnStart()
{
AddUseItemCallback("", "key1", "castle_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key2", "metal_1", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "key3", "castle_3", "UsedKeyOnDoor3", true);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc2" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "ChangeMap", true, 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("key2");
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_3", 0, false);
RemoveItem("key3");
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_1" , true);
}

void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_2" , true);
}

void Changemap(string &in asParent, string &in asChild, int alStates)
{
  ChangeMap("Level2.map", "PlayerStartArea_1", "break_stairs", "water_lurker_eat");
}

void OpenDoor(string &in asParent, string &in asChild, int alState)
{
AddEntityCollideCallback("Player", "ScriptArea_4", "metal_1", true, 1);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
04-21-2011, 12:13 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Script area map change?

void Changemap(string &in asParent, string &in asChild, int alStates)

s is breaking the code.

04-21-2011, 12:16 AM
Website Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#3
RE: Script area map change?

(04-21-2011, 12:16 AM)Tanshaydar Wrote: void Changemap(string &in asParent, string &in asChild, int alStates)

s is breaking the code.

It still doesnt work.
Here is the code.
void OnStart()
{
AddUseItemCallback("", "key1", "castle_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key2", "metal_1", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "key3", "castle_3", "UsedKeyOnDoor3", true);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc2" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "ChangeMap", true, 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("key2");
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_3", 0, false);
RemoveItem("key3");
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_1" , true);
}

void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_2" , true);
}

void Changemap(string &in asParent, string &in asChild, int alState)
{
  ChangeMap("Level2.map", "PlayerStartArea_1", "break_stairs", "water_lurker_eat");
}

void OpenDoor(string &in asParent, string &in asChild, int alState)
{
AddEntityCollideCallback("Player", "ScriptArea_4", "metal_1", true, 1);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
04-21-2011, 12:33 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Script area map change?

I'm sorry that I didn't look through earlier. You have ChangeMap with capital M in collidecallback function, however the function you wrote is with small m.

04-21-2011, 12:40 AM
Website Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#5
RE: Script area map change?

Thank you a ton, it works perfectly.
04-21-2011, 12:47 AM
Find




Users browsing this thread: 1 Guest(s)