-
Notifications
You must be signed in to change notification settings - Fork 44
[WIP] Summoning followers #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
var accountName: String = "", | ||
var passwordHash: String = "", | ||
val body: BodyParts = BodyParts(), | ||
var follower: NPC? = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variables can be used for this, a custom var storing the follower id will be needed, it's also better to store the npc index and look-up the NPC rather than store the NPC directly to prevent accidentally using (and the garbage collector not being able to delete) npcs that no-longer exist
e.g.
var Player.follower: NPC?
get() {
val index = this["follower_index", -1]
get<NPCS>.get(index)
}
set(value) {
this["follower_index"] = value.index
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was planning on changing this. Wrote that quickly just so I could get the dismiss button working.
One problem I'm having with this approach is that index is -1 for a tick, so I can't immediately set follower when the npc is added. I can queue it, not sure if that's the correct approach though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah that's a good point, using the world queue for that should be fine just make sure the name is unique
This is sick. |
Thanks, slowly working my way through it when I have the time 😅 |
…llower if applies to both)
3acfb65
to
ece4665
Compare
This is a WIP PR to add summoning followers to the game. This is intended to just the be basics of having followers and then in a future PR things like familiar combat, scroll effects, etc can be added.
Known Bugs: