Making an object with a "Join" and "Ask to join" interaction
Hi there modders!
I'm making an object that allows a Sim to protest a variety of things, waving a placard and looking rather annoyed. So far it works as long as the Sim is protesting alone. But there's a bit of a problem, I don't know how to make it so that:
- with the selected sim, while they's protesting, you can click on another sim and choose "ask to join protest" so that they walk next to you and wave the same placard
- with a sim that's not protesting, you can click on a sim that's protesting and choose "join protest". Your sim will walk to the protester and wave the same placard.
I've checked out TV Semiglobals but most of the code is incomprehensible to me, and I'd love it if someone explained how to make a "join" and "ask to join" interaction a little more clearly than that. I'm still not very good at BHAVs...
ATTACHED: The custom animation, the custom placards and the custom protest-inducing object (still requiring social BHAVs) in case you want to have a look.
If you like Greek mythology and humour, go check "Zeus & Sons", my webcomic Id pro lulzis feci.
I've not done this myself, so I'm not sure how helpful I can be... But here's what I *do* know, in the hopes that it might give you a faint idea of where to look?
For *true* joinables:
- Joinable interactions need to be flagged as such in the TTAB ("joinable")
- The interactions with this flag tend to be the initiating actions. So, if a single sim can choose to "protest", then the "protest" action would be the one which was joinable. (That is, you don't create a separate menu item for "join in protesting")
- In the guard BHAV for the interaction, you normally call "[global 0x019A] Join - Can Join? (no args)", with the true target pointing to an "Add/Change the Action String" (which then sets the menu item dynamically to "Join".)
- There's some nice sample code in the hot-tub, although I think that's only from the "please join me" side, rather than the "may I join you" side. I suspect, but have never tested, that the code could probably be applied to a social plugin interaction with a bit of tweaking, but it's probably not a one-to-one copy.
For *fake* joinables (with which I have slightly more experience!)
- Just add a couple of social plugins - "Ask to join Protest" and "Join Protest". Have both of them defer their actual interaction to your original interaction. It's a bit hacky, but it's also much better documented. The downside of this is that they won't engage in the multi-person group social behaviour that things like the TV and the dining table have, where everyone gives everyone else social and mood boosts (unless you code it yourself, of course!)