|
4 registered members (TipmyPip, alx, Martin_HH, 1 invisible),
5,110
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Enemy Cover
#352425
01/03/11 16:27
01/03/11 16:27
|
Joined: Dec 2010
Posts: 87
romin2011
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 87
|
Hello, I want my enemies to be able to find covers. As a starter in 3dgs i did this. I put dummy entities in cover positions in my level and set there enable scan on and made the enemy to scan for the covers using scan_entity. for the trial the enemy successfully scanned the dummy entity on the cover position and i confirmed it by displaying result variable from scan_entity on screen. but when i try to point the enmy to you pointer returned by scan_entity the engine gives the empty pointer error. Also if i try to make the enemy turn to found object it doesn't turn. here is my code.
var detected;
font swc_font = <font.pcx>, , 24, 23; // sword combat font
panel found_entity // displays the result of scan_entity
{
pos_x = 0;
pos_y = 0;
digits = 120, 575, 4, swc_font, 1, detected;
flags = refresh, visible;
}
action dummy //set the enable_scan on for dummy objects at cover.
{
my.enable_scan=on;
}
action enemy_fight // attached to the enemy
{
enemy = me; // I'm the enemy
while(player == null){wait(1);}
while (1)
{
if (vec_dist (my.x, player.x) < 800) // the player approaches the enemy
{
temp.pan=360;
temp.tilt=360;
temp.z=1000;
scan_entity(my.x,temp);
detected=result; //show the result on screen
//you.skill1=50; //if uncommented gives empty pointer error.
//doesn't work
vec_set(temp, you.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
}
wait (1);
}
}
though it shows the result by scan_entity (i displayed on the screen using digits) that means that it successfully scans the entity but why it gives empty pointer error and why it doesn't turn to cover i don't know? A few questions as a new starter. Is my aproach for the cover is good or is there any better way? which one is better suited for this task scan_entity, trace or c_scan? Does it slows down the game or is there any alternative? Thank You!
|
|
|
Re: Enemy Cover
[Re: romin2011]
#352569
01/04/11 14:10
01/04/11 14:10
|
Joined: Dec 2010
Posts: 87
romin2011
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 87
|
Snake thanks for the cooperation your idea is great i will difinately try this idea in my next advanced projects. but for this i will go for the entity_scan bytheway i have uploaded my test level with my code which gives error please check it and diagnose the problem. I will be very thanks full. [Note] all the codes are template based or copy paste from the aum projects because i wanted to quickly find a solution later i will improve code. Cover.zip [345 kb] everybody is welcome to check my code and provide solution thank you.
Last edited by romin2011; 01/04/11 14:12.
|
|
|
|