1 (edited by hgaur725 2015-01-14 02:05:24)

Topic: Player selection??

how to set the player selection to one i.e user can only select player P1 and Player P2 is automatically selected by the cpu?

Share

Thumbs up Thumbs down

Re: Player selection??

You basically need to code up an Arcade Mode of sorts.  This post from MMind tells you where to look.  My advice is to look into the CharacterSelectScript file and try and work it out from that.

The theory is you want the CPU (Player 2) selection to be handled in the same function/loop as the Player 1 selection.

Take a few days to try and work out.  If you still can't figure it out, post back here and I can give you some hints.

Share

Thumbs up Thumbs down

Re: Player selection??

Yum yes I am trying sort of arcade mode and I had gone through the character selection script for last two days.I tried the way in which when player one is selected then player0p2 AI is selected but doent quite fitted. Plz can u give hints as I have lots of time. I will very thankful to u..

Share

Thumbs up Thumbs down

Re: Player selection??

Where is it failing on your implementation?  I can't tell what "doesn't quite fitted" means...

Share

Thumbs up Thumbs down

5 (edited by hgaur725 2015-01-15 02:23:37)

Re: Player selection??

if (!p1AxisHeld && UFE.config.player1Character == null){
            p1HoverIndex = CharacterMenuSelection(p1HoverIndex, p1InputController, p1InputController.horizontalAxis, p1InputController.verticalAxis);

            if (p1InputController.GetButtonDown(UFE.config.inputOptions.confirmButton)){
                this.SelectCharacter(1, p1HoverIndex);
                                 this.SelectCharacter(2, p1HoverIndex+1);

            }
        }

i had use this to select the player 2 automatically but it is not working i have to click the player icon to select the player2...

Share

Thumbs up Thumbs down

Re: Player selection??

hmm, that actually looks OK.  I think you might still have a function to start the game when P2 is selected.  You need to move that code into the the GetButtonDown() you have here.

Share

Thumbs up Thumbs down

Re: Player selection??

if (!p1AxisHeld && UFE.config.player1Character == null){
            p1HoverIndex = CharacterMenuSelection(p1HoverIndex, p1InputController, p1InputController.horizontalAxis, p1InputController.verticalAxis);

            if (p1InputController.GetButtonDown(UFE.config.inputOptions.confirmButton)){
                this.SelectCharacter(1, p1HoverIndex);


            }
        }



i had commented these lines just to check that is player is still selecting on click or not, but it is still selecting player on click which i dont want can u plz tell where i am i wrong in that,

Share

Thumbs up Thumbs down

Re: Player selection??

well this the part of code which i edited in the character selection script and through which i had achieved that if user clicks the player p1 icon then player p2 will be automatically selected and random too.


if (Network.peerType == NetworkPeerType.Disconnected){
                        // If it's a local game, update the corresponding character immediately...
                        if (UFE.config.player1Character == null){
                            this.SelectCharacter(1, currentIndex);
                            this.SelectCharacter(2,nextplayer);
                        }else if (UFE.config.player2Character == null){
                            //this.SelectCharacter(2, currentIndex);

                        }

here next player is int value which is equal to random.range . now all i want is how to set if player beats enemies they should continousely comes . i.e user should can only select only one player and he have to fight with it till he looses..

Share

Thumbs up Thumbs down

Re: Player selection??

So you're saying it's still selecting Player 2 on click, even after you removed the code that selects Player 2?  Only explanation for that is you have another bit of code that selects Player 2 somewhere...

If you're using MonoDevelop, you can right click any function or variable and search for occurrences.  You should be able to find if Player 2 is being selected elsewhere.

Share

Thumbs up Thumbs down

Re: Player selection??

@yum: I think u didn't got my point. Now player p2 is automatically selected when I click the player p1 .so now what I am asking is how can I make arcade mode works when player p1 defeat enemies I mean after he defeat one enemy next one shud come I hope I am clear now ..

Share

Thumbs up Thumbs down

Re: Player selection??

Oh sorry, I didn't actually see that post, I was replying to the one before.

OK, so the good news is the initial character select is working.  Excellent.

Yes, you'll now need to modify the start/end of each match to trigger a new player.  This is harder, but here's the theory behind it:

Probably the easiest thing to do is to get the game to start a new fight after you won the first fight.  Even if it's with the same opponent for now, or a random one (you can sort out the opponent order later). 

You will need a vs screen, basically a transition between the end of one match and the start of another.  This screen can also be used just before the first match.  This screen will also handle assigning the next opponent and stage.

The idea is you want to have space where you can remove all the stuff from the previous match and create all the stuff for the new match.

Find the code that creates the match.  Basically copy it into your vs screen code, and understand what you'll need to remove at the end of each match.  You may also need to remove that match creation code from where it was originally, depending on how you're doing your vs screen.

Take a week to figure this out.  If you're still stuck after a week, post back.  This might be hard for a first time coder, but getting this right will give you a huge understanding of how UFE handles matches.

Share

Thumbs up −1 Thumbs down

Re: Player selection??

hgaur725 wrote:

well this the part of code which i edited in the character selection script and through which i had achieved that if user clicks the player p1 icon then player p2 will be automatically selected and random too.


if (Network.peerType == NetworkPeerType.Disconnected){
                        // If it's a local game, update the corresponding character immediately...
                        if (UFE.config.player1Character == null){
                            this.SelectCharacter(1, currentIndex);
                            this.SelectCharacter(2,nextplayer);
                        }else if (UFE.config.player2Character == null){
                            //this.SelectCharacter(2, currentIndex);

                        }

here next player is int value which is equal to random.range . now all i want is how to set if player beats enemies they should continousely comes . i.e user should can only select only one player and he have to fight with it till he looses..

It would probably be easier to call the random number directly in the selection instead of assigning another variable (more variables = more memory use). Plus, you can set player 2 to AI at the same time.

if (UFE.config.player1Character == null){
    this.SelectCharacter(1, currentIndex);
    UFE.SetCPU(2, true);
    this.SelectCharacter(2, UnityEngine.Random.Range(1, 8));
}

Share

Thumbs up Thumbs down