http://fougerite.com/wiki/on-research/In general, I do the abolition of study - but study passes - repair it?
C#:re.Cancel()
And they did not discover something new ...
public static void PerResearch(ResearchEvent re)
{
IniParser Settings = new IniParser(Path.Combine(Loader.Folder + "\\item", re.ItemName + ".ac"));
if (Settings.GetSetting(re.ItemName, "isResearchable") == "false")
{
re.Cancel();
re.Player.Message("Don't Research");
}
}
Maybe your ini file has incorrect ItemNames?And they did not discover something new ...
Sms comes - but study is being studiedC#:public static void PerResearch(ResearchEvent re) { IniParser Settings = new IniParser(Path.Combine(Loader.Folder + "\\item", re.ItemName + ".ac")); if (Settings.GetSetting(re.ItemName, "isResearchable") == "false") { re.Cancel(); re.Player.Message("Don't Research"); } }
I already made a plugin with that, it works perfectly .... I can give you the code when it is on my pc .... Now I'm with my mobile phone xdAnd they did not discover something new ...
Sms comes - but study is being studiedC#:public static void PerResearch(ResearchEvent re) { IniParser Settings = new IniParser(Path.Combine(Loader.Folder + "\\item", re.ItemName + ".ac")); if (Settings.GetSetting(re.ItemName, "isResearchable") == "false") { re.Cancel(); re.Player.Message("Don't Research"); } }
Is the hook being called, Did you change the hook name?And they did not discover something new ...
Sms comes - but study is being studiedC#:public static void PerResearch(ResearchEvent re) { IniParser Settings = new IniParser(Path.Combine(Loader.Folder + "\\item", re.ItemName + ".ac")); if (Settings.GetSetting(re.ItemName, "isResearchable") == "false") { re.Cancel(); re.Player.Message("Don't Research"); } }
Yes messages are coming - and do not hold me for a stupid newbie - there really are some problems with the hookIs the hook being called, Did you change the hook name?
Wtf !!Yes messages are coming - and do not hold me for a stupid newbie - there really are some problems with the hook
public void OnResearch(ResearchEvent re)
{
if (re.ItemName == "M4")
{
re.Player.Message("You cant craft M4, regards!!");
re.Cancel();
}
}
I used this codeP.S. Maybe this thread is better posted here?
http://fougerite.com/forums/plugin-development-support.14/
public override void Initialize()
{
Hooks.OnResearch += Hooks_OnResearch;
}
private void Hooks_OnResearch(ResearchEvent re)
{
re.Cancel();
}
what??? your code is bad!! try this...I used this code
In the end, I get such a picture - the study does NOT appear in the crafts menu, but the message appears that the craft is passed + one is removed. Research Kit 1Code:public override void Initialize() { Hooks.OnResearch += Hooks_OnResearch; } private void Hooks_OnResearch(ResearchEvent re) { re.Cancel(); }
public override void Initialize()
{
Fougerite.Hooks.OnResearch += OnResearch;
}
public override void DeInitialize()
{
Fougerite.Hooks.OnResearch -= OnResearch;
}
public void OnResearch(ResearchEvent re)
{
if (re.ItemName == "M4")
{
re.Player.Message("You cant craft M4, regards!!");
re.Cancel();
//Also return research kit..
re.Player.Inventory.AddItem("Research Kit 1",1);
return;
}
}
Well, if the player had a set for several uses? Yes and anyway, the report of a successful study comeswhat??? your code is bad!! try this...
regards!!C#:public override void Initialize() { Fougerite.Hooks.OnResearch += OnResearch; } public override void DeInitialize() { Fougerite.Hooks.OnResearch -= OnResearch; } public void OnResearch(ResearchEvent re) { if (re.ItemName == "M4") { re.Player.Message("You cant craft M4, regards!!"); re.Cancel(); //Also return research kit.. re.Player.Inventory.AddItem("Research Kit 1",1); return; } }
But ... does it work for you ???? Why do you see everything so negative ???Well, if the player had a set for several uses? Yes and anyway, the report of a successful study comes
Because the players will get confused - I have a changed craft craft, when people want to learn craft paper they write in the chat that "you have successfully studied the recipe of paper", although it is forbiddenBut ... does it work for you ???? Why do you see everything so negative ???
I showed you the same complete code ...
public override void Initialize()
{
Fougerite.Hooks.OnResearch += OnResearch;
}
public override void DeInitialize()
{
Fougerite.Hooks.OnResearch -= OnResearch;
}
public void OnResearch(ResearchEvent re)
{
if (re.ItemName == "Paper")
{
re.Player.Message("You cant craft Paper - Prohibited object for a while!!");
re.Cancel();
}
}
Because you must make a return; ...... "I explain it to you above xdI showed you the same complete code ...
Code:public override void Initialize() { Fougerite.Hooks.OnResearch += OnResearch; } public override void DeInitialize() { Fougerite.Hooks.OnResearch -= OnResearch; } public void OnResearch(ResearchEvent re) { if (re.ItemName == "Paper") { re.Player.Message("You cant craft Paper - Prohibited object for a while!!"); re.Cancel(); } }
if (re.ItemName == "Paper")
{
re.Player.Message("You cant craft Paper - Prohibited object for a while!!");
re.Cancel();
//TRY ADD RETURN
return;
}