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
3 registered members (AndrewAMD, degenerate_762, ozgur), 1,311 guests, and 0 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
A6 enemy attack issue, help please... #288246
09/04/09 23:25
09/04/09 23:25
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
ok, so i have an enemy that attacks. it comes in close to attack, but after it attacks, it "hops" backward a bit. any idea why? it does it everytime it attacks.

thanks in advance,Blink.

Code:
action abigail
{
     
        enemy_events();
        g3_handle_radar();
   	  var move_dist[3];	
   	  var distance;
   	  my.enable_entity = on;
   	  my.enable_impact = on; 
   	  my.albedo=0;
        my.ambient=100;
        my.unlit=on;
        my.bright=on;
   	  my.enable_scan = on;
   	  my.polygon = on;
   	  my.enable_block=on;
   	  my.transparent = on;   	  
   	  my.enable_shoot = on; 
   	  my.health = 10;     
   	  my.event = enemy_events;
   	  vec_set (temp, my.x);
        temp.z -= 1;

        my.skill11 = c_trace(my.x,temp,IGNORE_ME|IGNORE_PASSABLE); 
        my.z = my.skill11+0;
   	  
               	
   	  c_setminmax(my);	
   	  wait(1);	
   	  
   	  while(plBiped01_entity == null)	{ wait(1); }		
   	  
   	  while(my.health > 0)	
   	  {
   	     		 distance = vec_dist(my.x, plBiped01_entity.x);				
   	     		 
   	     		 if(distance < 1000)	// the player approaches the enemy		
   	     		 {	
   	     		 		   vec_set(temp, plBiped01_entity.x);			
   	     		 		   vec_sub(temp, my.x);			
   	     		 		   vec_to_angle(my.pan, temp);			
   	     		 		   my.tilt = 0;						
   	     		 		   
   	     		 		      	     		 		   
   	     		 		   move_dist.x = 5 * time_step;			
   	     		 		   move_dist.y = 0;			
   	     		 		   move_dist.z = 0;			
   	     		 		   c_move(my,move_dist,nullvector,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MAPS);		 		   
   	     		 		   ent_animate(my, "walk", my.skill19, ANM_CYCLE);		// play run frames animation			
   	     		 		   my.skill19 = cycle(my.skill19+48*time_step,0,101);	// "run" animation speed + loop animation						
   	     		 		   ent_playsound (my, ghostwalk, 100);
   	     		         
   	     		 		   if(distance < 150)		// if the player comes closer than 50 quants attack him			
   	     		 		   {				
   	     		 		           my.skill23 = 0; // reset "attack" frames								
   	     		 		           
   	     		 		           while(my.skill23 < 100)				
   	     		 		           {					
   	     		 		                   c_trace (my.x,temp,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE); 
   	     		 		                  
   	     		                         
   	     		                            	     		                         									
   	     		                         create_explosions();
   	     		                         ent_animate(my,"attack",my.skill23,ANM_CYCLE);	// play attack frames animation					
   	     		                         my.skill23 += 20 * time_step;	// "attack" animation speed
   	     		                         you = plBiped01_entity;
   	     		                         you._armor__003 -= 1 * time_step;
   	     		                         
   	     		                         wave_handle = snd_play(wave, 100, 0);
   	     		                         snd_stop(wave); 
   	     		                         wait(1);
   	     		                         if(you._armor__003 < 0)
			                                        {
			                                      	 you._health__003 += you._armor__003;
				                                     you._armor__003 = 0;
				                                     PlBiped_Damage_Reaction();	// display damage panel
			                                         }			
   	     		                 }								
   	     		                 
   	     		                 wait(6);			
   	     		          }
   	     		        }		
   	     		        else	// the player is farther than 200 quants away		
   	     		        {			
   	     		               ent_animate(my,"stand",my.skill21,ANM_CYCLE);		// play stand frames animation			
   	     		               my.skill21 = cycle(my.skill21+2*time_step,0,101);	// "stand" animation speed + loop animation		
   	     		               
   	     		        }				
   	     		        
   	     		        wait(1);	
   	     		}		
   	     		
   	     		// enemy was killed:	
   	     		while(my.skill22 < 90)	
   	     		{
   	     		   	  ent_animate(me,"death", my.skill22, ANM_CYCLE); // play death frames animation		
   	     		   	  my.skill22 += 16 * time_step; // "death" animation speed				
   	     		   	  
   	     		   	  wait(1);
   	     		   	  
   	     		}		
   	     		
   	     		my.passable = on; // the corpse can't be hit by the sword from now on
   	     		
	while (my.alpha > 0)
	{
		my.alpha -= 0.3 * time_step;
		wait (1);
	}
	ent_playsound (my, die, 100);
	ent_remove (me);
	
}	
	
}



Last edited by Blink; 09/04/09 23:26.

My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: A6 enemy attack issue, help please... [Re: Blink] #288380
09/05/09 16:37
09/05/09 16:37
Joined: Apr 2009
Posts: 27
Silicon Valley
D
Dillinger Offline
Newbie
Dillinger  Offline
Newbie
D

Joined: Apr 2009
Posts: 27
Silicon Valley
can't say why, but you could maybe fix it by setting a flag2 on the victim and then while in attack mode IGNORE_YOU | IGNORE_FLAG2

Re: A6 enemy attack issue, help please... [Re: Dillinger] #288398
09/05/09 18:48
09/05/09 18:48
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
sorry, i dont quite get what you suggest.


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: A6 enemy attack issue, help please... [Re: Blink] #288406
09/05/09 19:59
09/05/09 19:59
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
maybe in the create_explosions(); function are no passable entitys.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: A6 enemy attack issue, help please... [Re: alibaba] #288421
09/06/09 03:57
09/06/09 03:57
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
well, i moved the create_explosions(); out of the while and the enemy doesnt jump anymore, but now when the enemy attacks, it gets stuck on the player while attacking and i cant move. any suggestions?


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: A6 enemy attack issue, help please... [Re: Blink] #288422
09/06/09 04:51
09/06/09 04:51
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
entanglement: Maybe, set my.polygon = OFF for moving actors?

Re: A6 enemy attack issue, help please... [Re: testDummy] #288425
09/06/09 08:30
09/06/09 08:30
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
i think its because the enemy moves and attcks at the same time.
you the enemy moves into the players hull and gets stucked. because of this you have to set the attack code in a while loop or disable the walking while attacking.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: A6 enemy attack issue, help please... [Re: alibaba] #288484
09/06/09 19:28
09/06/09 19:28
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
i tried, my polygon=off and no change, but when i increase the distance when to attack, the enemy stops short and injures the player with an attack. i guess i will have to live with it, because i dont want the player to get stuck.


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: A6 enemy attack issue, help please... [Re: Blink] #288604
09/07/09 15:23
09/07/09 15:23
Joined: Apr 2009
Posts: 27
Silicon Valley
D
Dillinger Offline
Newbie
Dillinger  Offline
Newbie
D

Joined: Apr 2009
Posts: 27
Silicon Valley
I was giving some more thought to your question.
Could it be that in your attack animation the attacker translates forward?
Because you're using collision detection and the engine takes care of that re: entity translation. However, if your attacker animation translates forward in addition to the engine's attempts to compensate it's translation coordinates, your attacker will step into the collision zone. Since two solid entities can't overlap, the engine bumps back the translation to compensate. You could redo the animation so the character's center always remains about the same and take care of any forward translation using code instead.
Press F11 twice to show the collision zones and play your animation in slow motion. If it's an unfixable problem, you simply disable collision temporarily during those wonky frames.

Re: A6 enemy attack issue, help please... [Re: Dillinger] #288638
09/07/09 19:01
09/07/09 19:01
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
i am not sure what the solution can be. i have tried several different ways to get this to work, but no results. my problem is, i have a good enemy code that works, using swords, and fists, and other hand held weapons, but when i change the code to use a projectile type weapon, i get issues. this weapon in particular is not a normal projectile either. i anticipate problems, trying to merge two codes.


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."

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