Jump to content


Photo

Setting a spell state with Weidu


  • Please log in to reply
56 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 27 November 2017 - 11:38 AM

Again I'm running into this problem - I can't seem to make Weidu tell the engine to use IWD2 mode for spell state selection to pick the custom state there. This code just doesn't bring up the right menu:

 

LPF ~ADD_CRE_EFFECT~ INT_VAR opcode = 328 target = 1 power = 1 casting_level = 0 casting_mode = 1 timing = 1 duration = 0 parameter1 = 0 parameter2 = 522 resist_dispel = 0 special = 1 END

 

Same with "mode" instead of "special." Does anybody know how to make it work?



#2 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 27 November 2017 - 12:25 PM

INT_VAR opcode = 328

Yeah, see the iwd2 doesn't have 328 opcode.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#3 temnix

temnix
  • Member
  • 983 posts

Posted 27 November 2017 - 01:57 PM

Imp, you're being completely stupid. Do you even use Near Infinity? Do you have any clue what I'm talking about at all? Fuck.



#4 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 27 November 2017 - 06:52 PM

Code looks correct, although casting_level/mode aren't used by that function, and I only have it on hearsay that 255+ states actually work.

 

However, yes, I don't have an exact clue what you're talking about, because this:

LPF ~ADD_CRE_EFFECT~ INT_VAR opcode = 328 target = 1 power = 1 casting_level = 0 casting_mode = 1 timing = 1 duration = 0 parameter1 = 0 parameter2 = 522 resist_dispel = 0 special = 1 END

just sets the spell state, it's not supposed to display any menus, whether in game, in NI or in DOS window.


Edited by GeN1e, 27 November 2017 - 06:54 PM.

Retired from modding.


#5 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 28 November 2017 - 10:00 AM

Imp, you're being completely stupid. Do you even use Near Infinity? Do you have any clue what I'm talking about at all? Fuck.

As much I disdain your style, i totally agree this time. Imp, you really have to check what you are talking about. IWD2 mode is a setting in the EE set spell state opcode to use extended spell states (you should always do this, as the IWD1 mode is pretty limited).

 

Spell states over 256 don't work. And before temnix asks me how do i know this, i just say, i wrote it and allocated only 256 bits for this.

 

As for what field name you should use to set the iwd2 mode, you should use 'special' as that is the name of the field in WeiDU.  The documentation for ADD_CRE_EFFECT should be clear.

http://www.weidu.org...DME-WeiDU.html. I don't think 'casting_mode' is a valid field name either.

 

I myself don't use NI, so i don't know what menu you are talking about, either. 


Avenger

#6 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 28 November 2017 - 11:22 AM

Code looks correct, although casting_level/mode aren't used by that function, and I only have it on hearsay that 255+ states actually work.
NI "could" if you were to extend the "extstate.ids" with the intended line. Say like:
APPEND ~splstate.ids~ ~522 something~ UNLESS ~522~

Not that it would be recommended to extend the 255 number, as the game could thrown in curves with those values. And I am not sure NI actually loads those files into the active game. As there's quite much room in between the 126 - 249 numbers, in the normal EE games.

Edited by The Imp, 28 November 2017 - 12:22 PM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#7 -kjeron-

-kjeron-
  • Guest

Posted 28 November 2017 - 12:15 PM

I still think you need to update your Weidu, some recently old versions did not support the special field for certain functions, ADD_CRE_EFFECT among them.

 

The menu being referenced is for parameter2 in NI, it will list a different set of values (pulled from SPLSTATE, instead of a predefined partial EXTSTATE list), if the special field is set to 1.

 



#8 temnix

temnix
  • Member
  • 983 posts

Posted 28 November 2017 - 12:43 PM

Thank you, kjeron. That's the menu, for the IWD2 states (all the custom states go there). To Avenger: you know, as someone who wrote it, you should probably be surprised that states over 255 work. :D Well, only for some functions. I have way too many unfinished mods with tp2s that I move back and forth between, it would be easier to remember just what works when if I settle down and focus on one thing. I do remember trying to use the high states for distinguishing weapon types, with some weapons putting the creature in particular states, and then I ran into the same problem with "special". When I changed the states by hand, the recognition wasn't quite happening. But they work for some other uses. Here is what I did just now to convince myself.

 

The Weidu patching adds the creature effect, and the value, all except choosing the right menu. The 522 spell state is called BOY, it is one of the four states added for innocents: BOY, GIRL, MAN and WOMAN. I need those distinctions for some quest work. The boys in the game got patched, and I went and edited BOYBA3.CRE to use the IWD2 menu, and its value showed BOY instead of "Unknown." I saved the file and then added this to baldur.bcs:

 

 

IF

TriggerOverride(Player1,See([ANYONE]))
CheckSpellState(LastSeenBy(Player1),BOY)

THEN

RESPONSE #1

Kill(Player1)

END

 

I ran the game, summoned the boy, and guess what happened. So the problem, at least for this application, is not with states but with Weidu, which somehow doesn't understand "special." I'll update it, but I doubt versions are the cause. If anybody wants to try and get custom states through, they're welcome to it. There is a workaround, which, I recall, I've used at some point: making custom spells with Set Spell State, picking the spell state by hand, and patching creatures to cast the spell on themselves instead. I'll use this again if nothing else comes up, but how are you all getting your custom states in without running into the "special"?



#9 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 28 November 2017 - 03:25 PM

I'll update it, but I doubt versions are the cause.

 

Checking if ADD_****_EFFECT accepts the "special" parameter was the first thing I did, since I thought they didn't - but they were. So, I guess it means it was indeed updated recently.


Retired from modding.


#10 temnix

temnix
  • Member
  • 983 posts

Posted 28 November 2017 - 04:33 PM

I updated it. Same story.



#11 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 28 November 2017 - 06:45 PM

Works for me with WeiDU v242.

Attached Images

  • spellstate.jpg

Edited by GeN1e, 28 November 2017 - 06:45 PM.

Retired from modding.


#12 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 29 November 2017 - 05:48 AM

Are you sure that code is actually actually setting that field to 522?

#13 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 29 November 2017 - 09:59 AM

I think his problem was with the "special" field not setting at all, regardless of the state value.


Edited by GeN1e, 29 November 2017 - 09:59 AM.

Retired from modding.


#14 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 29 November 2017 - 12:34 PM

No I mean aside from that, when Avenger says it only works for 255 bits and temnix says no, it works just fine for values above 256... what is really going on there?

I mean, you can WRITE_LONG into a 2-byte field like kit, or a 1-byte field like level, and depending on whether the extraneous information does anything, it may seem like it "works." Until it doesn't because some interaction needs to use that next byte and you've gone and scrambled it.

If splstate.ids only encompasses one byte, and temnix is writing to bit 522, he is basically writing information to the 10th bit of a different byte, which may or may not involve data used in some other part of the game. And then his opcode 326 effect is tracking down that other byte and reading its 10th bit. Which may work... until it doesn't.

Point being, he maybe ought not say "nyah nyah, I tested it for values above 255 and it works fine!" It may only seem like it works fine. From what I've seen, some values above 255 work fine, but others don't. Maybe this is why - because the effect is writing and reading data in places that data doesn't belong.

Just surmising here. But given that there are unused values below 256, and people have generously shared macros to find and use the lowest available open slot, it seems like that would be wisest.

Edited by subtledoctor, 29 November 2017 - 12:36 PM.


#15 temnix

temnix
  • Member
  • 983 posts

Posted 29 November 2017 - 01:02 PM

Yeah, great. Instead of going out to all of the empty rooms of the house, let's stay in the same closet and flag-signal when we want to move our feet. "Everybody, turn left now... One, two, three, heave..."

 

:whistling:

 

The only way that BOY wouldn't really work would be... two ways, actually... If BOY and the next state, GIRL, triggered the same trigger; or if the CRE file was somehow overwritten in the wrong field after that 328's application. I don't see why, in the second case, the creature would trigger CheckSpellState; let's say the writing really goes to SEX or GENDER. Well, why would that still register as a spell state? But both possibilities can be tested. I just need to patch for BOY and run the baldur.bcs check for GIRL; and then MakeGlobal the boy and see if he's mutated in some other party of his anatomy.

 

Tomorrow.

 

Ardanis, that's a very unfamiliar version of Near Infinity. Something latest, I take it? Maybe only my legacy NI doesn't understand Weidu's input. Do the new versions create file copies immediately? If you "Add copy of," does the new file appear immediately, or do you have to refresh the tree? Old versions showed them right away, then there were updates that required refreshing, and that made editing much more bothersome...

 

Edit: 1) a trigger for GIRL doesn't react to BOY, the states are distinct, 2) the CRE of an exported boy doesn't seem to have anything different about it except the spell state.


Edited by temnix, 29 November 2017 - 02:26 PM.


#16 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 29 November 2017 - 02:58 PM

"why would that still register as a spell state?"

It doesn't that's my point. Spell states only cover 255 bits inside 1 byte in the game; when you flip a bit 266 bits further down the line, who knows what change you have really made? We can say with certainty that it it not a valid spell state. It is something else, which Near Infinity and opcode 328 are treating like a spell state. Maybe it works, and if so, God bless.

Of course you have paranoid delusions, so when I make a simple observation, somehow you interpret it as an attempt to persecute you, or something. Which, to be frank, is weird.

But for anyone else who reads these boards and like to mess around modding these games and is interested in knowing how spell states work, that's my theory. All values under 256 work because those are actual spell states; values above 256 may or may not work because those values are not actually spell states, and who even knows what information is in those bytes?

#17 temnix

temnix
  • Member
  • 983 posts

Posted 29 November 2017 - 04:36 PM

If it quacks like a duck...



#18 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 29 November 2017 - 04:53 PM

Do the new versions create file copies immediately? If you "Add copy of," does the new file appear immediately

Yes.


Retired from modding.


#19 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 30 November 2017 - 12:05 PM

So, there are 256 bits assigned to spell states. 1 byte = 8 bits. 8 dwords = 8*32 = 256 bits.

You are right, it does something for >256, but what it does is just an index overflow. 

It's really bad coding :)

Actually, the same as scripting states with opcode 282 in the original engine. It has only 10 valid scripting states, but you can use other values for 'funny' effects. 


Edited by Avenger_teambg, 30 November 2017 - 12:09 PM.

Avenger

#20 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 30 November 2017 - 12:39 PM

"Index overflow!" Right, that's what I'm saying. (Not a programmer, don't know the jargon.)

EDIT - also apparently I can't count to 8 :lol:

Edited by subtledoctor, 30 November 2017 - 12:50 PM.