Avenger Posted December 10, 2010 Share Posted December 10, 2010 about opcode 132. I guess you meant Holy Might (0x84). It uses a state bit, just like many other effects. It iwd1/2 they even have extended state flags (iwd1), and spell states (iwd2). The spell states are the most closest to your spell ID idea, because there are some 96 bits (3 dwords). In GemRB we support both the extended state and the spell states (128 bits altogether, though there are overlaps in hardcoded effects). It is a pity you didn't design the engine, having an own field for this spell state value is definitely useful. If Ascension will implement it, i will definitely follow suit Do you think it is enough to maximize the value at 96? It would mean, i can use the existing spell state bitfield which i could set easily (storing more values in stats is not possible, so i would have to look up the 0x2c value in the effect queue), there is already an implemented trigger (spellstate) inherited from iwd2 and the spellstate methods are already written. Link to comment
Avenger Posted December 12, 2010 Share Posted December 12, 2010 I made a mistake in the previous post, we got 192 bits (6 dwords) for spell states. I hope that's enough? Link to comment
Ascension64 Posted January 30, 2011 Author Share Posted January 30, 2011 Question // 0x93 Spell:Learn int fx_learn_spell (Scriptable* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_learn_spell (%2d): Resource:%s Mode: %d\n", fx->Opcode, fx->Resource, fx->Parameter2 ); //parameter1 is unused, gemrb lets you to make it not give XP //probably we should also let this via a game flag if we want //full compatibility with bg1 target->LearnSpell(fx->Resource, fx->Parameter2^LS_ADDXP); return FX_NOT_APPLIED; } I couldn't find the definition of LS_ADDXP anywhere. Which bit flag is it? I will implement the same in TobEx. I've been requested to add a few extra flags, of the following: -enforce mage school restrictions -exclude sorcerer class They will use whatever lowest bit flags are available in param2. Link to comment
lynx Posted January 30, 2011 Share Posted January 30, 2011 it's 1. We have the following bits in use: LS_ADDXP = 1 #give xp for learning it LS_LEARN = 2 #give message when learned it LS_STATS = 4 #check stats (alignment, etc) LS_MEMO = 8 #memorize it instantly (add innate) Link to comment
Ascension64 Posted January 30, 2011 Author Share Posted January 30, 2011 Hmm, the default behaviour of the opcode is to check stats (which is the die roll and the int modifier). It looks like GemRB implements the opposite; check stats only if the flag is set. Is this intended? if (flags & LS_STATS) { // chance to learn roll if (LuckyRoll(1,100,0) > core->GetIntelligenceBonus(0, GetStat(IE_INT))) { return LSR_FAILED; } } Also, does GemRB account for change in difficulty with spell school? if (creTarget.m_BaseStats.kit[1] != KIT_TRUECLASS) { if (g_pChitin->pGame->GetMageSchool(creTarget.m_BaseStats.kit[1]) == resSpell.GetSpellSchoolPrimary()) { nLearnSpellMod += 15; } else { nLearnSpellMod -= 15; } } Link to comment
lynx Posted January 30, 2011 Share Posted January 30, 2011 It's opt-in, but the relevant callers should already use that flag. Didn't know about the spell school bonus - cool, will add. Link to comment
Ascension64 Posted January 31, 2011 Author Share Posted January 31, 2011 Umm, the only other issue is how is this compatible with PS:T and IWD2? #147 (0x093) Spell: Learn Spell [147]Parameter #1: Irrelevant Parameter #2: Type Description: The targeted creature(s) learn the spell specified by the resource key, in the style specified by the 'Type' field. Known values for 'Type' are: 0 Mage 1 Cleric 2 Innate Link to comment
lynx Posted January 31, 2011 Share Posted January 31, 2011 if their opcodes are really different, we can easily override them, which we already do for some others. I don't trust that iesdp description though. Link to comment
Avenger Posted January 31, 2011 Share Posted January 31, 2011 IESDP is correct about Original PST and BG1. Param2 is the spell type. BG2 and IWD2 doesn't seem to care, they find out the spell type from the resref. Anyway, this means, we cannot use Param2 (but we can use Param1) for the custom stuff. Link to comment
lynx Posted January 31, 2011 Share Posted January 31, 2011 added the specialist learning modifier and changed the effect to use parameter1. No spell(book) type forcing yet. Link to comment
Ascension64 Posted February 8, 2011 Author Share Posted February 8, 2011 added the specialist learning modifier and changed the effect to use parameter1. No spell(book) type forcing yet.An issue with this: in BG2:ToB, all the scrolls with Learn Spell have some value existing in param1 (which I believe is unused). Pretty much all of them are nParam1 = 1, but SCRL77.ITM has nParam1 = 5 (which is 0x4 & 0x1). Shall we try and avoid these bits? Link to comment
lynx Posted February 8, 2011 Share Posted February 8, 2011 I'm not sure if the original has param 3 and 4, but those are surely unused here, so gemrb could use them. I do wonder if param 1 is truly unused - then it doesn't matter anyway and the current state is fine. Link to comment
Avenger Posted February 8, 2011 Share Posted February 8, 2011 Param3/4 is currently not scriptable in GemRB's guiscript and v1 effects don't have these, so items/spells will be more complicated. I think using apply effect from scrolls isn't working either, because it won't be detected as a scroll anymore. Currently, the best option i see is to use the bits of the high word of param1. It is rather ugly, but all the other options are worse, as i see it. Link to comment
Ascension64 Posted February 9, 2011 Author Share Posted February 9, 2011 It is rather ugly, but all the other options are worse, as i see it.If you like it, I like it. Deal? Link to comment
Avenger Posted February 9, 2011 Share Posted February 9, 2011 It is rather ugly, but all the other options are worse, as i see it.If you like it, I like it. Deal? Ok Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.