La Bibliothèque de Neverwinter Nights
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
FAQ
Rechercher
Liste des Membres
Groupes d'utilisateurs
S'enregistrer Se connecter pour vérifier ses messages privés Connexion
S'enregistrer Se connecter pour vérifier ses messages privés Connexion
La date/heure actuelle est 23/11/2024 12:52:48
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 |
Attention ! | Vous êtes en train de lire un message hors de son contexte. Veuillez lire le sujet [résolu !] Script pour lanceur de sort pnj en entier avant de répondre à ce message. |
Noon Héros Messages: 272 Localisation: Entre Vannes et les RO |
Salut, j'avais trouvé un système un peu différent sur le Vault pour faire des contingences (les sorts se lancent dès qu'il voit une créature, j'ai rajouté les sorts des addons):
NWScript :
//://////////////////////////////////////////////
Le code a colorer syntaxiquement est trop long (plus de 10240 caractères) et risque de ne pas s'afficher du tout. Vous pouvez le voir en version colorée ici.//:: Pseudo Contingency Script!!!! //:: Used to buff up those mages a bit before combat.. //:: 01/12/03, by BrianDahlquist/Plas //:///////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /* Instructions: Put this Script in the SpellCasters :OnPerception: script. Give the caster a Tag in the format PCS_XX_YY_ZZ, where XX,YY,ZZ = All integers, between 00-31, to pick which spell is cast when the wizard sees a hostile player. Tag MUST be full 12 characters long. If you only want to cast one or two spells, put in '00' for the parameter. 00 = Cast no Spell. //Level One Spells 01 = MageArmor 02 = ProtectionFromLaw 41 = Shield //Level Two Spells 03 = ResistElements 04 = CatsGrace 05 = Endurance 06 = Ghostly Visage 07 = See Invisibility 32 = invisibility //Level Three Spells 08 = Haste 09 = MagicCircleAgainst Good 10 = ProtectionFromElements 33 = Massinv //Level Four Spells 11 = ImprovedInvis 12 = MinorGlobeOfInvulnerability 13 = PolyMorph Self 14 = StoneSkin //Level Five Spells 15 = ElementalShield 16 = EnergyBuffer 17 = LesserSpellMantle 42 = MestilsAcidSheath //Level SixSpells 18 = EtherealVisage 19 = GlobeOfInvulnerability 20 = GreaterStoneSkin 21 = MassHaste 22 = TensersTransformation 23 = TrueSeeing //Level Seven Spells 24 = ProtectionFromSpells 25 = ShadowShield 26 = SpellMantle //Level EightSpells 27 = MindBlank 28 = Premonition //Level NineSpells 29 = GreaterSpellMantle 30 = ShapeChange 31 = TimeStop //LeveL Priest 34 = Aid 35 = Bless 36 = Divine Power 37 = Prayer 38 = regenerate //LeveL Epic 39 = Epicwarding 40 = MageArmor */ //////////////////////////////////////////////////////////////////////////////// #include "NW_O2_CONINCLUDE" #include "NW_I0_GENERIC" void CastContingencySpell(int SpellNumber) { switch(SpellNumber) { case 00: break; //level 1 spells case 1: ActionCastSpellAtObject(SPELL_MAGE_ARMOR,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 2: ActionCastSpellAtObject(SPELL_PROTECTION_FROM_LAW,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 41: ActionCastSpellAtObject(SPELL_SHIELD,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //level 2 spells case 3: ActionCastSpellAtObject(SPELL_RESIST_ELEMENTS,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 4: ActionCastSpellAtObject(SPELL_CATS_GRACE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 5: ActionCastSpellAtObject(SPELL_ENDURANCE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 6: ActionCastSpellAtObject(SPELL_GHOSTLY_VISAGE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 32: ActionCastSpellAtObject(SPELL_INVISIBILITY,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 7: ActionCastSpellAtObject(SPELL_SEE_INVISIBILITY,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); ActionCastSpellAtObject(SPELL_PROTECTION_FROM_LAW,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 3 SPells case 8: ActionCastSpellAtObject(SPELL_HASTE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 9: ActionCastSpellAtObject(SPELL_MAGIC_CIRCLE_AGAINST_GOOD,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 10: ActionCastSpellAtObject(SPELL_PROTECTION_FROM_ELEMENTS,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 33: ActionCastSpellAtObject(SPELL_INVISIBILITY_SPHERE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 44: ActionCastSpellAtObject(SPELL_DISPLACEMENT,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 4 Spells case 11: ActionCastSpellAtObject(SPELL_IMPROVED_INVISIBILITY,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 12: ActionCastSpellAtObject(SPELL_MINOR_GLOBE_OF_INVULNERABILITY,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 13: ActionCastSpellAtObject(SPELL_POLYMORPH_SELF,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 14: ActionCastSpellAtObject(SPELL_STONESKIN,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 5 Spells case 15: ActionCastSpellAtObject(SPELL_ELEMENTAL_SHIELD,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 16: ActionCastSpellAtObject(SPELL_ENERGY_BUFFER,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 17: ActionCastSpellAtObject(SPELL_LESSER_SPELL_MANTLE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 42: ActionCastSpellAtObject(SPELL_MESTILS_ACID_SHEATH,OBJECT_SELF,METAMAGIC_ANY,TRUE,28,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 6 Spells case 18: ActionCastSpellAtObject(SPELL_ETHEREAL_VISAGE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 19: ActionCastSpellAtObject(SPELL_GLOBE_OF_INVULNERABILITY,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 20: ActionCastSpellAtObject(SPELL_GREATER_STONESKIN,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 21: ActionCastSpellAtObject(SPELL_MASS_HASTE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 22: ActionCastSpellAtObject(SPELL_TENSERS_TRANSFORMATION,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 23: ActionCastSpellAtObject(SPELL_TRUE_SEEING,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 7 Spells case 24: ActionCastSpellAtObject(SPELL_PROTECTION_FROM_SPELLS,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 25: ActionCastSpellAtObject(SPELL_SHADOW_SHIELD,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 26: ActionCastSpellAtObject(SPELL_SPELL_MANTLE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 8 SPells case 27: ActionCastSpellAtObject(SPELL_MIND_BLANK,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 28: ActionCastSpellAtObject(SPELL_PREMONITION,OBJECT_SELF,METAMAGIC_ANY,TRUE,25,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level 9 Spells case 29: ActionCastSpellAtObject(SPELL_GREATER_SPELL_MANTLE,OBJECT_SELF,METAMAGIC_ANY,TRUE,28,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 30: ActionCastSpellAtObject(SPELL_SHAPECHANGE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 31: ActionCastSpellAtObject(SPELL_TIME_STOP,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; //Level Priest case 35: ActionCastSpellAtObject(SPELL_BLESS,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 34: ActionCastSpellAtObject(SPELL_AID,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 36: ActionCastSpellAtObject(SPELL_DIVINE_POWER,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 37: ActionCastSpellAtObject(SPELL_PRAYER,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 38: ActionCastSpellAtObject(SPELL_REGENERATE,OBJECT_SELF,METAMAGIC_ANY,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 43: ActionUseFeat(FEAT_DIVINE_SHIELD,OBJECT_SELF); break; //LeveL Epic case 39: ActionCastSpellAtObject(695,OBJECT_SELF,METAMAGIC_ANY,TRUE,28,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; case 40: ActionCastSpellAtObject(SPELL_EPIC_MAGE_ARMOR,OBJECT_SELF,METAMAGIC_ANY,TRUE,28,PROJECTILE_PATH_TYPE_DEFAULT,TRUE); break; } } void main() { ////////////////////////////////////////////////////////////////////////////////// // This Section Has The Default Bioware OnPerception Script -nw_c2_default2-. I // did NOT write this, and do NOT take credit for it. Only thier for proper AI // reactions. ////////////////////////////////////////////////////////////////////////////////// //If the last perception event was hearing based or if someone vanished then go to search mode if ((GetLastPerceptionVanished()) && GetIsEnemy(GetLastPerceived())) { object oGone = GetLastPerceived(); if((GetAttemptedAttackTarget() == GetLastPerceived() || GetAttemptedSpellTarget() == GetLastPerceived() || GetAttackTarget() == GetLastPerceived()) && GetArea(GetLastPerceived()) != GetArea(OBJECT_SELF)) { ClearAllActions(); DetermineCombatRound(); } } //Do not bother checking the last target seen if already fighting else if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget())) { //Check if the last percieved creature was actually seen if(GetLastPerceptionSeen()) { if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL)) { DetermineSpecialBehavior(); } else if(GetIsEnemy(GetLastPerceived())) { if(!GetHasEffect(EFFECT_TYPE_SLEEP)) { SetFacingPoint(GetPosition(GetLastPerceived())); SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK); DetermineCombatRound(); } } //Linked up to the special conversation check to initiate a special one-off conversation //to get the PCs attention else if(GetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION) && GetIsPC(GetLastPerceived())) { ActionStartConversation(OBJECT_SELF); } } } if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT) && GetLastPerceptionSeen()) { SignalEvent(OBJECT_SELF, EventUserDefined(1002)); } //////////////////////////////////////////////////////////////////////////////// // End of Bioware Default Script. // Now Goes through the SelectionProcess of filtering out the Other creatures // And Finding out WHat Spells to Cast. //////////////////////////////////////////////////////////////////////////////// object oNoticed = GetLastPerceived(); int DoOnce = GetLocalInt(OBJECT_SELF,"ContCheck"); //Will Cast it when Wizard Sees an Object of A different Faction. if( !GetFactionEqual(oNoticed,OBJECT_SELF)&&GetLastPerceptionSeen() ) { SetLocalInt(OBJECT_SELF,"ContCheck",1); //So we dont Cast the spells for EVERY hostile Player string CreatureTag = GetTag(OBJECT_SELF); //Get the Tag of the Creature. int StringTagLength = GetStringLength(CreatureTag); //Get the TagLength. string CastCheck = GetSubString(CreatureTag, 0,3); //Get first 3 figures in tag, to Verify it starts with SC //only run the script if the first letters in the Tag are PCS,and the taglength is 12.Just to make sure //that people actually REMEMBER to change the tag name, and put enough parameters in it. if((CastCheck == "PCS")&&(StringTagLength==12)) { ClearAllActions(); //disect each part of the Tag - each of the three spells, and the visual. int Spell1 = StringToInt(GetSubString(CreatureTag,4,2)); int Spell2 = StringToInt(GetSubString(CreatureTag,7,2)); int Spell3 = StringToInt(GetSubString(CreatureTag,10,2)); //CastTheSpells Themselves. CastContingencySpell(Spell1); CastContingencySpell(Spell2); CastContingencySpell(Spell3); SpeakString ("Declencheur de sort"); } } } A mettre dans le OnPerception des PNJ hostiles, les neutres se mettant à t'attaquer sans devenir hostiles. => Ou alors à la fin d'un dialogue avec un changement de faction du PNJ pour qu'il attaque à la fin. Attention, tel quel, si le script est dans le OnPreception, il se relance dès que le PJ invoque un allié. _________________ Beshaba me protège, Tymora guide mes tirs. The Cake is a lie ! Mes modules NwN2:De Vieilles Rencontres! et De Vieilles Rencontres2 Double Avenir sur le Nwvault |
Revenir en haut | |
La Bibliothèque de Neverwinter Nights Index du Forum »
La Bibliothèque Binaire du NWScript - Neverwinter Nights
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