
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.







La date/heure actuelle est 01/05/2025 07:42:33
La Bibliothèque de Neverwinter Nights Index du Forum »
La Bibliothèque Binaire du NWScript - Neverwinter Nights
Voir le sujet précédent ¤ Voir le sujet suivant | |
---|---|
Auteur | Message |
Jillmoor Novice Messages: 19 |
Bonjour,
J'ai tout ce qu'il faut pour mon module. Je rajoute les bâtons d'aide mais j'ai du mal à compiler bêtement la ligne qu'il faut rajouter. cela me donne effectivement deux notions getitemactivator et ça ne compile pas bien quelque soit le schéma que j'ai essayé. Voici le script d'artisanat cnr : NWScript :
////////////////////////////// /////////////////////////// // // Craftable Natural Resources (CNR) by Festyx // // Name: cnr_module_onact // // Desc: This script must be run by the module's // OnActivateItem event handler. // // Author: David Bobeck 08Jan03 // ////////////////////////////// /////////////////////////// #include "cnr_recipe_utils" void main() { object oItem = GetItemActivated(); object oActivator = GetItemActivator(); if (CnrRecipeBookOnActivateItem(oItem, oActivator)) { return; } if (CnrJournalOnActivateItem(oItem, oActivator)) { return; } } et voila la ligne que l'on me demande de rajouter dans le onactivate du module pour que les batons fonctionnent : ExecuteScript("dmfi_activate", GetItemActivator()); Ils proposent sinon de mettre le script dmfi_activate directement dans le onactivate du module. Je ne sais pas si cela peut être plus facile à compiler. Je le mets aussi : NWScript :
void dmw_CleanUp(object oMySpeaker) { int nCount; int nCache; DeleteLocalObject(oMySpeaker, "dmfi_univ_target"); DeleteLocalLocation(oMySpeaker, "dmfi_univ_location"); DeleteLocalObject(oMySpeaker, "dmw_item"); DeleteLocalString(oMySpeaker, "dmw_repamt"); DeleteLocalString(oMySpeaker, "dmw_repargs"); nCache = GetLocalInt(oMySpeaker, "dmw_playercache"); for(nCount = 1; nCount <= nCache; nCount++) { DeleteLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nCount)); } DeleteLocalInt(oMySpeaker, "dmw_playercache"); nCache = GetLocalInt(oMySpeaker, "dmw_itemcache"); for(nCount = 1; nCount <= nCache; nCount++) { DeleteLocalObject(oMySpeaker, "dmw_itemcache" + IntToString(nCount)); } DeleteLocalInt(oMySpeaker, "dmw_itemcache"); for(nCount = 1; nCount <= 10; nCount++) { DeleteLocalString(oMySpeaker, "dmw_dialog" + IntToString(nCount)); DeleteLocalString(oMySpeaker, "dmw_function" + IntToString(nCount)); DeleteLocalString(oMySpeaker, "dmw_params" + IntToString(nCount)); } DeleteLocalString(oMySpeaker, "dmw_playerfunc"); DeleteLocalInt(oMySpeaker, "dmw_started"); } void main() { object oItem=GetItemActivated(); object oUser=GetItemActivator(); object oOther=GetItemActivatedTarget(); location lLocation=GetItemActivatedTargetLocation(); string sItemTag=GetTag(oItem); dmw_CleanUp(oUser); if (GetStringLeft(sItemTag, ![]() { //Destroy any existing Voice attached to the user if (GetIsObjectValid(GetLocalObject(oUser, "dmfi_MyVoice"))) { DestroyObject(GetLocalObject(oUser, "dmfi_MyVoice")); FloatingTextStringOnCreature("You have destroyed your previous Voice", oUser, FALSE); } //Set the Voice to interpret language of the appropriate widget string ssLanguage = GetStringRight(sItemTag, 2); if (GetStringLeft(ssLanguage, 1) == "_") ssLanguage = GetStringRight(sItemTag, 1); SetLocalInt(oUser, "hls_MyLanguage", StringToInt(ssLanguage)); SetLocalString(oUser, "hls_MyLanguageName", GetName(oItem)); DelayCommand(1.0f, FloatingTextStringOnCreature("You are speaking " + GetName(oItem) + ". Type /dm [(what you want to say in brackets)]", oUser, FALSE)); object oArea = GetFirstObjectInArea(GetArea(oUser)); while (GetIsObjectValid(oArea)) { if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE && GetLocalInt(oArea, "hls_Listening") && GetDistanceBetween(oUser, oArea) < 20.0f && oArea != GetLocalObject(oUser, "dmfi_MyVoice")) { DeleteLocalObject(oUser, "dmfi_MyVoice"); return; } oArea = GetNextObjectInArea(GetArea(oUser)); } //Create the Voice object oVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", GetLocation(oUser)); //Set the Voice to Autofollow the User AssignCommand(oVoice, ActionForceFollowObject(oUser, 3.0f)); //Set Ownership of the Voice to the User SetLocalObject(oUser, "dmfi_MyVoice", oVoice); return; } if (GetStringLeft(sItemTag, ![]() { if (sItemTag == "dmfi_pc_follow") { if (GetIsObjectValid(oOther)) { FloatingTextStringOnCreature("Now following "+ GetName(oOther),oUser, FALSE); DelayCommand(2.0f, AssignCommand(oUser, ActionForceFollowObject(oOther, 2.0f))); } return; } SetLocalObject(oUser, "dmfi_univ_target", oUser); SetLocalLocation(oUser, "dmfi_univ_location", lLocation); SetLocalString(oUser, "dmfi_univ_conv", GetStringRight(sItemTag, GetStringLength(sItemTag) - 5)); AssignCommand(oUser, ClearAllActions()); AssignCommand(oUser, ActionStartConversation(OBJECT_SELF, "dmfi_universal", TRUE)); return; } if (GetStringLeft(sItemTag, 5) == "dmfi_") { if (!GetIsDM(oUser) && !GetLocalInt(GetModule(), "dmfi_Admin" + GetPCPublicCDKey(oUser)) && !GetLocalInt(oUser, "hls_Listening") && GetIsPC(oUser) && GetLocalInt(GetModule(), "dmfi_DMToolLock")) { FloatingTextStringOnCreature("You cannot use this item." ,oUser, FALSE); SendMessageToAllDMs(GetName(oUser)+ " is attempting to use a DM item."); return; } if (sItemTag == "dmfi_exploder") { if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_afflict"))) CreateItemOnObject("dmfi_afflict", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_dicebag"))) CreateItemOnObject("dmfi_dicebag", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_pc_dicebag"))) CreateItemOnObject("dmfi_pc_dicebag", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_pc_follow"))) CreateItemOnObject("dmfi_pc_follow", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_pc_emote"))) CreateItemOnObject("dmfi_pc_emote", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_dmw"))) CreateItemOnObject("dmfi_dmw", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_emote"))) CreateItemOnObject("dmfi_emote", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_encounter"))) CreateItemOnObject("dmfi_encounter", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_faction"))) CreateItemOnObject("dmfi_faction", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_fx"))) CreateItemOnObject("dmfi_fx", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_music"))) CreateItemOnObject("dmfi_music", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_sound"))) CreateItemOnObject("dmfi_sound", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_voice"))) CreateItemOnObject("dmfi_voice", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_xp"))) CreateItemOnObject("dmfi_xp", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_500xp"))) CreateItemOnObject("dmfi_500xp", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_en_ditto"))) CreateItemOnObject("dmfi_en_ditto", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_mute"))) CreateItemOnObject("dmfi_mute", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_peace"))) CreateItemOnObject("dmfi_peace", oUser); if(!GetIsObjectValid(GetItemPossessedBy(oUser, "dmfi_voicewidget"))) CreateItemOnObject("dmfi_voicewidget", oUser); return; } if (sItemTag == "dmfi_peace") { //This widget sets all creatures in the area to a neutral stance and clears combat. object oArea = GetFirstObjectInArea(GetArea(oUser)); object oP; while (GetIsObjectValid(oArea)) { if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE && !GetIsPC(oArea)) { AssignCommand(oArea, ClearAllActions(TRUE)); oP = GetFirstPC(); while (GetIsObjectValid(oP)) { if (GetArea(oP) == GetArea(oUser)) { ClearPersonalReputation(oArea, oP); SetStandardFactionReputation(STANDARD_FACTION_HOSTILE, 25, oP); SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 91, oP); SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 91, oP); SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 91, oP); } oP = GetNextPC(); } AssignCommand(oArea, ClearAllActions(TRUE)); } oArea = GetNextObjectInArea(GetArea(oUser)); } } if (sItemTag == "dmfi_voicewidget") { object oVoice; //Destroy any existing Voice attached to the user if (GetIsObjectValid(GetLocalObject(oUser, "dmfi_MyVoice"))) { DestroyObject(GetLocalObject(oUser, "dmfi_MyVoice")); FloatingTextStringOnCreature("You have destroyed your previous Voice", oUser, FALSE); } if (GetIsObjectValid(oOther)) { SetLocalObject(oUser, "dmfi_VoiceTarget", oOther); FloatingTextStringOnCreature("You have targeted " + GetName(oOther) + " with the Voice Widget", oUser, FALSE); object oArea = GetFirstObjectInArea(GetArea(oUser)); while (GetIsObjectValid(oArea)) { if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE && GetLocalInt(oArea, "hls_Listening") && GetDistanceBetween(oUser, oArea) < 20.0f && oArea != GetLocalObject(oUser, "dmfi_MyVoice")) { DeleteLocalObject(oUser, "dmfi_MyVoice"); return; } oArea = GetNextObjectInArea(GetArea(oUser)); } //Create the Voice object oVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", GetLocation(oUser)); //Set Ownership of the Voice to the User AssignCommand(oVoice, ActionForceFollowObject(oUser, 3.0f)); SetLocalObject(oUser, "dmfi_MyVoice", oVoice); return; } else { //Create the Voice oVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", lLocation); AssignCommand(oVoice, ActionForceFollowObject(oUser, 3.0f)); SetLocalObject(oUser, "dmfi_VoiceTarget", oVoice); //Set Ownership of the Voice to the User SetLocalObject(oUser, "dmfi_MyVoice", oVoice); DelayCommand(1.0f, FloatingTextStringOnCreature("The Voice is operational", oUser, FALSE)); return; } return; } if (sItemTag == "dmfi_mute") { SetLocalObject(oUser, "dmfi_univ_target", oUser); SetLocalString(oUser, "dmfi_univ_conv", "voice"); SetLocalInt(oUser, "dmfi_univ_int", ![]() ExecuteScript("dmfi_execute", oUser); return; } if (sItemTag == "dmfi_en_ditto") { SetLocalObject(oUser, "dmfi_univ_target", oOther); SetLocalLocation(oUser, "dmfi_univ_location", lLocation); SetLocalString(oUser, "dmfi_univ_conv", "encounter"); SetLocalInt(oUser, "dmfi_univ_int", GetLocalInt(oUser, "EncounterType")); ExecuteScript("dmfi_execute", oUser); return; } if (sItemTag == "dmfi_500xp") { SetLocalObject(oUser, "dmfi_univ_target", oOther); SetLocalLocation(oUser, "dmfi_univ_location", lLocation); SetLocalString(oUser, "dmfi_univ_conv", "xp"); SetLocalInt(oUser, "dmfi_univ_int", 53); ExecuteScript("dmfi_execute", oUser); return; } SetLocalObject(oUser, "dmfi_univ_target", oOther); SetLocalLocation(oUser, "dmfi_univ_location", lLocation); SetLocalString(oUser, "dmfi_univ_conv", GetStringRight(sItemTag, GetStringLength(sItemTag) - 5)); AssignCommand(oUser, ClearAllActions()); AssignCommand(oUser, ActionStartConversation(OBJECT_SELF, "dmfi_universal", TRUE)); } } Merci si vous pouvez m'éclairer |
Revenir en haut | ![]() ![]() ![]() |
maremick Acolyte ![]() Messages: 25 |
Si tu ajoutes un ExecuteScript, peut-être qu'il faut d'abord compiler le script exécuté avant. Tu as vérifié qu'il compilait ?
|
Revenir en haut | ![]() ![]() ![]() |
Jillmoor Novice Messages: 19 |
Il avait effectivement un petit soucis. J'ai supprimé quelques lignes en espérant que ça ne cassera pas tout...on verra bien.
Par contre, la ligne supplémentaire à ajouter, où vaut-il mieux la mettre dans le petit script et pourquoi, je ne suis pas bon scripteur et j'essaye de comprendre comment ça marche. Merci pour ce premier pas, peux-tu m'indiquer comment franchir le deuxième ? |
Revenir en haut | ![]() ![]() ![]() |
maremick Acolyte ![]() Messages: 25 |
Je devine que dans ton OnActiveItem, ce qui y est déjà n'a aucun rapport. Mais je vois pas du tout à quoi ça correspond. Je débute un peu sur cet événement.
Moi je les fait comme ça : NWScript :
////////////////////////////// /////////////////////////// // // Craftable Natural Resources (CNR) by Festyx // // Name: cnr_module_onact // // Desc: This script must be run by the module's // OnActivateItem event handler. // // Author: David Bobeck 08Jan03 // ////////////////////////////// /////////////////////////// #include "cnr_recipe_utils" void main() { object oItem = GetItemActivated(); object oActivator = GetItemActivator(); string sItem = GetTag(oItem); if (sItem == "tagdetonbaton") ExecuteScript("dmfi_activate", oActivator); if (CnrRecipeBookOnActivateItem(oItem, oActivator)) { return; } if (CnrJournalOnActivateItem(oItem, oActivator)) { return; } } Essais ça en remplaçant "tagdetonbaton" par le tag de l'objet activé. |
Revenir en haut | ![]() ![]() ![]() |
Jillmoor Novice Messages: 19 |
Merci beaucoup,
avec les indications, j'ai pu mieux positionner ma ligne à ajouter. Quand on ne sait pas où ça doit aller début, milieu, fin avant ou après les conditions, .... c'est dur. Comme ça lance un script je n'ai pas eu besoin de mettre une condition je l'ai donc mis juste après la déclaration de variables et avant les if. Ca donne ça : NWScript :
////////////////////////////// /////////////////////////// // // Craftable Natural Resources (CNR) by Festyx // // Name: cnr_module_onact // // Desc: This script must be run by the module's // OnActivateItem event handler. // // Author: David Bobeck 08Jan03 // ////////////////////////////// /////////////////////////// #include "cnr_recipe_utils" void main() { object oItem = GetItemActivated(); object oActivator = GetItemActivator(); ExecuteScript("dmfi_activate", oActivator); if (CnrRecipeBookOnActivateItem(oItem, oActivator)) { return; } if (CnrJournalOnActivateItem(oItem, oActivator)) { return; } } C'est en fait un stock de bâtons et d'aides diverses qui permettent de faire plein de choses en cours de jeu en MJ. Je m'en vais modifier tout ça, changer les musiques, essayer de pouvoir changer les ciels, .... Merci encore et à bientôt |
Revenir en haut | ![]() ![]() ![]() |
maremick Acolyte ![]() Messages: 25 |
Si c'est juste le mj qui execute ce script, tu devrai mettre ça :
NWScript :
////////////////////////////// /////////////////////////// // // Craftable Natural Resources (CNR) by Festyx // // Name: cnr_module_onact // // Desc: This script must be run by the module's // OnActivateItem event handler. // // Author: David Bobeck 08Jan03 // ////////////////////////////// /////////////////////////// #include "cnr_recipe_utils" void main() { object oItem = GetItemActivated(); object oActivator = GetItemActivator(); if (GetIsDM(oActivator)) ExecuteScript("dmfi_activate", oActivator); if (CnrRecipeBookOnActivateItem(oItem, oActivator)) { return; } if (CnrJournalOnActivateItem(oItem, oActivator)) { return; } } Ca t'évitera d'executer le script à chaques fois qu'un objet est activé. Surtout qu'il a l'air costaud ton script. |
Revenir en haut | ![]() ![]() ![]() |


Page 1 sur 1 ¤
Vous ne pouvez pas poster de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas voter dans les sondages de ce forum