Author Topic: Object's Client  (Read 1162 times)

How would I get the client of the dead guy in an onDeath?
The first arg is %this, the killed object.



Next time call a dump() on almost any class and you can get a list of variables and functions inside that object.

package Rewards
{
   function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x)
   {
      messageClient(%this.client,'',"Hai victim!");
      Parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x);
   }
};
activatepackage(Rewards);

It's being a hoe. Help?

package Rewards
{
   function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x)
   {
      messageClient(%this.client,'',"Hai victim!");
      Parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x);
   }
};
activatepackage(Rewards);

It's being a hoe. Help?

%this is a client.

package Rewards
{
   function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x)
   {
      messageClient(%this.client,'',"Hai victim!");
      Parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x);
   }
};
activatepackage(Rewards);

It's being a hoe. Help?
GameConnection = client

messageClient(%this,'',"Hai victim!");


You said killed object, so I thought you meant a Player object.


How would I get the client of the dead guy in an onDeath?
The first arg is %this, the killed object.
Ondeath already includes the client.
%this is the client.

I just lost the game.  :cookieMonster:
player's object = Player class
player's client = GameConnection


    function Player::setControlObject(%this, %target)
    {
   parent::setControlObject(%this, %target);
    }

    function GameConnection::spawnPlayer(%this)
    {
   parent::spawnPlayer(%this);
    }

package RewardSys
{
   function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x)
   {
      Parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x);
      %sourceClient.killCount++;      
      %this.killCount = 0;
      messageAll('',"Kill Streak:"%sourceClient.killCount);
   }
};
activatepackage(RewardSys);

Doesn't work... WTF?

Syntax error on this line:
messageAll('',"Kill Streak:"%sourceClient.killCount);

package RewardSys
{
   function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x)
   {
      Parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc, %y, %x);
      %sourceClient.killCount++;      
      %this.killCount = 0;
      messageAll('',"Kill Streak:" SPC %sourceClient.killCount);
   }
};
activatepackage(RewardSys);

Still not. :/

What's wrong with it?