Jump to content

Problem with the script not firing upon summon


aeviannce24

Recommended Posts

Hi everyone.

 

I've been working on this little mod for quite a while now. Basically, this is a mod which adds a tome both in stores and some areas that gives characters a weapon style proficiency (eg. sword and shield style, two handed style, etc.). This is suppose to be used in conjunction with Igi's learn-through-use mod since it doesn't add weapon style proficiency in game (or at least, last time I checked). It works by spawning an invisible and invulnerable creature that talks to the manual user and then gives a proficiency point for a desired weapon style should the requirements are met by the character.

 

At the moment, I think I have every file needed ready for its basic mechanics. The problem is that the script for some reason doesn't work or wont run at all. I've already checked if both the bcs and dialogue file were properly assigned to the creature and made some further testing on the creature properties (gender: summoned, summoned as ally, original, enemy, etc.). I've also tried manually talking to the creature but still didn't work. So right now, I'm really clueless.

 

Here is the code for the override script:

//If an enemy exists, then the creature is destroyed.
IF
  Exists([EVILCUTOFF])
THEN
  RESPONSE #100
    DestroySelf()
END

// This block was just to test if the script is running or not
IF
  See(LastSummonerOf(Myself))
THEN
  RESPONSE #100
    DisplayStringHead(LastSummonerof(Myself),"I AM SUMMONED")
END

//If summoned, the creature will force initiate a dialog with its summoner.
//Originally the variable for Player1 was "LastSummonerOf(Myself)"
//I changed it to Player1 for testing purposes.
IF
  NumTimesTalkedTo(0)
  !Exists([EVILCUTOFF])
THEN
  RESPONSE #100
    ActionOverride("A4PBSCU0",StartDialogueNoSet(Player1))
END

//Destroys self after a successful conversation is made
IF
  NumTimesTalkedTo(1)
THEN
  RESPONSE #100
    DestroySelf()
END

The dialogue file:

BEGIN A4PBDLG1

IF ~~ THEN BEGIN A4PB_OB
  SAY @100
  IF ~~ THEN REPLY @101 GOTO A4PB_SW
  IF ~~ THEN REPLY @102 GOTO A4PB_SS
  IF ~~ THEN REPLY @103 GOTO A4PB_TH
  IF ~~ THEN REPLY @104 GOTO A4PB_TH
  IF ~~ THEN REPLY @105 GOTO A4PB_CB 
END

IF ~~ THEN BEGIN A4PB_OP
  SAY @106
  IF ~~ THEN REPLY @101 GOTO A4PB_SW
  IF ~~ THEN REPLY @102 GOTO A4PB_SS
  IF ~~ THEN REPLY @103 GOTO A4PB_TH
  IF ~~ THEN REPLY @104 GOTO A4PB_TW
  IF ~~ THEN REPLY @105 GOTO A4PB_CB
END

IF ~~ THEN BEGIN A4PB_CB
  SAY @107
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN A4PB_SW
  SAY @108

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),1,PROFICIENCYSINGLEWEAPON)~ 
  THEN REPLY @114 GOTO A4PB_SWA

  IF ~!LevelLT(LastTalkedToBy(Myself),7)
      !CheckStat(LastTalkedToBy(Myself),0,PROFICIENCYSINGLEWEAPON)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCYSINGLEWEAPON)~
  THEN REPLY @115 GOTO A4PB_SWB

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCYSINGLEWEAPON)~ 
  THEN REPLY @105 GOTO A4PB_CB

  IF ~CheckStat(LastTalkedToBy(Myself),2,PROFICIENCYSINGLEWEAPON)~
  THEN REPLY @109 GOTO A4PB_OP

  IF ~LevelLT(LastTalkedToBy(Myself),3)~
  THEN REPLY @110 EXIT
END

IF ~~ THEN BEGIN A4PB_SS
  SAY @108

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),1,PROFICIENCYSWORDANDSHIELD)~ 
  THEN REPLY @116 GOTO A4PB_SSA

  IF ~!LevelLT(LastTalkedToBy(Myself),7)
      !CheckStat(LastTalkedToBy(Myself),0,PROFICIENCYSWORDANDSHIELD)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCYSWORDANDSHIELD)~
  THEN REPLY @117 GOTO A4PB_SSB

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCYSWORDANDSHIELD)~
  THEN REPLY @105 GOTO A4PB_CB

  IF ~CheckStat(LastTalkedToBy(Myself),2,PROFICIENCYSWORDANDSHIELD)~
  THEN REPLY @109 GOTO A4PB_OP

  IF ~LevelLT(LastTalkedToBy(Myself),3)~
  THEN REPLY @110 EXIT
END

IF ~~ THEN BEGIN A4PB_TH
  SAY @108

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),1,PROFICIENCY2HANDED)~ 
  THEN REPLY @118 GOTO A4PB_THA

  IF ~!LevelLT(LastTalkedToBy(Myself),7)
      !CheckStat(LastTalkedToBy(Myself),0,PROFICIENCY2HANDED)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCY2HANDED)~
  THEN REPLY @119 GOTO A4PB_THB

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCY2HANDED)~
  THEN REPLY @105 GOTO A4PB_CB

  IF ~CheckStat(LastTalkedToBy(Myself),2,PROFICIENCY2HANDED)~
  THEN REPLY @120 GOTO A4PB_OP

  IF ~LevelLT(LastTalkedToBy(Myself),3)~
  THEN REPLY @110 EXIT
END

IF ~~ THEN BEGIN A4PB_TW
  SAY @108

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),1,PROFICIENCY2WEAPON)~ 
  THEN REPLY @121 GOTO A4PB_THA

  IF ~!LevelLT(LastTalkedToBy(Myself),7)
      !CheckStat(LastTalkedToBy(Myself),0,PROFICIENCY2WEAPON)
      !CheckStat(LastTalkedToBy(Myself),2,PROFICIENCY2WEAPON)
      !CheckStat(LastTalkedToBy(Myself),3,PROFICIENCY2WEAPON)~
  THEN REPLY @122 GOTO A4PB_TWB

  IF ~!LevelLT(LastTalkedToBy(Myself),7)
      !CheckStat(LastTalkedToBy(Myself),0,PROFICIENCY2WEAPON)
      !CheckStat(LastTalkedToBy(Myself),1,PROFICIENCY2WEAPON)
      !CheckStat(LastTalkedToBy(Myself),3,PROFICIENCY2WEAPON)
      Class(LastTalkedToBy(Myself),RANGER)~
  THEN REPLY @123 GOTO A4PB_TWC

  IF ~!LevelLT(LastTalkedToBy(Myself),12)
      !CheckStat(LastTalkedToBy(Myself),0,PROFICIENCY2WEAPON)
      !CheckStat(LastTalkedToBy(Myself),1,PROFICIENCY2WEAPON)
      !CheckStat(LastTalkedToBy(Myself),3,PROFICIENCY2WEAPON)~
  THEN REPLY @123 GOTO A4PB_TWC

  IF ~!LevelLT(LastTalkedToBy(Myself),3)
      !CheckStat(LastTalkedToBy(Myself),3,PROFICIENCY2WEAPON)~
  THEN REPLY @105 GOTO A4PB_CB

  IF ~CheckStat(LastTalkedToBy(Myself),3,PROFICIENCY2HANDED)~
  THEN REPLY @124 GOTO A4PB_OP

  IF ~LevelLT(LastTalkedToBy(Myself),3)~
  THEN REPLY @110 EXIT
END

IF ~~ THEN BEGIN A4PB_SWA
  SAY @111
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS00",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_SWB
  SAY @112
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS00",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_SSA
  SAY @111
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS01",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_SSB
  SAY @112
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS01",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_THA
  SAY @111
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS02",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_THB
  SAY @112
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS02",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_TWA
  SAY @111
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS03",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_TWB
  SAY @112
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS03",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

IF ~~ THEN BEGIN A4PB_TWC
  SAY @113
  IF ~~ THEN DO ~ReallyForceSpellRES("A4PBS03",LastTalkedToBy(Myself))
                 TakePartyItemNum("A4PBI00",1)
                 DestroyItem("A4PBI00")~ EXIT
END

And finally, the tp2

BACKUP ~A4PB/backup~
AUTHOR ~aeviannce24@gmail.com~

// MODDER
NO_IF_EVAL_BUG
VERSION ~v1~

README ~A4PB/Readme-PB_ENG.txt~

ASK_EVERY_COMPONENT
LANGUAGE ~English~
         ~english~
         ~Language/English~
         ~A4PB/Language/A4PB-Setup_ENG.tra~

BEGIN @1
// Checks for ToB Installation
REQUIRE_PREDICATE FILE_EXISTS_IN_GAME ~mel01.cre~ @2

// Checks for Igi's Learn-Through-Use Mod
//REQUIRE_PREDICATE FILE_EXISTS_IN_GAME ~iitrain.cre~ @3

//Load dialog translation file
LOAD_TRA ~A4PB/Language/A4PB-DLG_ENG.tra~
LOAD_TRA ~A4PB/Language/%LANGUAGE%/A4PB-DLG_ENG.tra~

// Mod Components
  // Dialogue and script files
  COMPILE ~A4PB/Script/A4PBSCU0.baf~
  COMPILE ~A4PB/Dialogue/A4PBDLG1.d~

  // Item-related files
  COPY ~A4PB/Item/A4PBI00.itm~ ~override~
	SAY NAME1 @10
	SAY NAME2 @10
	SAY UNIDENTIFIED_DESC @11
  COPY ~A4PB/Item/A4PBCSU0.eff~ ~override~
  COPY ~A4PB/Item/A4PBCSU0.cre~ ~override~
	WRITE_ASCII 0x248 ~A4PBSCU0~ #8			// override
	WRITE_ASCII 0x2cc ~A4PBDLG1~ #8			// dialogue
	WRITE_ASCII 0x280 ~A4PBSCU0~ #32		// DV

  // Proficiency Adding Spells
  COPY ~A4PB/Proficiency/A4PBS00.spl~ ~override~
  COPY ~A4PB/Proficiency/A4PBS01.spl~ ~override~
  COPY ~A4PB/Proficiency/A4PBS02.spl~ ~override~
  COPY ~A4PB/Proficiency/A4PBS03.spl~ ~override~

  // To be added: Area and store extensions

Attached is the creature file. Umm... at the moment, the creature file is just a basic character, since I thought that it being invisible and invulnerable made it impossible to talk...

Item + Creature.rar

Link to comment

I didn't look at the attachment but is it the script that doesn't run or is the creature not talking? I had the problem with using an invisible creature that some of them (as used in BGII) won't talk, i.e. their dialogue is not valid although the cre looks fine. Try using another creature file (I was so frustrated I copied and renamed a cow..) to see whether this might be the problem?

Link to comment

Hi jastey.

 

Yes, that's what I did actually. I used Habib I think, and changed his file name to mine. Same goes, still doesn't work. The block I made that was suppose to say "I am summoned" didn't fire. I also tried directly talking to the cre. It came back with "this creature has nothing to say to you." So I'm guessing that the script doesn't work and maybe even the dialogue file...

Link to comment

You need at least one state in your DLG with a state trigger that evaluates to true, or no dialogue will occur.

Are you saying that this:

BEGIN A4PBDLG1

IF ~~ THEN BEGIN A4PB_OB
SAY @100 ...

Needs to be:

BEGIN A4PBDLG1

IF ~See(LastSummonerOf(Myself))~ THEN BEGIN A4PB_OB
SAY @100 ...

Hi Imp~ You're everywhere :p

Well yes, evil is. devil.gif

Link to comment

Umm... is there a better way to destroy the creature after a certain condition is met? I think "SetGlobal("a4pbsum","LOCALS",1)" doesn't work because maybe it applies to the pc rather than the creature. I don't want to use GLOBAL variable since I don't want it to add more data in the game.

 

Oh, and "NumTimesTalkedTo" doesn't work either for some reason...

 

I think i might have just coded it incorrectly. Let me try again...

Link to comment

Okay... So atm, most of the basic mechanics works. The only problem is the unsummoning part. I can't figure out a code that would work and unsummon the creature once the dialog is finished. I resorted to using the summoning duration and made it last by 1 second. Since the game auto pauses when in a conversation, it kinda works, though the unsummoning bam and "unsummoned" text in game still shows (which is kinda annoying).

 

If anyone knows a better way of unsummoning the creature without relying on the summoning opcode, please tell me... :p

 

A never mind. Figured it out already. Thanks again everyone! I'm almost done finally... :D

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...