1

Topic: [HELP ME] i wanna define m_Pos in my Game Mod

hi
i have a problem
in my game mod i wanna Cread Sound for emotions but i have an error in my gamecontex.cpp file
for example:

                        pChr->SetEmoteType(EMOTE_HAPPY);
                        CreateSound(m_Pos, SOUND_RIFLE_BOUNCE);
                        break;
                case EMOTICON_OOP:
                case EMOTICON_SORRY:
                case EMOTICON_SUSHI:

in Compile say to me undefined m_Pos
please help me how to define it
thanks

2 (edited by FuroS 2015-11-17 13:14:09)

Re: [HELP ME] i wanna define m_Pos in my Game Mod

//EDIT:

I just saw that in vanilla there is no GetPos() (i implemented it in my mod tongue) so you will have to make the getter Function yourself with

vec2 GetPos() const { return m_Pos; }

in character.h or make m_Pos public itself and use

pChr->m_Pos

Sry for that
//


First of all, you should better post the line of the code or better in which function at which exact point your codesnippet is.

I think you are in CGameContext::OnMessage under the

else if (MsgID == NETMSGTYPE_CL_EMOTICON && !m_World.m_Paused)

statement.

In this case it is easy, m_Pos is a member variable of CCharacter and CCharacterCore. Because the function knows its player (pPlayer) you can get the Character form that which already is here (a few lines above is : )

CCharacter* pChr = pPlayer->GetCharacter();

From that you can now easy get the wanted position with

pChr->GetPos();

so in the end it will be

CreateSound(pChr->GetPos(), SOUND_RIFLE_BOUNCE);

P.S. Maybe you should use another sound than the rifle bouncing sound tongue

Greets,
FuroS

"Panos."
               -FuroS

3 (edited by 2015-11-17 15:46:15)

Re: [HELP ME] i wanna define m_Pos in my Game Mod

thank you ... you are a Super Teacher and i love you .. you know? i looooovvvvvveeee yoouuuuuu tongue
yee SOUND_RIFLE_BOUNCE just an example.... i wanna use better Sounds big_smile
where can i find all Sound names? tongue

Sorry i found all sounds tongue all in "src\game\generated\protocol.h"
thank you my dear FuroS tongue

4

Re: [HELP ME] i wanna define m_Pos in my Game Mod

This looks like a cool idea.  Do you have the sounds picked out yet?  I would like to hear a Tee make more sounds.

Jesus is my Lord and Savior. Praise be unto God for giving us a way to live with him.

Check out my DeviantArt for all my TeeWorlds art and ideas for Teeoworlds

5

Re: [HELP ME] i wanna define m_Pos in my Game Mod

android272 wrote:

This looks like a cool idea.  Do you have the sounds picked out yet?  I would like to hear a Tee make more sounds.

actually   you cant add new sound to  server ,   you  can just  use    sounds   that define before in  source ...

if you want change  them to new sound > it will be new clinet ...  not server  binary
smile

join  my telegram group  teeworld players  :  https://t.me/teeworlds2019
Teeworld Developers group : https://t.me/teeworldsdev

6

Re: [HELP ME] i wanna define m_Pos in my Game Mod

vafa.hamidreza wrote:

thank you my dear FuroS tongue

No problem, mate, you're welcome smile

Here's just a snippet which sounds I use in my mods (I don't use all sounds because it can get really annoying).

                
if(pMsg->m_Emoticon == EMOTICON_DROP)
    CreateSound(pChr->m_Pos, SOUND_TEE_CRY);
else if(pMsg->m_Emoticon == EMOTICON_HEARTS)
    CreateSound(pChr->m_Pos, SOUND_PLAYER_SPAWN);
"Panos."
               -FuroS

7

Re: [HELP ME] i wanna define m_Pos in my Game Mod

thank you Dear FuroS tongue
by your help i made this mod:
https://www.teeworlds.com/forum/viewtopic.php?id=11670

take a look tongue
i put your name in MOD Helpers tongue