C++ Add "space" to Animatedtext on source

Discussion in 'Support' started by Zell, Apr 17, 2018.

  1. Zell

    Zell Member

    Joined:
    Oct 23, 2010
    Messages:
    85
    Likes Received:
    31
    Best Answers:
    0
    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 (Text):
    1.  
    2.  
    3.  if((int32_t)damageChange != 0)
    4.                     {
    5.                         damage -= (int32_t)damageChange + 1;
    6.              
    7.                         char buffer2[150];
    8.                    
    9.      
    10.    HERE I NEED SPACE!!                ----->      // sprintf(buffer2, "     -%d");
    11.                        
    12.                      
    13.              ----->       //    target->getPlayer()->sendAnimatedText(targetPos, 15, buffer2);
    14.                
    15.                          
    16.                     }
    17.                 }
    18.  
    19.  
     
  2. xKrazyx

    xKrazyx Old School

    Joined:
    Oct 23, 2012
    Messages:
    705
    Likes Received:
    359
    Best Answers:
    2
    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 (Text):
    1. addEvent(function()
    2. doSendAnimatedText(getCreaturePosition~
    3. end, 200)
    4.  
    Hope this helps GL.
     
  3. Zell

    Zell Member

    Joined:
    Oct 23, 2010
    Messages:
    85
    Likes Received:
    31
    Best Answers:
    0
    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 (Text):
    1.  
    2.     addEvent(function()
    3.                                          
    4.                                            doSendAnimatedText(getCreaturePosition(cid),"     -".. buffer2, 15)
    5.                                            end, 200)
    6.  
    3990 C:\game.cpp `function' was not declared in this scope
    and the same for event, and end..
     
  4. xKrazyx

    xKrazyx Old School

    Joined:
    Oct 23, 2012
    Messages:
    705
    Likes Received:
    359
    Best Answers:
    2
    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: Apr 18, 2018
  5. Zell

    Zell Member

    Joined:
    Oct 23, 2010
    Messages:
    85
    Likes Received:
    31
    Best Answers:
    0
    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..?
     

Share This Page

Loading...