Jarno Mikkola Posted November 2, 2019 Share Posted November 2, 2019 (edited) 20 hours ago, ptifab said: I would like to copy the strref from an item to apply it to a newly created spell. I've read a lot about strref, but i'm struggling at how keeping it into a variable to copy from a file to one another. Do i have to copy the strref from the first file into a global ? No. You just read the string reference number from the items string, and then use that number as the new string when you copy the .spl file. Like if we would take the 2 handed swords description string and assign it as "desc": COPY_EXISTING ~sw2h01.itm~ ~override~ READ_LONG ~0x0050~ ~desc~ #8 And then we plant that as the description of the magic missile .spl -file: COPY_EXISTING ~spwi112.spl~ ~override~ WRITE_LONG ~0x0050~ ~desc~ ... easy. But should you know that as you do this to a magic scrolls... they usually use the 0x0054 as the identified scroll description, which shows what the spell does, and the spells use the general description 0x0050 as the same. Edited November 3, 2019 by Jarno Mikkola Quote Link to comment
ptifab Posted November 3, 2019 Author Share Posted November 3, 2019 This code throw me a GLR parse error : "Parse error (state 1143) at #" what's this "#" for anyway ? Quote Link to comment
Jarno Mikkola Posted November 3, 2019 Share Posted November 3, 2019 The # should denote the maximum character length of the string... try without it. And this time use the _LONG instead of the _ASCII ... I wasn't on my own computer, so I wasn't able to verify the correct string length ... but the above it now correct. Quote Link to comment
ptifab Posted November 3, 2019 Author Share Posted November 3, 2019 (edited) Nope, results are the same, it gives me the same error. I tried without the # and with Long or ASCII, always a Parse Error. Maybe the variable is reset when you do another COPY action ? nevermind i'm blind, during my night of coding i forgot a small part so it couldn't work... 2 days try and repeat. Let's move forward, thanks Jarno Edited November 3, 2019 by ptifab Quote Link to comment
ptifab Posted November 26, 2019 Author Share Posted November 26, 2019 Hello, i have a question regarding variables. When i try to run this code : Quote LAF ADD_SPELL_EX INT_VAR type = 3 level = 1 min = 0 max = 1000 STR_VAR file = ~items_rev_ultimate/SPL/SPIN170.SPL~ output = ~override~ name = ~BHAAL_REMOVE_PHYSIC~ RET spell_res END COPY_EXISTING ~%spell_res%.SPL~ ~override~ LPF ALTER_EFFECT INT_VAR match_opcode = 172 STR_VAR resource = ~%spell_res%~ END When i look in NI, the resource is not set correctly (i read %SPELL_R.SPL at the resource offset) what am i missing here ? I'm just trying to set the resource in the ALTER_EFFECT function as the new resource created while doing the ADD_SPELL_EX function, (wich is working fine while i'm doing the COPY_EXISTING.) Do i have to run something to get the new IDS resource entry ? i have tried using IDS_OF_SYMBOL but it's not the IDS value that i want, it's the new resource name. Quote Link to comment
Jarno Mikkola Posted November 26, 2019 Share Posted November 26, 2019 (edited) The ~%spell_res%~ .. works, erhm, but you could use "%SOURCE_RES%" ... anyways, you just need to evaluate the value, back with EVAL... aka: LPF ALTER_EFFECT INT_VAR match_opcode = 172 STR_VAR resource = EVAL ~%spell_res%~ END And rather than this: COPY_EXISTING ~%spell_res%.SPL~ ~override~ I would use: COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ //patching END BUT_ONLY Edited November 26, 2019 by Jarno Mikkola Quote Link to comment
ptifab Posted November 26, 2019 Author Share Posted November 26, 2019 It worked, thanks a lot Jarno Quote Link to comment
Jarno Mikkola Posted November 26, 2019 Share Posted November 26, 2019 Good that it works... I am actually doing this selfishly, for time when I need help from other forum members. Now, you own me: nothing. Lesson to be learned... when a evil creature does good deeds, it's not actually that good, or he is definitely after something worse. So you are welcome. Quote Link to comment
ptifab Posted November 26, 2019 Author Share Posted November 26, 2019 You are crazy, you know ? Quote Link to comment
Mike1072 Posted November 26, 2019 Share Posted November 26, 2019 4 hours ago, Jarno Mikkola said: And rather than this: COPY_EXISTING ~%spell_res%.SPL~ ~override~ I would use: COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ //patching END BUT_ONLY Those serve completely different purposes - one is copying a single specific spell and the other is copying every single spell. The first option is appropriate for this scenario. Quote Link to comment
Jarno Mikkola Posted November 26, 2019 Share Posted November 26, 2019 4 hours ago, ptifab said: You are crazy, you know ? Crazy... NO ! Insane maybe, but never crazy ! Or was it the other ways around, I could never tell. Ahh, Mike, that's why you are a good coder and I just copy-paste. ... yes, of course I should have looked the above example better... but just didn't. Anyways, back to the topic, if you have more questions ptifab, just ask. Quote Link to comment
ptifab Posted December 20, 2019 Author Share Posted December 20, 2019 I have a question on opcode #219. When i looked at the code from item revision, the silver charm (AMUL18.ITM) is specified to get +2 AC and Saving Throws vs. creature type (here obviously lycans and vampires). My point is, when i look at the item in NI, there's only opcode 219 used, and IEDSP clearly says it's just a bonus AC vs. creature type. where Item Revision item description states there's also a bonus saving throws. Is this something hidden within that opcode or is it a functionality that has changed ? Edit : there's also the Human Flesh (LEAT21.ITM) that has the same effect (against humans) but it's the same opcode used. Quote Link to comment
lynx Posted December 20, 2019 Share Posted December 20, 2019 There's no such opcode for saving throws. Quote Link to comment
ptifab Posted December 20, 2019 Author Share Posted December 20, 2019 Thanks for your answer lynx, i just wanted to know if there were a hidden effect bound to this opcode #219 as some serious modders like @Demivrgvs used it that way. Quote Link to comment
subtledoctor Posted December 21, 2019 Share Posted December 21, 2019 (edited) I’m AFK now, but I feel like I’ve seen something like this. I doubt Demi would have put that in the description without implementing it. Just because it’s not in opcode 219 doesn’t mean it isn’t done some other way. I think SR ProEvil gives a save bonus against spells cast by evil casters... anyone have an SR install handy who can look at the ProEvil .SPL file? Edited December 21, 2019 by subtledoctor Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.