C++ Add "space" to Animatedtext on source

Zell

Intermediate OT User
Joined
Oct 23, 2010
Messages
88
Reaction score
34
Hi everyone, i have a problem with a simple c++ code, I'm trying to send a Animatedtext to player when it takes damage but appears at the same time the Red numbers of the dmg and they mix on the screen.

So i try to give to the others letters space, for see something like: 50 (damage taked) -25 (my animated text)

here is the lines of the buffer/animated text functions:

Code:
 if((int32_t)damageChange != 0)
                    {
                        damage -= (int32_t)damageChange + 1;
              
                        char buffer2[150];
                   
      
   HERE I NEED SPACE!!                ----->      // sprintf(buffer2, "     -%d");
                       
                     
             ----->       //    target->getPlayer()->sendAnimatedText(targetPos, 15, buffer2);
                
                         
                    }
                }
 

xKrazyx

Old School
Joined
Oct 23, 2012
Messages
751
Reaction score
372
doSendAnimatedText only supports 9 characters thru the original client and im not sure if it supports spaces? I remember trying something with spaces and it didn't work. Dont quote me tho.. OTC im sure its possible?

Could try one of the alt spaces? So put these in the sendAnimatedText before the (-25)?
alt+32
alt+255
alt+0160

You can do somethin like this to delay the message slightly?

Code:
addEvent(function()
doSendAnimatedText(getCreaturePosition~
end, 200)
Hope this helps GL.
 
OP
Zell

Zell

Intermediate OT User
Joined
Oct 23, 2010
Messages
88
Reaction score
34
doSendAnimatedText only supports 9 characters thru the original client and im not sure if it supports spaces? I remember trying something with spaces and it didn't work. Dont quote me tho.. OTC im sure its possible?

Could try one of the alt spaces? So put these in the sendAnimatedText before the (-25)?
alt+32
alt+255
alt+0160

You can do somethin like this to delay the message slightly?

Code:
addEvent(function()
doSendAnimatedText(getCreaturePosition~
end, 200)
Hope this helps GL.
Thanks for help, but I can't make spaces with ALT+..
and i try make with addevent, but i can't (i think im retarded i have no enought idea about c++)

Code:
    addEvent(function()
                                         
                                           doSendAnimatedText(getCreaturePosition(cid),"     -".. buffer2, 15)
                                           end, 200)
3990 C:\game.cpp `function' was not declared in this scope
and the same for event, and end..
 

xKrazyx

Old School
Joined
Oct 23, 2012
Messages
751
Reaction score
372
No no use the add Event code in the Lua script I should have specified sry. if there is a lua script im assuming since your calling doSendAnimated~?

if you want the c++ code for animatedText go into your luascript.cpp and search for doSendAnimatedText.

If you want to know how to delay the function call go to AddEvent in luascript as well.. something like g_scheduler.addEvent(createSchedulerTask((delay, ~

but yea you can delay in lua script instead not c+

On ma phone otherwise can help more later
 
Last edited:
OP
Zell

Zell

Intermediate OT User
Joined
Oct 23, 2010
Messages
88
Reaction score
34
No no use the add Event code in the Lua script I should have specified sry. if there is a lua script im assuming since your calling doSendAnimated~?

if you want the c++ code for animatedText go into your luascript.cpp and search for doSendAnimatedText.

If you want to know how to delay the function call go to AddEvent in luascript as well.. something like g_scheduler.addEvent(createSchedulerTask((delay, ~

but yea you can delay in lua script instead not c+

On ma phone otherwise can help more later
Thx anyway, i'll fix it!

but now I have another problem with a function.

I want to use GetdistanceTo, for use in spells, I try copy/pasting the code for npc and changing some lines but i can't make it.

Do you know any way for check if the target are in <= range from me? and checking if target is on pztile and so on..?
 
Top