Jump to content


Photo

differentiating between joinable and non-joinable NPCs


33 replies to this topic

#16 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9239 posts
  • Gender:Not Telling

Posted 24 August 2017 - 04:46 PM

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.


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#17 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 24 August 2017 - 07:05 PM

Oof, forget that. Okay, back to just giving everyone an "increment proficiencies by dialog" ability. Or a "drop me to level 1" ability.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#18 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 31 August 2017 - 06:43 PM

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):

Spoiler

 

(Plus more global variables for different classes.)  And the dialogue includes this:

Spoiler

 

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?


Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#19 Mike1072

Mike1072
  • Gibberling Poobah
  • 2369 posts
  • Gender:Male
  • Location:Canada

Posted 31 August 2017 - 08:20 PM

You forgot an OR for detecting DRUID/FIGHTER_DRUID.



#20 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 01 September 2017 - 07:11 AM

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

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#21 Roxanne

Roxanne

    Modder

  • Modders
  • 1618 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 01 September 2017 - 07:37 AM

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 by Roxanne, 01 September 2017 - 07:38 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#22 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 01 September 2017 - 08:27 AM

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 by subtledoctor, 01 September 2017 - 08:29 AM.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#23 Roxanne

Roxanne

    Modder

  • Modders
  • 1618 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 01 September 2017 - 08:33 AM

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.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#24 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 01 September 2017 - 09:43 AM

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

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#25 Roxanne

Roxanne

    Modder

  • Modders
  • 1618 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 01 September 2017 - 09:56 AM

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 by Roxanne, 01 September 2017 - 10:02 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#26 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 01 September 2017 - 10:55 AM

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 by subtledoctor, 01 September 2017 - 11:03 AM.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#27 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9239 posts
  • Gender:Not Telling

Posted 01 September 2017 - 04:40 PM

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.


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#28 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 01 September 2017 - 09:40 PM

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.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#29 Avenger

Avenger
  • Modders
  • 3725 posts
  • Gender:Male
  • Location:Hungary

Posted 02 September 2017 - 01:54 AM

You may, or may not use CLASS(LastSummonerOf(Myself),DRUID_ALL) -  this would also trigger on SHAMAN.



#30 subtledoctor

subtledoctor
  • Modders
  • 2164 posts
  • Gender:Male

Posted 02 September 2017 - 02:22 AM

Ah, nice. The Shaman was a conundrum (due to failing to exist in IWDEE) that I was momentarily ignoring.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users