multiple characters DOTT style

Started by lafouine88, Sun 03/05/2020 21:33:17

Previous topic - Next topic

lafouine88

Hi guys

I want to be able to play several characters in my game. Like in DOTT or thimbleweed park, and to be able to pass items from one to another.

I found the cChar.SetAsplayer tool can switch characterplayers, but if it changes the inventory, speech color (so I guess it really did change characters)... I still have the same animating view as the initial character. Should I go with a changeview script or so ? But in this case do you know if it's gonna change my idle and thinking views that were already set for each player. Or is there an easier way.

Second little issue is about the GUI graphic. I made a cliquable GUI that switches from one character to the other using a variable. But I don't know how to change the picture of the GUI so that it displays the other character's portrait each time I change. I guess this is very basinc coding but I could find a precise answer in the manual.

Thanks in advance :)

Cassiebsg

When you change player character they get the characteristics you set them them to have when you created the characters. They also each have their own inventory. If you are experiencing something else, please say exactly what it is that it's not working, and eventually show the code you're using.

As for the second question about GUIs you don't say how you have set the pictures in the GUI, are they buttons? If so, you just use button.NormalGraphic.
There are those who believe that life here began out there...

lafouine88

#2
Thanks for your quick reply.

For the GUi, I didn't create a button, just a normal window which seemed to work. But I'll go with a button if it's easier to change the graphics.

As for the character change, I 'll be more specific :
main character : Bob with walkviews,inventory etc.
secondary character marc, different walk speech color and inventory.

I just used a script in the GUI "on click" :
Code: ags
if (player ==cBob)
{cMarc.SetAsPlayer();}
else {cMarc.SetAsPlayer();}


which seems to work because the inventory changes, and the speech color too. But the character sprite doesn't. It keeps the one from Bob although I play with marc and did set a different view for him.
I'll keep checking what I did wrong.


EDIT : So stupid!I overrid the characterview just in the room he was to check sthg and forgot to remoe it.
Apologies for the inconvenience->TOPIC CAN BE DELETED

Thanks :)

Cassiebsg

If it's the GUI background image, the command is: GUI.BackgroundGraphic
There are those who believe that life here began out there...

Olleh19

Create two Gui Buttons and do this code. It looks nice when the other characters portrait is slightly fadedout. :)

Code: ags
function gPort_OnClick(GUI *theGui, MouseButton button) 
{
  
    if(gPort.Transparency==70 && gHoi.Transparency==0)
{
    gHoi.Transparency=70;
    gPort.Transparency=0;
    cPort.SetAsPlayer();
}


and same code for other characters, but different button/characters ofc. Probably can be done better. I'm just a n00b, but works fine for me


imsomnia212

#6
When I was working on the Thimbleweed Park Dott Version I did it in this way:

I added 2 buttons (Because I never continued making the game, but you can add the buttons amount per character you have)
And I added the following code in the OnClick function.
Code: ags
function btnReyes_OnClick(GUIControl *control, MouseButton button)
{
  if (player == cReyes) {
  }
  else {
    cReyes.SetAsPlayer();
    btnReyes.NormalGraphic = 325; //Button Sprite with the Reyes face off
    btnRay.NormalGraphic = 322; //Button Sprite with the Ray face on
  }
}

function btnRay_OnClick(GUIControl *control, MouseButton button)
{
  if (player == cRay) {
  }
  else {
    cRay.SetAsPlayer();
    btnRay.NormalGraphic = 326; //Button Sprite with the Ray face off
    btnReyes.NormalGraphic = 323; //Button Sprite with the Reyes face on
  }
}


Screenshots:
Spoiler
[imgzoom]https://i.imgur.com/7gQ4G2t.png[/imgzoom]

[imgzoom]https://i.imgur.com/Jk7qYvs.png[/imgzoom]
[close]
Are u a tuna?

SMF spam blocked by CleanTalk