Page 1 of 1
Location-Based Proximity
Posted: Sat Jul 23, 2016 4:00 pm
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.
Re: Location-Based Proximity
Posted: Sat Jul 23, 2016 5:47 pm
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.
Re: Location-Based Proximity
Posted: Sat Jul 23, 2016 6:21 pm
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.
Re: Location-Based Proximity
Posted: Sat Jul 23, 2016 7:17 pm
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.
Re: Location-Based Proximity
Posted: Mon Jul 25, 2016 12:03 am
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.