Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
3 registered members (AndrewAMD, kzhao, 7th_zorro), 714 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Tracing and player creation problems. #96357
10/28/06 21:42
10/28/06 21:42
Joined: Jun 2005
Posts: 130
K
khanoftruth Offline OP
Member
khanoftruth  Offline OP
Member
K

Joined: Jun 2005
Posts: 130
I am trying to creat a player for my game. I have several problems. The one I am trying to fix has to do with tracing.

I want the players to only spawn at certain areas (not in the trench or on top of the hill). To do this, I created several invisible and passable blocks and applied the earthtile texture to them. I do a trace, and it doesn't work. The game gets stuck in an endless loop.

When I use breakpoint, it tells me that it never finds this: if(str_stri(tex_name,"earthtile") != FALSE). Any help would be greatly appriciated. I have the same problem when I try to spawn ammo, because it uses similar coding.

function create_player()
{
var position_found = FALSE;

while (position_found == FALSE)
{
// get random start vector around center of level
vecFrom.x = -3900 + random(7800);
vecFrom.y = -4000 + random(8000);
vecFrom.z = 200;

vec_set(vecTo,VecFrom);
vecTo.z = -200;

trace_mode = USE_BOX + SCAN_TEXTURE;
TRACE(vecFrom,vecTo);

// check for floor texture, if floor create entity
if(str_stri(tex_name,"earthtile") != FALSE)
{

vec_set(temp_loc,vecTo);
temp_loc.z = target.z + 35;

// create player's entity depending on profession
if (profession_ID == PROF_BAD_USA)
{
player = ent_create(str_BAD_USA,temp_loc,move_USA);
}

if (profession_ID == PROF_BAD_UK)
{
player = ent_create(str_BAD_UK,temp_loc,move_UK);
}

if (profession_ID == PROF_BAD_CHINA)
{
player = ent_create(str_BAD_China,temp_loc,move_China);
}
position_found = TRUE; // found floor to create player on
}
wait(1);
}
}


The Galvanic Productions Hompage: www.GalvanicProductions.tk For our current project, click on the Nirvana link.
Re: Tracing and player creation problems. [Re: khanoftruth] #96358
10/29/06 04:04
10/29/06 04:04
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline
Serious User
PrenceOfDarkness  Offline
Serious User

Joined: Aug 2004
Posts: 1,305
New York
wrong form my friend... I didn't really look at your code 2 thoroughly but let me give you some quick tips that might solve your problem... you might wanna make the engine wait until the player is created.. at the start of you create player function add something like while(player == null){wait(1);}

Also make sure that this part of the script is the problem.. take it out and see if you have another problem with out it (comment this out with /*).. i know it might sound dumb but you wouldnt believe how many times a different part of my mountains of code is the actual problem but i get an error inside a different function.. lol btw...like i started to say post this in http://www.coniserver.net/ubbthreads/postlist.php/Cat/0/Board/UBB15
aka scripting section for the best results


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.

Moderated by  HeelX, rvL_eXile 

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