Jump to content

Recommended Posts

Hooks will be conditionals that will, call a special upon being triggered.

 

Some examples of hook types:

  • A monster of type x is attacked
  • Food is consumed
  • The party steps onto terrain type x
  • A specific monster sees the party

The general idea is that these will run whenever a condition is triggered (and is scoped properly). Users should be able to scope globally, outdoors only, in towns, in specific towns. The hook will then populate some special SDFs and trigger a special (we can possibly include a way to scope the special type--for example town-scoped hooks trigger town specials).

 

For use in the specials chain, the hook system would also populate SDFs with relevant data, such as:

  • Party coordinates
  • Monster health
  • Terrain type
  • Spell ID triggered

(Some of these should probably be made universal, for simplicity and use elsewhere. I also plan on adding a few logic/arithmetic special for SDF manipulation and comparison)

 

We would also introduce some special hook-level special nodes:

  • Break Chain: This breaks the special chain similar to a C-style return statement. An extra var would specify whether to undo the hook-triggering action (such as moving onto a tile) if applicable.
  • (I was thinking things like disable hook, enable other hook, but these are all trivial to make happen with an SDF check . . .)

 

Some events may already have features similar to this, but having a comprehensive system would simplify things greatly. An example of this "in the wild" would be the following:

 

Imagine a room that gets filled with water. the party can be in the room when this happens. However, since they are submerged they have a limited supply of air, and will begin to lose HP if they run out of air.

 

So, we'll arbitrarily define terrain type 10 as "submerged floor". We'll define a hook of type HOOK_WALK_TO_TILE_TYPE (probably selected from a menu, like the special types), sourced at the town level, that checks the following:

 

  • Is the party inside the coordinate rect (our wet room)? (i think this is an existing special already, if not, we should define it at some point). If so, proceed:
  • Is the SDF 10,20 (our oxygen supply) greater than -1? If not, set it to 10.
  • Is 10,20 greater than 0? if so, subtract 1. If not, subtract 2 HP and display a message

 

Obviously, this is easily accomplished by way of setting a special on every tile in the room. However, that's kind of a cludge solution, especially with the current limitations (speaking from experience, you hit a "number of tiles that trigger specials" limit pretty fast).

 

It would also allow you to do more advanced things with, say, burglary (HOOK_MONST_SPOT_PARTY_STEALING), so instead of "town is angry" you can have, you know, actual things go on.

 

What are our thoughts on this feature? I feel like it wouldn't be _too_ hard to implement (hook registry in the save, code to load it at every potential scope/area change, and then a run_hooks(type) or something at every point we want to run a hook), plus the editor window stuff.

Edited by sylae
sorry for any bleh wording, its late
Link to post
Share on other sites

There's one hook that already exists (I think it's not called though) - a special event when seeing a monster of a certain type for the first time. I'm pretty sure your HOOK_WALK_TO_TILE_TYPE also exists already (check the terrain type format), though perhaps you're thinking of something a bit different. Actually, I think there are several node types that already function as hooks, aren't there?

 

I like the basic idea of this, though I'm not sure of the specifics. I'm not sure whether I like the use of special SDFs; it might be better to have some other means of getting that data, though I can't think of anything off the top of my head right now.

 

Oh, and I don't think we need a "break chain" special node due to the nature of the special node chain - if you want to break the chain, you just don't specify the next node. Can you think of a situation where this could not be done?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...