Opened 6 years ago

Last modified 6 years ago

#134 new enhancement

A Hook for Active Buffs

Reported by: schwanz9000 Owned by: Alloc
Priority: minor Component: Server fixes
Keywords: Cc:


Would it be possible to get a hook for active buffs?

I'd like to have a custom buff to apply to a block and use the buffwhenwalkedon property. I could then use the hook in a custom dll to trigger the start of a quest, a "Welcome to Thistown" message, or even trigger zombies to spawn.

I basically need a way to trigger an event when a player steps on a block or is in a certain area.

Let me know your thoughts or if you have something better/similar already planned. Thanks!

Change History (3)

comment:1 Changed 6 years ago by zigstum

We are doing something similar - an advanced claim feature that teleports a player away if they enter the advanced claim area of a non-friend.
We use a frequent 'lp' command to the webapi to get online players current positions and check them against the stored adv claims.
You could use this method to see if a player is within the required block boundary, and respond with an executeconsolecommand?command=buffplayer+steamid+name_of_buff to the web api.

comment:2 Changed 6 years ago by Alloc

@schwanz9000: Not sure I got what you actually are asking for ;)
Are you talking about a hook that's called when a buff is triggered (and maybe dismissed) or a hook for when a player enters a certain area?

A hook for buffs should be possible (but probably not before A16), for entering a certain area is "harder" though as I can't think of anything better than polling all players' coordinates and comparing them to all registered hook areas.

comment:3 Changed 6 years ago by schwanz9000

A hook for buffs.

A custom block with a custom buff could be used as a trigger for a player entering an area.

Say the buff name is "Catacombs". When a player steps on that block at the entrance and gets the buff "Catacombs", it triggers the hook and starts a function that automatically starts spawning zombies in specific locations inside of a POI at timed intervals. I have the spawning code currently running on my server, but the players have to use a custom forward slash command in the chat window to trigger the start of the spawning cycle.

I would like "something" as an automatic player provoked event to trigger custom functions.

Would polling all players' coordinates spam the server too much as you and Zig have suggested?

Note: See TracTickets for help on using tickets.