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 Help My script doesn't work in my map.
Aquatric Offline
Junior Member

Posts: 7
Threads: 2
Joined: Dec 2012
Reputation: 0
#1
My script doesn't work in my map.

Alright, this is the 2nd post today haha, I am a big newbie LOL. So I've tried in 2 days now to make my script to work, the 00_castle.hps. It still doesn't work. I've tried everything, I made Script Areas in the Level editor named them and everything, I copy and pasted from wiki.. Nothing happends, I can only play on the map just running around opening doors, it's no crash.
Here is my script:

Quote:void OnStart()
{
AddUseItemCallback("", "key_1", "castle_arched01_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("monster_key", "ActivateMonster", true);
AddEntityCollideCallback("Player", "push", "Push", true, 1);
AddEntityCollideCallback("Player", "door_slam", "Slam", true, 1);
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
PlaySoundAtEntity("", "introvoice.ogg.snt", "introvoice", 1, false);

}

void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("pot_explode", 0);
}

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "push", 0, false);
AddPlayerBodyForce(30000, 0, 0, false);
}


void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
SetSwingDoorLocked("castle_1", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "door_scare", 0, false);
}

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

void OnEnter()
{
PlayMusic("introvoice.ogg", true, 0.9, 1.0, 1, true);
}

void OnLeave()
{
StopMusic(1 , 1);
}

Please help, I need help with the Sound and unlocking doors aswell. Both of them doesn't work. Please help!
12-27-2012, 07:15 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: My script doesn't work in my map.

void OnStart()
{
    AddUseItemCallback("", "key_1", "castle_arched01_1", "UsedKeyOnDoor", true);
    SetEntityPlayerInteractCallback("monster_key", "ActivateMonster", true);
    AddEntityCollideCallback("Player", "push", "Push", true, 1);
    AddEntityCollideCallback("Player", "door_slam", "Slam", true, 1);
    AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
    PlaySoundAtEntity("", "introvoice.snt", "introvoice", 1, false);

}

void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("pot_explode", 0);
}

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "push", 0, false);
AddPlayerBodyForce(30000, 0, 0, false);
}


void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
SetSwingDoorLocked("castle_1", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "door_scare", 0, false);
}

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

void OnEnter()
{
    PlayMusic("introvoice.[b]snt[/b]", true, 0.9, 1.0, 1, true);
}

void OnLeave()
{
    StopMusic(1 , 1);
}

Ok, fixed some things. Now, delete .map_cache if you have and check the names. Stuff like that is what causes errors.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-27-2012, 07:31 PM
Find
Aquatric Offline
Junior Member

Posts: 7
Threads: 2
Joined: Dec 2012
Reputation: 0
#3
RE: My script doesn't work in my map.

Hm, check this picture out, I can't find the map_cache
[Image: YJBtq.png]



Ok, so I found those:

00_castle.map_cache
00_castle.hps.map_cache or wat it was called, I deleted them both, opening the game and the script still didn't work, then I checked the folder once again, and the 00_castle.map_cache was there again...
(This post was last modified: 12-27-2012, 07:53 PM by Aquatric.)
12-27-2012, 07:39 PM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#4
RE: My script doesn't work in my map.

Are there any parts of the script that do work? (Like, does the introvoice play when you start the map?) Are you maybe loading the map from a saved position? That can cause some problems for WIP map.

You could add an AddDebugMessage() call to the beginning of each function (and maybe in other interesting places), to see what get's called and what doesn't, so that you can have at least some clue about where the problem could be. Like this:

AddDebugMessage("Inside: <funct_name_here>", false);
(This post was last modified: 12-28-2012, 12:14 AM by TheGreatCthulhu.)
12-28-2012, 12:14 AM
Find
Aquatric Offline
Junior Member

Posts: 7
Threads: 2
Joined: Dec 2012
Reputation: 0
#5
RE: My script doesn't work in my map.

Hey guys! I found out yesterday that I used wrong HPS file at my map LOL what a big mistake. I've been saving the HPS script at the desktop.. Not in the Custom Story folder LOL Big GrinDDD So it works now, but the Introvoice is looping all the time :/ and key unlock door doesn't even work either.
12-28-2012, 03:38 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#6
RE: My script doesn't work in my map.

Make sure that the key and door has the corresponding name.

As for the sound, check the snt file. Loop should be false.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
12-28-2012, 05:31 PM
Find




Users browsing this thread: 1 Guest(s)