usecode question

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
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

usecode question

Post by agentorangeguy »

Hello all, I've got a usecode question I need help with...

I've been trying to fiddle with the usecode to make npcs stand a certain way with the "stand" schedule. For example, I'm working on Jhelom in the U6 mod I've been working on and some npcs are supposed to face a certain way while standing rather than just at random. I can't seem to get it to work in usecode. Is there a certain way to do this?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by Malignant Manor »

The schedules you can modify with Exult and Exult Studio are defined in the game engine (Exult). You can edit the NPC's usecode to achieve what you want with a delay.

The following will check the npc periodically when the Avatar is near and if the npc's schedule is standing. If the npc is not standing north, it will change its frame. You'll need to check how well it works for you.


Code: Select all

void Dupre object#(0x404) ()
{
	var PROXIMITY = 0;
	var STANDTHERE = 10;
	
	if (event == PROXIMITY && get_schedule_type() == STANDTHERE
				&& get_item_frame_rot() != 0)
		set_item_frame_rot(0);

	Dupre.original();
}

Edit by wjp: removed the extra space mentioned below.
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by agentorangeguy »

it didn't seem to compile. are there missing brackets in it somewhere?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by Malignant Manor »

Somehow a space found its way in.

Code: Select all

set_item_frame_ rot(0);
should be

Code: Select all

set_item_frame_rot(0);
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by agentorangeguy »

I saw the space and fixed that, I forgot to mention that. Even without the space, it didn't seem to work so i thought maybe there were some brackets missing somewhere?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Malignant Manor
Site Admin
Posts: 985
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by Malignant Manor »

It compiles just fine for both games but is the wrong npc for SI. Dupre does not have the stand schedule by default in BG. It's hard to know what your problem is without your source code or even an error message.
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by agentorangeguy »

Ok I was just doing it wrong, i got it to work now, thanks!
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by agentorangeguy »

I'm trying to work on a few npc healers. I successfully made the usecode in the conversation work to where it will heal an npc to the exact hit points they should have, and to cure the npc. I cannot seem to figure out how to do make them resurrect someone. any ideas how to do that?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: usecode question

Post by Wizardry Dragon »

A bit of a belated answer, but you can find all of the healing code you need in the Healing Services UCC code in TFL, which is of course GPL code:

http://u7feudallands.cvs.sourceforge.ne ... iew=markup

----------
Peter M Dodge
aka Wizardry Dragon
www.thefeudallands.ca
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Locked