Finding Object Numbers?

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

Finding Object Numbers?

Post by Knight Captain »

In the SIfixes file goblin_simon.uc, how did you determine the object number of Goblin Simon's corpse? Or any other objects?
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Finding Object Numbers?

Post by Knight Captain »

So that's his Usecode number, rather than his NPC number. :)
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Finding Object Numbers?

Post by Knight Captain »

I'm trying to get Shmed's corpse to include the fishnet stockings and set the global flag 123 so they become a conversation item. How do I do this?
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Finding Object Numbers?

Post by marzo »

Open Exult and go to where the item in question is. Now press Crtl+Alt+M to enter mapedit mode and launch ES. Go back to Exult and double-click the item in question; a dialog will pop up showing shape and frame. Then:

* If you double-clicked an usecode egg (green horseshoe), the "Function Number or Name" field is the egg's "object#" if it is a number.

* The "shape #" field is used with "shape#" in UCC. This is used when no other usecode is available and you double-click something. You want to specify this as shape# instead of object#: a shape# function is an object# function with additional handling by Exult, namely that it is automatically paired to the shape.

* For NPCs, the "Usecode" field is the "object#", unless it is 0xffffffff — this means "no usecode assigned, use shape# instead". For the first 256 NPCs, this defaults to 0x400+NPC number.

* Weapons can also execute usecode when they hit. After seeing their shape#, open shapes.vga in ES, find it on the right pane, and open its shape info window (double-click). In the "weapon" tab you can see a "Usecode" field, which is another object# for the weapon.

* Some rare items also have frame- or quality-specific Usecode. Looking over, this is only the case for books in the stock games. In any event, go into shape info window as above and see if it has a "Frame Usecode" tab. If it has, the frames and qualities in the list will use the given Usecode.

I think those are all the cases.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Finding Object Numbers?

Post by Knight Captain »

I've retried a bunch of ways to have Shmed's death cause the setting of global flag 123. Despite stealing from existing SIfixes code for the death from Simon and the Global Flag setting line from Gwenno, it still does not work as expected. How can I do this?

I tried within SIfixes, adding the flag to the flaglist and correcting Shmed's name from Schmed to Shmed in a few spots.

Code: Select all

void Shmed object#(0x44b) ()
{
	if (event == DEATH) 
	{
		gflags[FOUND_FISHNETS] = true; 
	}

	Shmed.original();
}
And this, outside of SIfixes:

Code: Select all

#game "serpentisle" //This should be set elsewhere in larger patches.
#autonumber 0xD00

enum quickdirty //just needed something here to allow compiling
{
	DEAD = 4, //constants.uc
    //SHMED = -75,
	FOUND_FISHNETS = 0x7B //123, si_flags.uc might need to be updated
};

void Shmed object#(0x44b) () //NPC75

{	
    if (get_item_flag(DEAD)) //If Shmed is dead...  to simplify from constants.uc
		{gflags[FOUND_FISHNETS] = 1; //Set global flag to ask about fishnet stockings.
        }
    else Shmed.original(); //He's his usual self.
}
The furthest I've gotten to work is this silly patch code that replaces all of Shmed's activity and speech with just the ability to double-click him to set the flag.

Code: Select all

#game "serpentisle" //This should be set elsewhere in larger patches.

void Shmed object#(0x44b) () //NPC75

{
gflags[0x7B] = true; //Otherwise set flag to ask about fishnet stockings.
}
If I'm reading your post correctly, Marzo, I might have to edit Shmed's belongings in ES to add the item to him?
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Finding Object Numbers?

Post by marzo »

event == DEATH only ever happens if tournament flag is set; it happens when you cause enough damage, in one blow, to kill the target. You would then need to unset the flag and cause a lot of damage to kill him in usecode.

A character's usecode also never triggers after he is dead.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Locked