1 registered members (AndrewAMD),
1,089
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
'Draw_text'
#166134
11/06/07 15:04
11/06/07 15:04
|
Joined: Mar 2005
Posts: 84 The Sacred Silence and Sleep
Spectre
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
|
Ok I have this bit of code in my 'enemies' movement (so its name is above its head): Code:
vec_set(text_loc, vector(my.x, my.y, my.z + 50)); vec_set(temp, text_loc); vec_to_screen(temp, camera); draw_text("Bobby-Lu", temp.x, temp.y, nullvector); So now its name floats above its head no matter where it goes...however that includes behind walls, buildings etc you can still see the Text! How to make the Name of the enemy invisible when you can't see it? Thanks in advance for any help you may give!
|
|
|
Re: 'Draw_text'
[Re: Xarthor]
#166136
11/08/07 10:06
11/08/07 10:06
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
User
|
User
Joined: Mar 2006
Posts: 752
Portugal
|
hmm, dont think this will be solved like this... I had some problems too and the string is visible even when the player its not visible, when it is behind other models, not in the view. Is there a way to solve this without using trace or scan routines? The code below is in a multiplayer environment Code:
function paint_DRAW_STRING() { while(1) { vec_set (temp_vec, vector(my.x,my.y,my.z + 50); if (null != vec_to_screen(temp_vec, camera)) { if (my._PLAYER_NUMBER == 1) { str_cpy (PDrawText, str_player1Name); } if (my._PLAYER_NUMBER == 2) { str_cpy (PDrawText, str_player2Name); } if (my._PLAYER_NUMBER == 3) { str_cpy (PDrawText, str_player3Name); } if (my._PLAYER_NUMBER == 4) { str_cpy (PDrawText, str_player4Name); } //--- doesnt appear on itself if (my.clipped != on) { draw_text(PDrawText,temp_vec.x-20,temp_vec.y,vector(0,0,255)); } } wait(1); } }
|
|
|
Re: 'Draw_text'
[Re: demiGod]
#166138
11/12/07 17:04
11/12/07 17:04
|
Joined: Mar 2005
Posts: 84 The Sacred Silence and Sleep
Spectre
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
|
I am the first to admit I am not a good (or even passable) programmer, but I could not find a work-around for this that did not include a c_trace. Here is roughly what I came up with to test: Code:
var EntLoc[3]=-1536,-896,50; //the firstloc of the entity
entity* TestEnt;
string Warlock = <warlock.mdl>; string TestString (Testing);
function CreateEntTest(); function DrawText();
function DrawText() { var TextPos; //where the text should appear TestEnt = my; while(1) { vec_set(TextPos,vector(my.x-20,my.y,my.z+55)); //sets the 'text' above the model.Play with the + values vec_set(temp,TextPos); vec_to_screen(temp,camera); if (c_trace(TextPos,camera.x,IGNORE_ME|IGNORE_PASSABLE)==0&&temp!=0) { draw_text(TestString,temp.x,temp.y,vector(255,50,50)); } wait(1); } }
function CreateEntTest() { ent_create(Warlock,EntLoc,DrawText); //creates the entity at the current location and calls the DrawText function EntLoc.x+=256; //increases the location by 256 units. Sometimes its created behind blocks etc. }
on_a=CreateEntTest();
That is of course quick and dirty for testing. It works ok...except for a couple issues. The text gets bigger the further away the entity is, as well as a few other size and location formatting errors. I think I have to come up with a different method because it looks goofy
|
|
|
|