Salk Posted November 16, 2014 Share Posted November 16, 2014 Hello! What I am trying to accomplish is to have a MR of 2% being assigned to the protagonist when a specific familiar (Pseudodragon) is summoned as long as it's either in the backpack or at visual range. In Baldur.bcs I added this: IF Global("WTPFAMNG","GLOBAL",2) // Pseudodragon is summoned and alive OR(2) PartyHasItem("WTPFMSPD") Range("WTPSEUDO", 30) THEN RESPONSE #100 ActionOverride(Player1,ApplySpellRES("WTPFCON8",Myself)) // Add 2% MR / shows MR port icon END IF Global("WTPFAMNG","GLOBAL",2) // Pseudodragon is summoned and alive !PartyHasItem("WTPFMSPD") !Range("WTPSEUDO", 30) THEN RESPONSE #100 ActionOverride(Player1,ApplySpellRES("WTPFCON9",Myself)) // Remove 2% MR END I have two problems. The first one is that the first OR(2) block doesn't ever return true. I checked the saved game file with NI and it correctly shows *TPSEUDO in the NPCs list. But even if I remove the block, the MR portrait icon is displayed but no Magic Resistance bonus is assigned. For the Magic Resistance bonus I used Opcode 166, Target: Self, Value: 2, Modifier Type: Increment, Timing Mode: Instant/Permanent, Dispel/Bypass Resistance and Probability 1 100. I tried even changing some parameters but with no luck. Any suggestions? Also, even if everything worked fine, I am pretty sure I should find a way to account for the script to stop kicking in all the time (?) by using some global variables? Thanks for your help! UPDATE: The magic resistance seems to be applied correctly after some testing. I don't really know why. Also, the second OR was a silly mistake. The item's name is WTPFAMPS and not WTPFMSPD. I still don't know why WTPSEUDO doesn't return true when the familiar is within range though... Of course the script keeps adding the magic resistance... UPDATE 2: I guess I understand why now. The script doesn't know who the subject for the Range (or See, I tried that too) condition is... It should be Player1. Any way to do it? Would it be safe to add that block to Dplayer3.bcs instead? UPDATE 3: I did that but I am not sure whether or not other .CRE use that script. I must make sure that this applies only to the Protagonist. Any idea of to do that? Thanks! Link to comment
argent77 Posted November 16, 2014 Share Posted November 16, 2014 You can assign the script to your familiar instead. Example: IF Global("WTPFAMNG","GLOBAL",2) // Pseudodragon is summoned and alive Global("MR_Active", "GLOBAL", 0) // prevent this block to be executed continuously Range(Player1, 30) THEN RESPONSE #100 SetGlobal("MR_Active", "GLOBAL", 1) ActionOverride(Player1,ApplySpellRES("WTPFCON8",Myself)) // Add 2% MR / shows MR port icon END IF Global("WTPFAMNG","GLOBAL",2) // Pseudodragon is summoned and alive !Global("MR_Active", "GLOBAL", 0) // prevent this block to be executed continuously !Range(Player1, 30) THEN RESPONSE #100 SetGlobal("MR_Active", "GLOBAL", 0) ActionOverride(Player1,ApplySpellRES("WTPFCON9",Myself)) // Remove 2% MR END You still have to cover the case of your familiar as inventory item however. You can do this in the conversation with your familiar for example, when you ask it to turn into an item. Link to comment
Salk Posted November 16, 2014 Author Share Posted November 16, 2014 Thanks for the suggestion, argent77! Myself, I've come up with this solution (but it requires to append to dplayer3.bcs and I still need to test it). Do you think it might work? IF Global("PSDMRS", "GLOBAL", 0) Global("WTPFAMNG","GLOBAL",2) OR(2) PartyHasItem("WTPFAMPS") Range("WTPseudo",30) THEN RESPONSE #100 ActionOverride(Player1,ApplySpellRES("WTPFCON8",Myself)) SetGlobal("PSDMRS", "GLOBAL", 1) END IF Global("PSDMRS", "GLOBAL", 1) Global("WTPFAMNG","GLOBAL",2) !PartyHasItem("WTPFMSPD") !Range("WTPseudo", 30) THEN RESPONSE #100 ActionOverride(Player1,ApplySpellRES("WTPFCON9",Myself)) SetGlobal("PSDMRS", "GLOBAL", 0) END IF Dead("WTPseudo") Global("PSDMRS", "GLOBAL", 1) THEN RESPONSE #100 ActionOverride(Player1,ApplySpellRES("WTPFCON9",Myself)) SetGlobal("PSDMRS", "GLOBAL", 0) END Is there something that I can do to make sure that this runs only if it's Player1's script? If there is no solution I will try go your way. Link to comment
argent77 Posted November 16, 2014 Share Posted November 16, 2014 I would be very careful with player-specific scripts as you don't have full control over them. They may be assigned or re-assigned during the game or might not even work unless you turn on Party AI. There may even be differences between singleplayer and multiplayer sessions. Link to comment
Salk Posted November 16, 2014 Author Share Posted November 16, 2014 I understand. I will just follow your advice then. Link to comment
Salk Posted November 17, 2014 Author Share Posted November 17, 2014 argent77, the method works and it covers even the familiar in the inventory since the variable will be still set to 1 when that happens. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.