Page 1 of 1

Usecode Studio problem

Posted: Sun Apr 25, 2004 9:25 am
by Wizardry Dragon
Hey, it's me (not dead yet...)

Okay, still been working on my little project, even got Exult Studio and everything running fine, custom usecode and everything.

My problem is thus:

>> I add an NPC into the game, specify a usecode number, custom face, shape, etc.

>> I drop the NPC into the game. Everything works fine. Conversation works through all the options, the character says the random messages he's supposed to, follows his schedule, etc.

>> However, when I save the map and reload the game, Exult changes the Usecode function assinged to the character. So, for the character to work I have to reset the usecode number EVERY TIME I LOAD THE GAME. A tad annoying, that.

I am trying to set it to 0x564, but it keeps resetting it to different numbers (no apparent pattern in the number it assigns to).

Am I doing something wrong?

Patch in question:
http://crpgn.org/patch.zip

- Wizardry Dragon
U7: Giridion project

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 10:27 am
by Dominus
I'm sure I stumbled over something like this before...

Some help please, where do I find this character?

Edit again: Forget, I'm too stupid to remember how to edit exult.cfg so it works :-)

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 10:38 am
by Dominus
At first glance my suspicion is that it is caused by using an existing NPC and not having made a new NPC.

Second glance:
Created a really new NPC and expereinced the same problem. Curiosly it seems that there is a relation between NPC# and Usecode#. The created NPC had #0x8b and the usecode it wants to execute is always 0x48b.
In your patch the NPC # was 0x94 and the usecode it defaults to is 0x494.

Apart from that I wouldn't reassign NPCs (as it seems you hijacked one of the Skara Brae Ghosts).


Dr.Code any ideas?

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 11:25 am
by Dominus
a little reference to the relation of NPC# and Usecode#:
http://exult.info/forum/viewtopic.php?p=12938#p12938

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 11:27 am
by Wizardry Dragon
I used the "Create NPC" function in Exult Studio. Perhaps the problem lies there.

I see two possiblities:
>> Either Exult Studio is not creating "new" NPCs.
>> Or perhaps the values I entered messed it up somehow.

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 11:30 am
by Wizardry Dragon
Dominus - I'm afraid that didn't help much.

It would solve the first possibility if I were able to reassign or set at creation time the NPC number, but Exult Studio does not allow that.

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 11:54 am
by Dominus
how about setting usecode# accordingly to the 400+i (i=NPC#) rule?

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 12:11 pm
by Wizardry Dragon
That works, however that still leaves unresolved how the "Create NPC" option in Exult Studio grabbed a ghost from Skara Brae.

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 12:13 pm
by Wizardry Dragon
D'oh. Just realized I titled this thread wrong.

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 12:23 pm
by Dominus
That works, however that still leaves unresolved how the "Create NPC" option in Exult Studio grabbed a ghost from Skara Brae.
Yup, maybe Dr.Code can help.

Another thing I need to add to the Studio docs is that it is important people are using the same shape set. What I mean is that if the patch is done by BG+FoV it is quite possible that it will crash BG only games. We really need to remember that when releasing patches. (doesn't apply here, just as a rememberance)

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 12:27 pm
by Wizardry Dragon
Are there people that use plain BG? :-)

I just hope that wasn't an important ghost or something...
(which NPC did it grab, anyhow?)

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 12:50 pm
by Dominus
#148

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 12:52 pm
by Wizardry Dragon
Which is...?

I don't memorize the NPCs by number after all :-)

- Wizardry Dragon

(sorry if I'm being a pain)

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 1:20 pm
by Dominus
he he, in Exult press F2, N, 148 and you see more informations on this NPC. Might be it is an unused NPC.

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 1:26 pm
by Wizardry Dragon
Must be unused.

I teleport to him and I end up under a mountain :-)

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 3:02 pm
by PanSola
Way back home I have 5 1/2 inch floppy plain version, complete with cloth map, of U7 (and same for SI)... And I'm keeping a tower that has a 5 1/2 inch floppy drive in my closet (right now it's just collecting dust though) d-:

I've only played FoV and SS from my copy of the Ultima Compedium.

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 4:06 pm
by Iceshard-
I still have that map right beside me... With some highlighter stains from where my brothers highlighter broke. :)

P.S. - Sorry for hijacking the topic.

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 4:54 pm
by drcode
Okay, just caught up, and I think what's going on is:

1. The usecode number for NPC #n must be 0x400 + n, as Dominik indicated. It's probably a bug that ExultStudio lets you fill in any #, so I'll take a look at this tonight.

2. One of the SkaraBrae ghosts wasn't really part of the game, but we used to have a bug where we created it anyway (the extra mayor, I think). So it's correct that ExultStudio makes this # available for a new NPC.

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 5:05 pm
by Wizardry Dragon
I just worry that this may leave other NPCs to get gobbled up too. We don't need a "disappearing Lord British" bug :-)

- Wizardry Dragon


p.s.: or maybe we do? Hmm... (-:

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 5:49 pm
by drcode
Just looked at the code for setting usecode #, and the rule is:

1. if NPC # is between 0 & 255, then the usecode # is always 0x400 + n.
2. If NPC # is 256 or higher, than you can set it in ExultStudio.

I'll try to make EStudio follow this better.

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 5:51 pm
by Wizardry Dragon
That would be much appreciated :-)

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 6:00 pm
by Wizardry Dragon
You know what would really help to organize the Usecode would be the ability to break it down into seperate files.

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 6:22 pm
by SB-X
You mean what `rip' does?

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 6:23 pm
by Wizardry Dragon
No, I mean, the ability to compile UCC source code into Usecode from many different files, like C/C++/C#, Pascal, or almost any other programming language. :-)

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 8:07 pm
by drcode
Wizardry: You're right about the separate files. Currently, you can use "#include", and you can specify "-I" (although I'm not sure if that's ever been tested).

Another untested possibility: I think if you compile separate usecode files, you can just 'cat' the outputs all together into one big "usecode".

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 8:16 pm
by Wizardry Dragon
I'll go test that right now :-)

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Sun Apr 25, 2004 8:32 pm
by Wizardry Dragon
Okay, include seems to work, but it seems to take significantly longer to compile, at least for me... (another five or six seconds, trivial for me, but it is quite a bit longer than before; before it was near instantaneous.)

Then again, this is a 70k of raw source I'm compiling ... :-)

- Wizardry Dragon

Re: Usecode Studio problem

Posted: Mon Apr 26, 2004 6:52 am
by drcode
Odd; it shouldn't slow down that much. Maybe it's a bug.

Re: Usecode Studio problem

Posted: Mon Apr 26, 2004 11:04 am
by Wizardry Dragon
Perhaps, or perhaps the include# marco needs optimizing. Either way, it bears looking into. It is possible it is my machine, but I doubt it. I'm on a 2.8 gHz Intel Win XP Machine with 512 mb of ram.

- Wizardry Dragon