x


Network wont update

So i have this script on my "Hero" that attack target creature that i pressed on and that's the "target". Every creature have this Health Script and it work as it should. But when i hit the creature it wont send an update to all the other players so it wont die for them.

function Hit () {
if(target.GetComponent("Health").health <= target.GetComponent("Health").maxHealth)

{

networkView.RPC("LookLife", RPCMode.All, target.GetComponent("Health").health, damage, target.GetComponent("Health").armor);
}
else
target = null;
Debug.Log("You made " + damage + " damage!");

}

@RPC function LookLife(currentLife:int, Damage:int, Armor:float){

target.GetComponent("Health").health = currentLife - Damage*Armor;

}

more ▼

asked Apr 24 '12 at 12:09 PM

Denaton gravatar image

Denaton
1 2 3

Fixed it by moving the RPC function to Health because i trough i could not call target.GetComponent("Health").health in the attack script. But its all good now

Apr 25 '12 at 08:00 AM Denaton
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x711
x496
x249

asked: Apr 24 '12 at 12:09 PM

Seen: 358 times

Last Updated: Apr 25 '12 at 08:00 AM