Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,103 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
'Draw_text' #166134
11/06/07 15:04
11/06/07 15:04
Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
Spectre Offline OP
Junior Member
Spectre  Offline 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: Spectre] #166135
11/06/07 15:15
11/06/07 15:15
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck

Re: 'Draw_text' [Re: Xarthor] #166136
11/08/07 10:06
11/08/07 10:06
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
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] #166137
11/10/07 10:26
11/10/07 10:26
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Any ideas? o_O

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 Offline OP
Junior Member
Spectre  Offline 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

Re: 'Draw_text' [Re: Spectre] #166139
11/12/07 18:09
11/12/07 18:09
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
replace "c_trace(TextPos,camera.x,IGNORE_ME|IGNORE_PASSABLE)==0" with "!my.clipped"

works way faster, and should omit the text if the entity is behind walls or other entites. If it doesn't work, then maybe clipped only checks whether the entity is out of the clip range.

Re: 'Draw_text' [Re: SchokoKeks] #166140
11/12/07 19:42
11/12/07 19:42
Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
Spectre Offline OP
Junior Member
Spectre  Offline OP
Junior Member

Joined: Mar 2005
Posts: 84
The Sacred Silence and Sleep
yep, I tried that first it doesn't work so I had to resort to the c_trace.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1