Usecode for Shapes above 1024?

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Usecode for Shapes above 1024?

Post by Knight Captain »

This old thread says NPCs must be in the 0x400+ range, but if that's the case, how can I add a new shape with Usecode short of overwriting ones below 1024?
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by drcode »

For higher numbered shapes, you can specify usecode for them using the "#shape(nnnn)" or "#object(nnnn)" directive in a function's definition.

So if you have, say, a piano with shape 0x701, you could write

void piano_function #object(0x701) {
...
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by agentorangeguy »

I was actually wondering about that again a few days ago, the npcs thing. NPC's higher than 255(?) or whatever it was, has the 0xffffffff or something that can be deleted and renamed... so i'm assuming you could make a function like "testnpc" which would be like a regular npc conversation, and call it by putting "testnpc" in ES npc window where you can delete the 0xffffff number?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by Knight Captain »

So void shapeTest shape#(0x405) () would not work?

The maximum number of shapes is 2048 (0-2047) currently, well beyond what mods would need. Or even a combined BG+SI.
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by agentorangeguy »

I'm actually up to shape number 1223 with no issues.

If i'm not mistaken, you can actually have more than one shapes.vga file? I've not tried this but seems like it might work.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by agentorangeguy »

hah dyslexic moment, just realized you said 2048 instead of 1248 :D
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by Knight Captain »

NPCs set to Usecode 0xffffffff use the function connected to their shape. It is possible to change any NPC to use any function, and there is a Usecode intrinsic to do this as well.

Both BG and SI use 0x400-x04FF for the 0-255 NPCs, but did not use the 0x500-0x5FF space much. It looks like this was intended for NPCs 256-355 (0x500-0x563) but largely unimplemented.

So it is possible to assign them in sequence.

Image

But as near as I can tell, there's no reason in a new mod to keep the 0x400-0x563 NPC functions tied to that range.

I hope that I can reimplement the NPCs in a higher range. Usecode seems to allow into several thousand functions. 0x5nnn worked in a quick test earlier.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Usecode for Shapes above 1024?

Post by Knight Captain »

Only one shapes file can be used, with the mod one acting as a patch on the original file. This is due to the way the shape number is tightly integrated with Usecode.
Locked