Adding items to the player data menu basically adds a link to a custom conversation. Suppose I want to allow the player to make a skill check from a conversation, and I want to let them access the conversation easily from the player data item. I first need to create my custom conversation, which I'll save as "sc_skillcheck":
Then, I need to create a hook-in script to add a link to my new conversation to the player data item menu:
#include "h2_core_i"
void main()
{
h2_AddPlayerDataMenuItem("Roll a skill check.", "sc_skillcheck");
}
The first parameter in the h2_AddPlayerDataMenuItem() function is the text I want to display to the player. The second parameter is the name of the conversation I want to link to. I'll save this script as "sc_moduleload".
Now we need to make this script load when the module loads. Close the script editor and go to Edit -> Module Properties. Click the Advanced tab, then click the little button next to Variables. Add a string variable named "OnModuleLoad2" (or whatever the next number in the sequence is) and make its value say "sc_moduleload" (without the quotes):
Click OK. Save your module and go test it.
If you did everything right, you should see your new menu item whenever you use your player data item:
Don't forget to click it and make sure it links to the right conversation:
Hope this helps!
'>
Modifié par Squatting Monk, 21 juin 2012 - 04:51 .