Feture Added to Item object - Elevate "area" events to UObject.

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
Distro Developer
Posts: 2781
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas

Feture Added to Item object - Elevate "area" events to UObject.

Post by Yukiko » Wed Apr 25, 2018 12:11 am

Elevate SYSEVENT_ENTEREDAREA and SYSEVENT_LEFTAREA to UObject or if not that add them laterally to item objects.

For years I have wondered why this is restricted to only NPCs. I cannot see any disadvantage to giving these events to all UObjects or at the very least adding them to the item object. I have spoken to Nando about this and he thinks maybe it was to avoid server load. That may be true but, if I understand how these things work, any additional load would only be for objects that have enabled events. We can already enable items for speech events. That seems to me to be more of a potential for server load than "area" events.

Reason for this request: Currently there are two ways to determine if a character has entered an area near an item.

One is to have a control script that from time to time scans a ranged area around the item for mobiles. This method can add considerable overhead depending on the size of the area to be scanned, how long the control script sleeps between scans, and the number of items that need to scan areas for mobiles.

The other way is to use an NPC to detect entered area. This requires the following steps in your CreateScript for the item:
1. Create an NPC on top of the item.
2. Make it invisible (concealed)
3. Freeze or paralyze the NPC.
4. Enable events for that NPC.
5. When a mobile enters the area the NPC "notifies" the item that a mobile has entered the area in question.

This method is a kluge at best. It also requires at least one custom NPC just for "item entered event" handling. It also adds to the mobile count one (1) NPC for each item you want to be able to detect "area" events.

As you know I do not speak C++ but this does not sound like something too difficult to do.

Just imagine something as simple as an item you want to remain hidden until a player with the correct CProp enters a certain range where the item reveals itself. Now imagine you have say, 50 of that item placed around the world. If items had the "area" events it would simplify the task of scripting those items and reduce script overhead.

Distro Developer
Posts: 97
Joined: Sun Jul 17, 2016 1:29 am

Re: Elevate "area" events to UObject.

Post by ThisIsMe » Thu Apr 26, 2018 11:24 am

I concur with this. I think it would be dandy indeed to have this implemented.

I know the concern is potential server load but if I understand how these work, the only items that would have an enter area or leave area events attached to them are those that register and listen for them.

So assuming I'm actually correct on this it comes down to the user being frugal on using these, similar to npcs, I mean if you have a building with 1000 sheep or more as happen on a shard I used to play on, yes there's a problem. But the idea in most cases would be to have items that are either in relative limited supply to players or unavailable for player placement.

The create npc to handle listening on an item doesn't seem like it would be a much better solution as that's an additional npc for at worst one item at best multiple items in an area and I just think again assuming I'm correct in how enter and leave area works, it'd be better to just have at the item level.

So this definitely gets a gold star of "I want this approved" from me.

Post Reply