Thread: Object Messages

Results 1 to 3 of 3
  1. #1
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,320
    My Mood
    Doh

    Object Messages

    There are many situations within a game, that you might want the objects to pass information to other objects. One option is to get a handle to the object and get the instance of the class to which it is a member. But there are times where you want to pass information to a generic object without wanting to have direct access to the object's members. To do this, you can pass messages to other objects using the following method:

    Code:
    // Send this message to the player object
        ILTMessage_Write *pMsg;
        g_pLTSCommon->CreateMessage(pMsg);
        pMsg->Writeuint32(OBJ_MID_PICKUP);
        pMsg->Writeuint8(m_nPickupType);
        pMsg->Writefloat(m_fPickupValue);
        g_pLTServer->SendToObject(pMsg->Read(), m_hObject, hObj, 0);

    As you may notice, you need to create a message in the same manner that you create a message for any other purpose. You also need an HOBJECT handle to the object which is sending the message, and one to the object to which you wish to send the message.


    You will also notice above that the OBJ_MID_PICKUP is getting pushed onto the message.

    Code:
    (in shared/msgids.h)
        enum EObjMessageID
        {
            OBJ_MID_PICKUP = 0
        };

    This is a value that we have defined in game code which gets referenced by the target object to determine if it has a way to deal with the incomming message. This is done below.

    Code:
    uint32 CPlayerSrvr::ObjectMessageFn(HOBJECT hSender, ILTMessage_Read *pMsg)
    {
    	pMsg->SeekTo(0);
    	uint32 messageID = pMsg->Readuint32();
    	switch(messageID)
    	{
                case OBJ_MID_PICKUP:
                {
                    uint8 nPickupType   	= pMsg->Readuint8();
                    float fPickupValue        = pMsg->Readfloat();
                    g_pLTServer->CPrint("PlayerSrvr -> OBJ_MID_PICKUP  %d  %f", nPickupType, fPickupValue);
                }
                break;
            default:
                break;
        }
        return BaseClass::ObjectMessageFn(hSender, pMsg);
    }

    credits for once are to me and the lithtech jupiter enterprise package. Found this while learning about clientFX (because shits about to get real)

    commando: You're probably the best non-coder coder I know LOL


  2. The Following 2 Users Say Thank You to supercarz1991 For This Useful Post:

    Ch40zz-C0d3r (12-17-2011),neononxxx (12-10-2011)

  3. #2
    Ch40zz-C0d3r's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    839
    Reputation
    44
    Thanks
    400
    My Mood
    Twisted
    Thx!
    You can teach me please how you got this source code from CA?
    I need this very hard. Please PM me if you wanna help me

    Progress with my game - "Disbanded"
    • Fixed FPS lag on spawning entities due to the ent_preload buffer!
    • Edit the AI code to get some better pathfinding
    • Fixed the view bug within the sniper scope view. The mirror entity is invisible now!
    • Added a new silencer for ALL weapons. Also fixed the rotation bugs
    • Added a ton of new weapons and the choice to choose a silencer for every weapon
    • Created a simple AntiCheat, noobs will cry like hell xD
    • The name will be Disbanded, the alpha starts on the 18th august 2014



    Some new physics fun (Serversided, works on every client)



    My new AI
    http://www.youtube.com/watch?v=EMSB1GbBVl8

    And for sure my 8 months old gameplay with 2 friends
    http://www.youtube.com/watch?v=Na2kUdu4d_k

  4. #3
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,320
    My Mood
    Doh
    i didn't get it from CA, i got it from the lithtech jupiter game engine documentation

    commando: You're probably the best non-coder coder I know LOL


Similar Threads

  1. Replies: 11
    Last Post: 02-18-2008, 01:23 PM
  2. Korean Error message on "Game Start"
    By sr25lover in forum WarRock Korea Hacks
    Replies: 25
    Last Post: 05-27-2007, 10:06 AM
  3. top of screen message hack
    By hjerherjdsd in forum WarRock - International Hacks
    Replies: 30
    Last Post: 07-31-2006, 07:39 PM
  4. message to razz and all
    By predatorgod in forum WarRock - International Hacks
    Replies: 6
    Last Post: 05-30-2006, 02:45 PM
  5. Gunz Error Message
    By A7X Oblivian in forum Gunz General
    Replies: 2
    Last Post: 02-08-2006, 03:00 PM