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
Level changing area script not working?
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#11
RE: Level changing area script not working?

Do you know what I mean by a function? A function performs a set number of tasks, and all the code it does is enclosed in { and }. Each function declaration starts with void (in general for this game), followed by the function name, which would be ChangeMap for this one, and then the parameters, which would be the parameters of the entitycollide you put. So the function would be:
void Changemap(string &in asParent, string &in asChild, int alStates)
{
   ChangeMap blahblah your changemap thing here;
}

So remember, everything (for this scripting language in this game) has to be in a function.
(This post was last modified: 04-02-2011, 10:20 PM by MrBigzy.)
04-02-2011, 10:16 PM
Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#12
RE: Level changing area script not working?

The map works now, but when I jump into the hole I just fall through the script area and it doesn't change the map. Here is the script:

void OnStart()
{
AddUseItemCallback("", "key1", "castle_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key2", "metal_1", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "key2", "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", "PlayerStartArea_1", "break_stairs", "water_lurker_eat");
}
04-02-2011, 10:33 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#13
RE: Level changing area script not working?

You'll need to put .map at the end of Level2.
04-03-2011, 12:12 AM
Find
Shoop Offline
Junior Member

Posts: 36
Threads: 10
Joined: Feb 2011
Reputation: 0
#14
RE: Level changing area script not working?

Oh, okay thanks everyone so much.
04-03-2011, 12:33 AM
Find




Users browsing this thread: 2 Guest(s)