Page 1 of 1

Finding Object Numbers?

Posted: Sat Jun 04, 2016 11:51 pm
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?

Re: Finding Object Numbers?

Posted: Sun Jun 05, 2016 2:14 am
by Knight Captain
So that's his Usecode number, rather than his NPC number. :)

Re: Finding Object Numbers?

Posted: Sun Jun 05, 2016 3:45 am
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?

Re: Finding Object Numbers?

Posted: Mon Jun 06, 2016 7:52 am
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.

Re: Finding Object Numbers?

Posted: Sun Jun 19, 2016 9:32 am
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?

Re: Finding Object Numbers?

Posted: Mon Jun 20, 2016 8:12 am
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.