Location-Based Proximity

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

Location-Based Proximity

Post by Knight Captain »

I'd like to have a newly-added NPC react when the party is on the entry pathway into Fawn so that he barks and leaves the party. The coordinates I am trying are [1024, 1952], [1039, 1967] or [0x400, 0x7A0], [0x40F, 0x7AF], the top half of the pathway in, but using these with or inside PROXIMITY does not seem to work.

Code: Select all

	var pos;
	pos = get_object_position();

	if (event == PROXIMITY)
	{	
	get_object_position();
		{
		// Fawn [1024, 1952], [1039, 1967] or [0x400, 0x7A0], [0x40F, 0x7AF]
		if (pointInsideRect(pos, [0x400, 0x7A0], [0x40F, 0x7AF]))
			{
			delayedBark(MYNPC, "@Not bloody Fawn!@", 1);
			gflags[911] = true; // testing only
			}
		}
	}
I have a few of these I'd like to add in Usecode rather than map edit / add eggs, so any advice is appreciated.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Location-Based Proximity

Post by marzo »

Proximity usecode is triggered only by some schedules (as I believe I said to you in one of these threads). Specifically, only loiter, tend shop, dance, hound, sew or bake schedules trigger proximity usecode.

If you want to make the NPC react the way you want, you need to add a usecode egg on the way to Fawn and make this egg's usecode detect that the NPC is in the party, then make him say that.
------
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: Location-Based Proximity

Post by Knight Captain »

Good point. Being asleep, in the party (following Avatar), waiting, and maybe others really prevent a lot of things from happening.

Patrol still allows Proximity events.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Location-Based Proximity

Post by Knight Captain »

What I found when bringing the Skullcrusher automatons to life is that it is possible to repurpose or add purpose to eggs. Ones that auto-reset work best, though that is not required.

So in this case, the egg that prevents the drawbridge from lowering in Fawn when a party member is accused can also function as an entry check: object#(0x6BB)

There's also eggs under the doors into Sleeping Bull, 0xCB0, but these are not defined at all in the released Usecode.

There aren't any eggs that auto-reset entering Monitor from the north or entering Furnace nearby. The Gorlab ones do not auto-reset so I'm not sure how the sleep-dream function is re-triggered.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Location-Based Proximity

Post by marzo »

Patrol technically does not allow proximity events, not like the other schedules anyway. It merely calls usecode for certain kinds of path eggs, while the others are random.
------
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