Jump to content

WEIDU - items basic coding problems


ptifab

Recommended Posts

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 by Jarno Mikkola
Link to comment

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.

Link to comment

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 by ptifab
Link to comment

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.

Link to comment

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 by Jarno Mikkola
Link to comment

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. 😋

Link to comment
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.

Link to comment
4 hours ago, ptifab said:

You are crazy, you know ? 🤣

Crazy... NO ! Insane maybe, but never crazy:devlook: Or was it the other ways around, I could never tell. crazy.gif

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.

Link to comment

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.

Link to comment

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 by subtledoctor
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...