CamDawg Posted August 25, 2017 Posted August 25, 2017 NPCLEVEL only works for NPCs in the .gam file, so you're looking at more pain than you realize--certainly a lot more than your original problem--as you would have to add the NPCs to the .gam file and then find and disable their scripted spawns. Quote
subtledoctor Posted August 25, 2017 Author Posted August 25, 2017 Oof, forget that. Okay, back to just giving everyone an "increment proficiencies by dialog" ability. Or a "drop me to level 1" ability. Quote
subtledoctor Posted September 1, 2017 Author Posted September 1, 2017 Really close to allowing NPCs to fill out their proficiencies by dialogue, but having a bit of trouble. The innate ability summons a creature, and teh creature runs a script that includes this (in part): IF NumTimesTalkedTo(0) CLASS(LastSummonerOf(Myself),DRUID) CLASS(LastSummonerOf(Myself),FIGHTER_DRUID) THEN RESPONSE #100 SetGlobal("D5_DRUID","GLOBAL",1) END IF NumTimesTalkedTo(0) THEN RESPONSE #100 SetGlobal("D5_WEPPR","GLOBAL",1) SetNumTimesTalkedTo(1) ActionOverride(LastSummonerOf(Myself),StartDialogOverride("d5_weppr",Myself)) END IF True() THEN RESPONSE #100 SetGlobal("D5_WEPPR","GLOBAL",0) SetGlobal("D5_DRUID","GLOBAL",0) SetNumTimesTalkedTo(0) DestroySelf() // reset global variables, then destroy self END (Plus more global variables for different classes.) And the dialogue includes this: BEGIN ~D5_WEPPR~ IF ~Global("D5_WEPPR","GLOBAL",1)~ THEN BEGIN d5_weppr SAY @12352 IF ~GlobalLT("D5_THIEF","GLOBAL",1) GlobalLT("D5_MAGE","GLOBAL",1) GlobalLT("D5_DRUID","GLOBAL",1) GlobalLT("D5_CLERIC","GLOBAL",1) GlobalLT("D5_MONK","GLOBAL",1) CheckStatLT(myself,1,"PROFICIENCYTWOHANDEDSWORD")~ THEN REPLY @12301 GOTO d5_weppr_1 IF ~GlobalLT("D5_MAGE","GLOBAL",1) GlobalLT("D5_DRUID","GLOBAL",1) GlobalLT("D5_CLERIC","GLOBAL",1) CheckStatLT(myself,1,"PROFICIENCYLONGSWORD")~ THEN REPLY @12303 GOTO d5_weppr_2 IF ~GlobalLT("D5_MAGE","GLOBAL",1) GlobalLT("D5_CLERIC","GLOBAL",1) CheckStatLT(myself,1,"PROFICIENCYSCIMITARWAKISASHININJATO")~ THEN REPLY @12305 GOTO d5_weppr_3 ... IF ~~ THEN BEGIN d5_weppr_1 SAY @12301 IF ~~ THEN REPLY @12329 DO ~ApplySpellRES("D5P2SWO",myself)~ EXIT IF ~~ THEN REPLY @12330 GOTO d5_weppr END The idea being, Jaheira shouldn't be able to use this to gain proficiency in 2-handed swords (she can't equip them, anyway). But when she uses the innate ability, the filter isn't working, and she can choose 2-handed swords. Can anybody see why? Quote
Mike1072 Posted September 1, 2017 Posted September 1, 2017 You forgot an OR for detecting DRUID/FIGHTER_DRUID. Quote
subtledoctor Posted September 1, 2017 Author Posted September 1, 2017 Ah. Duh. I'm rubbish with scripting. So it should look like this? IF NumTimesTalkedTo(0) OR(2) CLASS(LastSummonerOf(Myself),DRUID) CLASS(LastSummonerOf(Myself),FIGHTER_DRUID) THEN RESPONSE #100 SetGlobal("D5_DRUID","GLOBAL",1) END Quote
Roxanne Posted September 1, 2017 Posted September 1, 2017 (edited) Ah. Duh. I'm rubbish with scripting. So it should look like this? IF NumTimesTalkedTo(0) OR(2) CLASS(LastSummonerOf(Myself),DRUID) CLASS(LastSummonerOf(Myself),FIGHTER_DRUID) THEN RESPONSE #100 SetGlobal("D5_DRUID","GLOBAL",1) END Yes maybe better to use IF NumTimesTalkedTo(0) Global("D5_DRUID","LOCALS",0) OR(2) CLASS(LastSummonerOf(Myself),DRUID) CLASS(LastSummonerOf(Myself),FIGHTER_DRUID) THEN RESPONSE #100 SetGlobal("D5_DRUID","LOCALS",1) END Otherwise, you set a global for all NPCs in the whole game, while maybe the idea is to make the same function available for another Druid as well? Or you reset the global to 0 after the whole operation for one NPC? Edited September 1, 2017 by Roxanne Quote
subtledoctor Posted September 1, 2017 Author Posted September 1, 2017 (edited) After the dialogue is finished and kicks back out to the script, the globals are set to 0 and the invisible script creature destroys itself. I'm not sure about using locals, because the script is run by the creature... so would the local variable be set on the creature? Whereas, the dialogue is started by the creature's LastSummonerOf, so locals checks in the dialogue might return false even when they should be true. EDIT - I suppose I could use ActionOverride to set the local variable on the LastSummonerOf (?)... but that seems like overkill. Global seems fine since they are only ever non-zero in the few seconds while the dialogue is active. Edited September 1, 2017 by subtledoctor Quote
Roxanne Posted September 1, 2017 Posted September 1, 2017 After the dialogue is finished and kicks back out to the script, the globals are set to 0 and the invisible script creature destroys itself. I'm not sure about using locals, because the script is run by the creature... so would the local variable be set on the creature? Whereas, the dialogue is started by the creature's LastSummonerOf, so locals checks in the dialogue might return false even when they should be true. EDIT - I suppose I could use ActionOverride to set the local variable on the LastSummonerOf (?)... but that seems like overkill. Global seems fine since they are only ever non-zero in the few seconds while the dialogue is active. Setting the global back to 0 should do it. It just was not visible from the one code snippet, but in context it should work, also it was not clear that it was an invisible helper running the script, although I was assuming as much. Quote
subtledoctor Posted September 1, 2017 Author Posted September 1, 2017 Can that be done within a dialogue too? I.e., to allow a player to move to 4 stars in shortbows only if 1) they already have 3 stars, and 2) they are either a fighter or an archer: IF ~OR(2) Class(myself,FIGHTER) Global("D5_ARCHER","GLOBAL",1) CheckStat(myself,3,"PROFICIENCYSHORTBOW")~ THEN REPLY @12327 GOTO d5_wepx_55 Quote
Roxanne Posted September 1, 2017 Posted September 1, 2017 (edited) Can that be done within a dialogue too? I.e., to allow a player to move to 4 stars in shortbows only if 1) they already have 3 stars, and 2) they are either a fighter or an archer: IF ~OR(2) Class(myself,FIGHTER) Global("D5_ARCHER","GLOBAL",1) CheckStat(myself,3,"PROFICIENCYSHORTBOW")~ THEN REPLY @12327 GOTO d5_wepx_55 If Global("D5_ARCHER","GLOBAL",1) means that they are archer, then, yes, but who is *Myself* in your dialogue case? Depending on dialogue structure and talkers it may be better to use LastTalkedToBy to prevent checks and actions being applied to the protagonist. Edited September 1, 2017 by Roxanne Quote
subtledoctor Posted September 1, 2017 Author Posted September 1, 2017 (edited) but who is *Myself* in your dialogue case? The LastSummonerOf the invisible creature. The script starts the dialogue like so: ActionOverride(LastSummonerOf(Myself),StartDialogOverride("d5_weppr",Myself))That way the dialogue can use (Myself) and it won't have anything to do with the invisible creature, it will act directly on the NPC. Edited September 1, 2017 by subtledoctor Quote
CamDawg Posted September 2, 2017 Posted September 2, 2017 Can that be done within a dialogue too? I.e., to allow a player to move to 4 stars in shortbows only if 1) they already have 3 stars, and 2) they are either a fighter or an archer: IF ~OR(2) Class(myself,FIGHTER) Global("D5_ARCHER","GLOBAL",1) CheckStat(myself,3,"PROFICIENCYSHORTBOW")~ THEN REPLY @12327 GOTO d5_wepx_55 Dialogues use the same trigger/actions that scripts do, so yes, they can do anything you can script. The only tricky bit is that they do not necessarily do it instantly--so if you set a variable in your first reply of dialogue, it may not actually get set in time for a fork later in the dialogue. Quote
subtledoctor Posted September 2, 2017 Author Posted September 2, 2017 Thanks all. The mod no longer drops any NPCs to level 1, now it gives innate abilities that use dialogue to 1) gain basic proficiency in two additional weapons; and 2) depending on level, advance between one and three weapons from to a higher level of specialization/mastery. Quote
Avenger Posted September 2, 2017 Posted September 2, 2017 You may, or may not use CLASS(LastSummonerOf(Myself),DRUID_ALL) - this would also trigger on SHAMAN. Quote
subtledoctor Posted September 2, 2017 Author Posted September 2, 2017 Ah, nice. The Shaman was a conundrum (due to failing to exist in IWDEE) that I was momentarily ignoring. Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.