Can anyone tell me how to trigger special ability using a magic word. I want my PC to have a special ability but I'm stuck, as player character's file format doesnt include them at
all.
Special Ability
Débuté par
ZX_Diablo
, août 17 2011 11:14
#1
Posté 17 août 2011 - 11:14
#2
Posté 17 août 2011 - 11:33
Module properties: OnPlayerChat script.
#3
Posté 17 août 2011 - 11:38
You will want to use the modules OnPlayerChat event and use a script that looks something kinda like so:
void main()
{
string sMessage = GetPCChatMessage();
object oSpeaker = GetPCChatSpeaker();
if (sMessage == "abracadabra" || sMessage == "Abracadabra")
{
if (some other condition)
{
//do stuff for powers here
}
}
if (sMessage == "alakazam" || sMessage == "Alakazam")
{
if (some other condition)
{
//do stuff for powers here
}
}
}
This is pretty generic but it might get you going in the right direction. The OnPlayerChat intercepts the messages that players type in the chat. You will notice I put in a spot for "some other condition" in case you don't want just anybody to be able to blab out a magic word and get powers. They have to say the word and they have to pass some other check. Like being a wizard, or possess an item, etc...
Hope this helps.
void main()
{
string sMessage = GetPCChatMessage();
object oSpeaker = GetPCChatSpeaker();
if (sMessage == "abracadabra" || sMessage == "Abracadabra")
{
if (some other condition)
{
//do stuff for powers here
}
}
if (sMessage == "alakazam" || sMessage == "Alakazam")
{
if (some other condition)
{
//do stuff for powers here
}
}
}
This is pretty generic but it might get you going in the right direction. The OnPlayerChat intercepts the messages that players type in the chat. You will notice I put in a spot for "some other condition" in case you don't want just anybody to be able to blab out a magic word and get powers. They have to say the word and they have to pass some other check. Like being a wizard, or possess an item, etc...
Hope this helps.
#4
Posté 18 août 2011 - 12:47
Thanks guys. I will try it now.
Modifié par ZX_Diablo, 18 août 2011 - 12:47 .
#5
Posté 18 août 2011 - 01:06
It doesn't compile. An error occurs in the compile tab "ERROR: PARSING VARIABLE LIST", and highlights the "string sMessage = GetPCChatMessage();".
#6
Posté 18 août 2011 - 01:11
Are you running 1.69? If so post your script. If not that is probably your problem.
Modifié par GhostOfGod, 18 août 2011 - 01:12 .
#7
Posté 18 août 2011 - 01:50
I am not running 1.69.
#8
Posté 18 août 2011 - 01:52
I have created a "on_playerchat" script, because in my module, there is no "on_playerchat" ...
Modifié par ZX_Diablo, 18 août 2011 - 01:54 .
#9
Posté 18 août 2011 - 02:13
If you don't have the OnPlayeChat event then you are going to have to go old school and use listeners. That is something I have no experience with so someone else will have to help you out with this one. Sorry.
You might want to take a look at this and see if it helps: nwvault.ign.com/View.php
You might want to take a look at this and see if it helps: nwvault.ign.com/View.php
Modifié par GhostOfGod, 18 août 2011 - 02:13 .





Retour en haut






