Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

PowerQuest

A Nifty 2D Adventure Toolkit for Unity · By Powerhoof

Make a second character follow main character

A topic by Astropez created May 25, 2022 Views: 187 Replies: 2
Viewing posts 1 to 3

Heya!

First of all, thanks for this amazing tool! I've had lots of trouble with other Adventure Game tools (like Adventure Game Creator) and being close to AGS it was nice to see it! I'm having lots of fun with it, although the documentation could use a ittle more fleshing out, it sometimes is a bit nebulous (nothing a bit of experimentation can't fix of course).

Now, I'd like to have a support character following the main character wherever they go. I've been going around with using C.SupportCharacterName.WalkToBG(C.Player) on the Update() method, which works quite well but needs doing on every Update() method of each room, alongside a C.SupportCharacterName.Room at each change of room. I could not find a more elegant solution on the Scripting API. Is there any?

Basically the support character would need to be in the same room than the main character, including when E.ChangeRoom() is called. Potentially it would also have to follow the player in general, though sometimes randomly wandering around points of interests (like props). I thought of just changing the E.ChangeRoom() itself to change both the player and the support character at the same time but I haven't been able to find where to modify that. I'm not asking for the code to do it, just where I can change it for my need?

Cheers :)

(1 edit)

Hi Astropez!

Yeah, the documentation is very hit and miss. I think without asking things here or in the discord it'd be pretty hard to figure a lot of things out ;)

There's no built in 'follow character' system like in AGS. Partly because there's a few ways to do it and each time I've done it myself its' been quite different. (See the source for Coatrack and Wizard Force)

I think the thing you're looking for though, is the GlobalScript Update function. So having your code in there rather than in each room.  Then you can do 

if ( C.SupportCharacterName.Room != R.Current )
    C.SupportCharacterName.Room = R.Current;

And they'll move immediately to the room you're in. I guess you might want to couple that with some timers so that it's not instantaneous, etc... But that's up to your implementation.

Another function that's useful is StartFacingCharacter() and StopFacingCharacter(). Which get a character to turn to face another automatically with a random delay. 


Anyway, let me know how you get on, any followup questions, etc. The Itch forums are a bit quiet compared to the Discord, so check that out too if you want.

Heya!

Thanks for the swift response!

I will definitely check the source codes you're suggesting (and take the chance to play them at the same time  :)). Yes that's where I could not find it. I will change there and see how I can personnalise the follow of the main character I'll come back if I have any additional question on that side !

Cheers