subtledoctor Posted November 5, 2015 Share Posted November 5, 2015 I'd like to have a spell do different things depending on the target's Charisma score. 1) Is there a non-scripting way to do this? I don't think opcode 177 can target according to values in stats.ids... 2) Assuming this has to be a script... uh, what does the script need to look like? I have no experience with BG2 scripting. Let's assume the effect is self-targeting and so I want to use an invisible monster here. I want to do something like, - if caster's CHA is 14, cast spell A on caster - if caster's CHA is 15, cast spell B on caster - etc. Link to comment
Jarno Mikkola Posted November 5, 2015 Share Posted November 5, 2015 It's best if you set an arbitrary global in the spell and then use that as part of the trigger, aka this: Global("customglobalinsanity","GLOBAL",1) And note the small imp-udent change. script ... - if caster's CHA is 14, cast spell *custom spell name*.spl on caster IF CheckStat(LastSummonerOf(Myself),14,DEX) Global("customglobalinsanity","GLOBAL",1) THEN RESPONSE #100 SetGlobal("customglobalinsanity","GLOBAL",2) ReallyForceSpellRES(*custom spell name*,LastSummonerOf(Myself)) ENDAnd the end of course is the killing of the creature. IF CheckStat(LastSummonerOf(Myself),14,DEX) Global("customglobalinsanity","GLOBAL",1) THEN RESPONSE #100 SetGlobal("customglobalinsanity","GLOBAL",2) ReallyForceSpellRES("d5spel1",LastSummonerOf(Myself)) END IF CheckStat(LastSummonerOf(Myself),15,DEX) Global("customglobalinsanity","GLOBAL",1) THEN RESPONSE #100 SetGlobal("customglobalinsanity","GLOBAL",2) ReallyForceSpellRES("d5spel2",LastSummonerOf(Myself)) END IF CheckStat(LastSummonerOf(Myself),16,DEX) Global("customglobalinsanity","GLOBAL",1) THEN RESPONSE #100 SetGlobal("customglobalinsanity","GLOBAL",2) ReallyForceSpellRES("d5spel3",LastSummonerOf(Myself)) END IF CheckStat(LastSummonerOf(Myself),17,DEX) Global("customglobalinsanity","GLOBAL",1) THEN RESPONSE #100 SetGlobal("customglobalinsanity","GLOBAL",2) ReallyForceSpellRES("d5spel4",LastSummonerOf(Myself)) END ... And let it be said that the custom spell should probably only have 7 characters. Something said so. EDITED.. Link to comment
subtledoctor Posted November 7, 2015 Author Share Posted November 7, 2015 To clarify: that "ReallyForeceSpellRES" line... does that force the summoned creature to cast the spell AT the LastSummoner? Or does it cause the spell to be cast BY the LastSummoner? In other words, should those custom spells be targeted at "living target"/"preset target?" Or "caster"/"self?" Link to comment
Fiann of the Silver Hand Posted November 7, 2015 Share Posted November 7, 2015 The spell cast by this particular CRE should have 'preset target'. If the spell targeted anything else, that Object designation would be superfluous. Link to comment
subtledoctor Posted November 7, 2015 Author Share Posted November 7, 2015 I'M getting "Type mismatch in "RES" argument of [ReallyForceSpellRES]. Expecting type "string". Recovering." Here's my script: IF CheckStat(LastSummonerOf(Myself),16,INT) THEN RESPONSE #100 ReallyForceSpellRES(d5_wisp4,LastSummonerOf(Myself)) DestroySelf() END Does something need to be in quotes or something? Link to comment
Jarno Mikkola Posted November 7, 2015 Share Posted November 7, 2015 The spell ... yeah, search for "SpellRES" without the quotes in Near Infinity and you can find the use of this... including the spell name... darn. Sorry for the bad example. Fixed it.. Aka, this should be the correct: ReallyForceSpellRES("d5_wisp4",LastSummonerOf(Myself)) Link to comment
subtledoctor Posted November 7, 2015 Author Share Posted November 7, 2015 Done and done. Thanks guys! Should have this component done in a day or two. Link to comment
subtledoctor Posted November 12, 2015 Author Share Posted November 12, 2015 So I'm having weird things happen, like multiple invisible creatures appear when I enter buildings (they always appear in the top left corner of the room.) It sort of reminds me of when I once installed the 'Haiass el Lobo' mod, and told Haiass to shoo and played without him, but had an invisible creature follow me and block doorways for the rest of the game. Anyone know what causes this? I assume it's a problem in my script.... Link to comment
Jarno Mikkola Posted November 12, 2015 Share Posted November 12, 2015 You do remove the creature in it's scripts end, correct ? With something like... IF Global("yourglobal","GLOBAL",2) THEN RESPONSE #100 DestroySelf() END Link to comment
subtledoctor Posted November 13, 2015 Author Share Posted November 13, 2015 Here's an example of the problem: https://dl.dropboxusercontent.com/u/86011511/IMG_1396.JPG I have an AP_SPL line added to every CLAB that triggers a spell that conjures a .cre that triggers intcr.baf: IF CheckStat(LastSummonerOf(Myself),15,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),16,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),17,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit2",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),18,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit2",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),19,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),20,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),21,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),22,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),23,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),24,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),25,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_crit3",LastSummonerOf(Myself)) DestroySelf() END The .spl also applies opcode 206 to protect against itself so it can only run once one any character. For Bards and Mages there is another AP_SPL line that casts another spell that summons another .cre that triggers intsp12.baf: IF CheckStat(LastSummonerOf(Myself),13,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),14,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),15,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),16,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),17,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),18,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),19,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),20,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),21,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),22,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),23,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),24,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),25,INT) THEN RESPONSE #100 ReallyForceSpellRES("d5_wisp1",LastSummonerOf(Myself)) DestroySelf() END Finally, there is a AP_SPL line that casts another spell, which summons another .cre which triggers charis.baf: IF CheckStat(LastSummonerOf(Myself),15,CHR) THEN RESPONSE #100 ReallyForceSpellRES("d5_cha15",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),16,CHR) THEN RESPONSE #100 ReallyForceSpellRES("d5_cha16",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),17,CHR) THEN RESPONSE #100 ReallyForceSpellRES("d5_cha17",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),18,CHR) THEN RESPONSE #100 ReallyForceSpellRES("d5_cha18",LastSummonerOf(Myself)) DestroySelf() END IF CheckStat(LastSummonerOf(Myself),19,CHR) THEN RESPONSE #100 ReallyForceSpellRES("d5_cha19",LastSummonerOf(Myself)) DestroySelf() END It occurs to me that I haven't taken into account low stat scores that give no bonus (they will have no effect but they also won't destroy the .cre. But that screenshot is with a cleric with 16 INT and 18 CHA so that shouldn't be an issue there... Link to comment
Jarno Mikkola Posted November 13, 2015 Share Posted November 13, 2015 And what happens when the character doesn't exceed any of the "requirements" >12 INT, >14 CHR ? There won't be any dead cre's ...but this would fix that for INT> 15 for the first .baf: IFCheckStatLT(LastSummonerOf(Myself),15,INT)THENRESPONSE #100DestroySelf()ENDIF Or what ever... the second and third need theirs also. so every one of the .cre's ends up dead, even if they have no positive outcome to the player character. Link to comment
Fiann of the Silver Hand Posted November 13, 2015 Share Posted November 13, 2015 Just put IF True() RESPONSE #100 DestroySelf() END at the end of the script. Link to comment
Jarno Mikkola Posted November 13, 2015 Share Posted November 13, 2015 Just put ... at the end of the script.Well, depending on what you wish to do with the script.... it could be useful oorr definitely nnootT. Link to comment
subtledoctor Posted November 13, 2015 Author Share Posted November 13, 2015 How does the script actually run? Does it stop once a condition is satisfied? Or keep going? If a character has 16 Charisma and so is meant to get the +2 bonus spell, whereas a 15 Cha gets the +1 bonus, will the script return true on both? Or return true for 15 and then stop? Should I reverse the order so it checks from 25 down, do that the highest number that matches a character's Cha is the first clause that returns true? Or does it look for an exact match, in which case 15 shows as false for a 16-Cha character - meaning, the order doesn't matter? Link to comment
Jarno Mikkola Posted November 13, 2015 Share Posted November 13, 2015 Or does it look for an exact match, in which case 15 shows as false for a 16-Cha character - meaning, the order doesn't matter?Yep... If you use CheckStat(..) it needs to be exact match, if you use CheckStatGT(..15) then only the chars that have greater than 15 get it, aka 16>15, and it also passes the greater than 14, 13, 12... and so on, so it would get all the lesser bonuses too if there's any with ...GT ending checks. And the same thing for the CheckStatLT(..17), but in the opposite direction cause it's "Lesser Than" ... it's really doesn't matter how you do it all, as long as you know your own build. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.