1

Topic: [CODE]Need a help

Please help me get coordinates cursor in teeworlds in default sources.

2 (edited by unsigned char* 2016-07-01 21:37:24)

Re: [CODE]Need a help

Server Side:

const vec2 MousePos = vec2(m_Pos.x+m_LatestInput.m_TargetX, m_Pos.y+m_LatestInput.m_TargetY);

** m_Pos is the character position (CCharacter)
** m_LastestInput is the lastest input received (CCharacter)

Client Side:

const vec2 MousePos = vec2(Position.x + m_pClient->m_pControls->m_LastData.m_TargetX, Position.y + m_pClient->m_pControls->m_LastData.m_TargetY);

** Position is the character position
** m_LastData is the lastest input sent

For me this works...

3

Re: [CODE]Need a help

unsigned char* wrote:

Server Side:

const vec2 MousePos = vec2(m_Pos.x+m_LatestInput.m_TargetX, m_Pos.y+m_LatestInput.m_TargetY);

** m_Pos is the character position (CCharacter)
** m_LastestInput is the lastest input received (CCharacter)

Client Side:

const vec2 MousePos = vec2(Position.x + m_pClient->m_pControls->m_LastData.m_TargetX, Position.y + m_pClient->m_pControls->m_LastData.m_TargetY);

** Position is the character position
** m_LastData is the lastest input sent

For me this works...

Big thanks it helped me))

vec2 CursorPos = m_Pos+(vec2(m_LatestInput.m_TargetX, m_LatestInput.m_TargetY);

You can help me with this: *My question*

How to change the gravity to one player if he makes some action?

I learned how to change the gravity to all players at some action. I do not know how to change the gravity for example to the player who fired a grenade.

And video big_smile

4

Re: [CODE]Need a help

You need implement some stuff for manage 'tune params' by user.... and work with "NETMSGTYPE_SV_TUNEPARAMS" message... or "hackish" the gravity in character core (but you lost prediction)...

Perhaps some "ddnet" developer can help you better, because they have implemented this functionality...

5

Re: [CODE]Need a help

You can execute this code to send a custom tuning params to a specific client:

CTuningParams MyTuningParams = *pGameServer->Tuning();
MyTuningParams->m_Gravity = 0.0f; //Just an example
CMsgPacker Msg(NETMSGTYPE_SV_TUNEPARAMS);
int *pParams = (int *)&MyTuningParams;
for(unsigned i = 0; i < sizeof(MyTuningParams)/sizeof(int); i++)
    Msg.AddInt(pParams[i]);
Server()->SendMsg(&Msg, MSGFLAG_VITAL, GetCID());

In you case, with a grenade that change the gravity, you must ensure that default tuning params are sent again when the effect disappear, otherwise, the game will become unplayable for the client. In particular, take care of all situations like, death of the player, regular end of the effect, ...