Difference between revisions of "HPL3/Amnesia: Rebirth/Tutorials/FAQ"

From Frictional Wiki
Jump to navigation Jump to search
(Created)
 
(some formatting)
 
Line 1: Line 1:
 
This article aims to resolve common issues with Rebirth modding.
 
This article aims to resolve common issues with Rebirth modding.
----
+
 
 +
==Scripting==
 +
 
 
'''Q: Where are all the script functions?'''
 
'''Q: Where are all the script functions?'''
  
Line 13: Line 15:
 
People can help you with ideas, but don't expect them to write code for you. Please read as much of the [[HPL3/Amnesia: Rebirth/Scripting|scripting]] articles as possible '''and look at in-game examples''' before asking people to fix basic syntax for you.
 
People can help you with ideas, but don't expect them to write code for you. Please read as much of the [[HPL3/Amnesia: Rebirth/Scripting|scripting]] articles as possible '''and look at in-game examples''' before asking people to fix basic syntax for you.
 
----
 
----
 +
'''Q: How do I play a sound?'''
 +
 +
A: Use the <code>Sound_CreateAtEntity</code> function in your script. Make sure you're using [[HPL3/Scripting/Scripting Guide/Setting up CodeLite|CodeLite]] so it gives you hints on what to type into the function.
 +
----
 +
'''Q: How do I make a timer?'''
 +
 +
A: Use this line: <code>Map_AddTimer("timerName", 1.0f, "Timer_timerName");</code> in your script. Customise the function arguments. The callback function will look like this:
 +
<syntaxhighlight lang="cpp">
 +
void Timer_timerName(const tString&in asTimer)
 +
{
 +
    //your code goes here. It's called when the timer runs out
 +
}
 +
</syntaxhighlight>
 +
 +
==General==
 +
 
'''Q: The player model and animations are broken. What do I do?'''
 
'''Q: The player model and animations are broken. What do I do?'''
  
Line 27: Line 45:
 
* [[HPL3/Amnesia: Rebirth/Tutorials/Ghouls|Ghoul tutorial]]
 
* [[HPL3/Amnesia: Rebirth/Tutorials/Ghouls|Ghoul tutorial]]
 
* [[HPL3/Amnesia: Rebirth/Tutorials/Wraiths|Wraith tutorial]]
 
* [[HPL3/Amnesia: Rebirth/Tutorials/Wraiths|Wraith tutorial]]
----
 
'''Q: How do I play a sound?'''
 
 
A: Use the <code>Sound_CreateAtEntity</code> function in your script. Make sure you're using [[HPL3/Scripting/Scripting Guide/Setting up CodeLite|CodeLite]] so it gives you hints on what to type into the function.
 
----
 
'''Q: How do I make a timer?'''
 
  
A: Use this line: <code>Map_AddTimer("timerName", 1.0f, "Timer_timerName");</code> in your script. Customise the function arguments. The callback function will look like this:
 
<syntaxhighlight lang="cpp">
 
void Timer_timerName(const tString&in asTimer)
 
{
 
    //your code goes here. It's called when the timer runs out
 
}
 
</syntaxhighlight>
 
 
----
 
----
 
'''Q: Custom objects don't show up in the editor/game.'''
 
'''Q: Custom objects don't show up in the editor/game.'''
  
 
A: Make sure you have set up the mod correctly ([[HPL3/Amnesia:_Rebirth/Modding/Creating_a_Mod|Set up guide part 1]] and [[HPL3/Amnesia:_Rebirth/Modding/Setup_Modding_Environment|part 2]]) and that you are using [[HPL3/Amnesia:_Rebirth/Third_Party_Tools/Amnesia:_Rebirth_Mod_Manager|the Rebirth Mod Manager]]. It will automate a few of the steps.
 
A: Make sure you have set up the mod correctly ([[HPL3/Amnesia:_Rebirth/Modding/Creating_a_Mod|Set up guide part 1]] and [[HPL3/Amnesia:_Rebirth/Modding/Setup_Modding_Environment|part 2]]) and that you are using [[HPL3/Amnesia:_Rebirth/Third_Party_Tools/Amnesia:_Rebirth_Mod_Manager|the Rebirth Mod Manager]]. It will automate a few of the steps.

Latest revision as of 23:01, 17 November 2020

This article aims to resolve common issues with Rebirth modding.

Scripting

Q: Where are all the script functions?

A: Firstly, make sure you're using CodeLite. It will reduce the need to search for functions since it gives you hints about existing functions. It will also reduce the number of mistakes you make because it has syntax highlighting. To answer your question directly: Currently CodeLite is the only thing which has all functions, but you can see the core engine functions on this page. The game-specific functions which will interest you the most will be here, but they're currently not fully documented.

TL;DR USE CODELITE


Q: How do I script X to do Y?

A: There aren't tutorials for everything that can be done in the game, or for every basic thing. People can help you with ideas, but don't expect them to write code for you. Please read as much of the scripting articles as possible and look at in-game examples before asking people to fix basic syntax for you.


Q: How do I play a sound?

A: Use the Sound_CreateAtEntity function in your script. Make sure you're using CodeLite so it gives you hints on what to type into the function.


Q: How do I make a timer?

A: Use this line: Map_AddTimer("timerName", 1.0f, "Timer_timerName"); in your script. Customise the function arguments. The callback function will look like this:

void Timer_timerName(const tString&in asTimer)
{
    //your code goes here. It's called when the timer runs out
}

General

Q: The player model and animations are broken. What do I do?

A: You need to enable the player body in a script to make it function properly. Use this line: PlayerBody_SetActive(true); in the Setup section of your script.


Q: How do I remove the bracelet amulet from the inventory?

A: Use this line: Item_RemoveFromInventory(ItemType_GetFirstInInventory("CurseMedallion")); in your script.


Q: How do I make a monster work? / How do I make a monster walk along a path?

A: Check these guides:


Q: Custom objects don't show up in the editor/game.

A: Make sure you have set up the mod correctly (Set up guide part 1 and part 2) and that you are using the Rebirth Mod Manager. It will automate a few of the steps.