Frictional Games Forum (read-only)

Full Version: Teleporting-Naked-Guy Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
So I wanted my script to run a function that will activate and launch a corpse out of a cabinet once the player gets killed by a patrolling grunt. Once I die and enter my script area infront of the cabinet nothing happens.

Code:
/////////////////////////////////////////////////////////////////////////////////////////

// On map start //
void OnStart()
{
    AddUseItemCallback("", "Storage_Room_Key", "Storage_Room_Door", "Open_Storage_Room", true);
    // Storage Room Key //
    AddEntityCollideCallback("Player", "poofer_spawn_01", "poofer_spawn_script_01", true, 1);
}

void poofer_spawn_script_01(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("*C1", "*C1_spawn", "*FunctionToCall*", "DeathHints", "Hide");

   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_1", 0.001, "");
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_2", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_3", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_4", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_5", 0.001, "");
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_6", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_7", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_8", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_9", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_10", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_11", 0.001, "");    
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_12", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_13", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_14", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_15", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_16", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_17", 0.001, "");  
   AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_18", 1.000, "");
   SetEntityActive("poofer_grunt_01", true);
}

void FunctionToCall(string &in asName, int alCount)
{
AddEntityCollideCallback("Player", "Teleport_Script", "Nail_That_Sucker01", true, 1);
}

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

void Nail_That_Sucker01(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("Naked_Guy01", true);
    AddPropForce("Naked_Guy01", -10000, 0, 0, "world");
    PlaySoundAtEntity("", "24_iron_maiden.snt", "Naked_Guy01", 0, false);
}

// On Entering map //
void OnEnter()
{

}
// On Leaving map //
void OnLeave()
{

}
...


RETHINK YOUR LIFE'S DECISION.
Okk? Fuck you too then, I thought this was a forum for help not a "Lets all crucify the guy on his first map" forum
Oh, come on people, while I agree that it's a very cheap and bad jumpscare, let this guy do whatever he wants, it's his CS...

I think it will be fixed with this:


/////////////////////////////////////////////////////////////////////////////////////////

// On map start //
void OnStart()
{
AddUseItemCallback("", "Storage_Room_Key", "Storage_Room_Door", "Open_Storage_Room", true);
// Storage Room Key //
AddEntityCollideCallback("Player", "poofer_spawn_01", "poofer_spawn_script_01", true, 1);
}

void poofer_spawn_script_01(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("C1", "C1_spawn", "FunctionToCall*", "DeathHints", "Hide");

AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_1", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_2", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_3", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_4", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_5", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_6", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_7", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_8", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_9", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_10", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_11", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_12", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_13", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_14", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_15", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_16", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_17", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_18", 1.000, "");
SetEntityActive("poofer_grunt_01", true);
}

void FunctionToCall(string &in asName, int alCount)
{
AddEntityCollideCallback("Player", "Teleport_Script", "Nail_That_Sucker01", true, 1);
}

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

void Nail_That_Sucker01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Naked_Guy01", true);
AddPropForce("Naked_Guy01", -10000, 0, 0, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Naked_Guy01", 0, false);
}

// On Entering map //
void OnEnter()
{

}
// On Leaving map //
void OnLeave()
{

}


THIS IS THE SCRIPT, IGNORE THE PREVIOUS

/////////////////////////////////////////////////////////////////////////////////////////

// On map start //
void OnStart()
{
AddUseItemCallback("", "Storage_Room_Key", "Storage_Room_Door", "Open_Storage_Room", true);
// Storage Room Key //
AddEntityCollideCallback("Player", "poofer_spawn_01", "poofer_spawn_script_01", true, 1);
}

void poofer_spawn_script_01(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("C1", "C1_spawn", "FunctionToCall", "DeathHints", "Hide");

AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_1", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_2", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_3", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_4", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_5", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_6", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_7", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_8", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_9", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_10", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_11", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_12", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_13", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_14", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_15", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_16", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_17", 0.001, "");
AddEnemyPatrolNode("poofer_grunt_01", "PathNodeArea_18", 1.000, "");
SetEntityActive("poofer_grunt_01", true);
}

void FunctionToCall(string &in asName, int alCount)
{
AddEntityCollideCallback("Player", "Teleport_Script", "Nail_That_Sucker01", true, 1);
}

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

void Nail_That_Sucker01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Naked_Guy01", true);
AddPropForce("Naked_Guy01", -10000, 0, 0, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Naked_Guy01", 0, false);
}

// On Entering map //
void OnEnter()
{

}
// On Leaving map //
void OnLeave()
{

}
Nope, that doesnt work either

ok, im trying the second one.

Still doesnt work.
We all start somewhere, and even if you have original ideas you start by learning the tech.

My first ever map was for Duke Nukem 3D and was just a big room full of strippers and tripwire bombs. That was cheap. The Trapdoor has a naked corpse in a closet. The reason: it was my first Amnesia mod/CS and I'd only ever played highly rated mods previously - I wasn't aware of the clichés. Although, he doesn't actually fly out.

CQB, my advice is to make your flying naked guy and your poofers. Enjoy it, use it as a learning experience and then take what you've learned and use the knowledge to create original set pieces.
I'm in my mobile so sorry if theres any typo:

By what i see, the script doesnt crash, its just that the corpse doesnt spawn. Does the sound play?

If it doesnt, check names: its very easy to make mistakes or typos. (Remain to save everytime, i once were 2 hours wondering why my code didnt work and I hadnt saved it)

Well said, Behemoth Smile
Nope the sound doesnt play, Im thinking it might just be an issue with it triggering as from the checkpoint's function callback. Im making another map ATM and just coding the jumpscare using the same code (Just the jumpscare codes, nothing else) To see if that works.
Yeah, if the sound doesnt play it must be the callback. Remain to remove any .map_cache if there is.
Wrote a new code on a different map
Code:
void OnStart ()
{
    AddEntityCollideCallback("Player", "TeleportScript", "NailThatSucker", true, 1);
}

void NailThatSucker(string &in asParent, string &in asChild, int alStates)
{
    SetEntityActive("Naked_Guy", true);
    AddPropForce("Naked_Guy", -10000, 0, 0, "world");
    PlaySoundAtEntity("", "24_iron_maiden.snt", "Naked_Guy", 0, false)
}

Still doesnt work.
Pages: 1 2 3