Bootcamp multiplayer fire animation

Options
xentar
edited May 2011 in DotNet
I already posted this on Unity Answers, but 14days and no answer, asked on unity forums and the developers (Diego Cota from kingsmound), but still no answer, so going to ask here too, one never knows.

No idea if is just me, but i can't find a way to make the game (photon multiplayer bootcamp demo) show other players fire animation. Checked the 3 main animation/state files (playerlocal, playerremote and actoranimator) but i'm no really sure where is the problem. My guess is that is on playerlocal private void fire or setfire of playerremote, but no sure. Anyone had the same problem and know how to fix it? I'm more a designer than a programmer, so is giving me a hard time.
My other guess was that it work fine in unity pro, but some features don't work in unity indi... but someone tested it on Pro and the problem is still there.

Thanks in advance, and excuse if my english isn't the best (going to end being a regular here looks like, hehe)

Comments

  • Boris
    Options
    You sent me a private message in the unity forum and I replied. For some reason the unity forum doesn't show me any of my sent messages... If you happen to find it in your inbox please post it here... if not I have to check again..
    did you already check the doc here? http://developer.exitgames.com/bootcamp ... o/shotsync
  • xentar
    Options
    Ya, i received it. Sorry for don't answer back, my fault.
    Checked the whole documentation and i have the same, no changes (did again before answer you). Tryed too Activate and deactivate some booleans (was a bad idea in most cases) but the problem is still there.

    The aim, rotation, head, crouc, walk, run and jump animations work fine, the dmg of the oponent shot works too, but the fire and reload animation just don't run.

    Is just me that have this problem? if that the case, Murphy! you love me!!
    Must be something i'm missing...
  • Boris
    Options
    As far as I know you are the only one with this problem.
    Did you import into an empty project?
  • xentar
    Options
    Yeah, i did several times for test purpose.
    http://i39.photobucket.com/albums/e175/ ... roblem.jpg
    Here a screenshot of what i'm talking, just in case, in a clean import.
  • Boris
    Options
    try add some logging to see if PlayerRemote.SetFire is actually called
  • xentar
    edited May 2011
    Options
    I added debug.log on Internal void SetFire (i guess there is where you mean, sorry if i'm slow) and in some points inside it just in case, but nothing returned or appeared on the console.
    Added:
    No idea if this is something, but did a debug run with MonoDevelop and the debugger sent me an error on line 212 on Game.cs on Hashtable properties = (Hashtable)photonEvent[(byte)LiteEventKey.Properties];
    telling me that: A local variable named 'properties' cannot be declared in this scope because it would give different meaning to "properties", wich is already used in a 'child' scope to denote something else.
    Its the only problem the debugger found, but... no sure.
  • Boris
    Options
    ok, so I assume there is also no "EventAction() 103" in the log.
    This means the fire event does not arrive, so it' s probably not being sent.
    Do you see any "reload" or "fire" debug messages on the side where the player fires? It' s logged in PlayerLocal.Fire()
  • xentar
    Options
    Actually... no
    The only debug messages i see are eventaction() 102 - 106 and 91
    No Reload or fire log. Should appear when the local soldier fire?
    tested with a oponent shoting on the one logged with unity, no log when he fire neither.
  • Boris
    Options
    Gun.js is supposed to send the "Fire" message so that Fire() is being executed.
    Can you check if that script is still being used?
  • xentar
    edited May 2011
    Options
    Ok, deleted my last post cause found out that print worked more than debug (why? probably my fault)
    got a return from this 2. (you asked for this one no?)
    function Update()
    	{
    	    if(Local)
    	    {
    		    timerToCreateDecal -= Time.deltaTime;
        		
    		    if(Input.GetButtonDown("Fire1") && currentRounds == 0 && !reloading && freeToShoot)
    		    {
    			    PlayOutOfAmmoSound();
    		    }
        		
    		    if(Input.GetButtonUp("Fire1"))
    		    {
                    var h : Hashtable;
    
                    h = new Hashtable();
    
                    h.Add(1,Point);
    
                    h.Add(2,fire);
    
     
    
                    transform.root.SendMessage("Fire",h, SendMessageOptions.DontRequireReceiver);
    			    freeToShoot = true;
    			    cBurst = burstRate;
    		    }
        		
    		    HandleReloading();
        		print("FIRE1?");
    		    ShotTheTarget();
    		}
    		
    		else
    		{
    		        print("FIRE2?");
    		        ShotTheTarget();
    		}
    	}
    

    But still no return from SetFire in playerremote neither from playerlocar fire
  • Boris
    Options
    question is: did this happen?
    transform.root.SendMessage("Fire",h, SendMessageOptions.DontRequireReceiver);
    
  • xentar
    Options
    I get return if i put a print with him, but i'm near to sure that is not the way to check it out.
    You know a better way i can use to check this?
  • Boris
    Options
    the code above prints always "FIRE1", also if "Input.GetButtonUp("Fire1")" is false... the fire message is only being sent if it is true
  • Boris
    Options
    actually, I just noticed I have the same now, too
  • xentar
    Options
    don't tell me your fire animation don't run neither now!?
  • Boris
    Options
    yes.. I don't know why it worked before.. but now it doesn't..
    not sure if it broke when updating unity, or if I moved something in the project that broke it..
    I'm really a Unity noob...
    anyway, I found a fix that works:

    1) edit usePhoton.cs: add method below
    void Fire(Hashtable evInfo)
        {
    		if (GameInstance != null)
    		{	
    			if (GameInstance.PlayerLocal != null) 
    			{			
    			GameInstance.PlayerLocal.Fire(evInfo);
    			}
    		}
        }
    

    2) edit PlayerLocal.cs: make method Fire public
    public void Fire(Hashtable _hastable)
    

    3) edit Gun.js: replace all
    transform.root.SendMessage("Fire",h, SendMessageOptions.DontRequireReceiver);
    
    with
    var photon : GameObject;
    photon = GameObject.Find("_GameManager/UsePhoton");
    if (photon != null) photon.SendMessage("Fire",h, SendMessageOptions.DontRequireReceiver);
    

    In some cases you have to chose a different variable name.
  • xentar
    Options
    :shock: Awesome!
    Man! you saved me! it works wonderful! you can't imagine how happy i am right now. And looks like the new unity 3.3 gave some problem with the demo if happen to you too... But this way works!!
    too bad i don't live near you so i can invite you too some beers.
    Thanks, thanks a lot! and thanks for for your patience.
  • Boris
    Options
    Hehe, thanks- took me long enough, so thanks for your patience!
  • Boris
    Options
    I think it broke when I moved the Soldier from the root level to Soldier_Locomotion.

    Kingsmound suggested the following solution:

    1) edit Gun.js: add
    public var Soldier: GameObject;
    

    2) edit Gun.js: replace
    transform.root.SendMessage("Fire",h, SendMessageOptions.DontRequireReceiver);
    
    with
    Soldier.SendMessage("Fire",h, SendMessageOptions.DontRequireReceiver);
    

    3) Assign the Soldier to each Gun in editor (drag and drop to Gun.Soldier): Soldier --> GunManager --> M4 + M203
  • xentar
    Options
    Nice! both way work fine, Thanks alot again, Boris.