|
|
enemies chase player and ladder ?
#79587
06/26/06 15:53
06/26/06 15:53
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
Does anyone know the scrpt just to make an enemy chase a player everytime he is near ?
Also does anyone know a good working ladder code, I tried doing search here but somehow none of the ladder codes given worked on my game, does anyone know a working one ? I am planning in my game for the player to climb a wall.
thanks in advance.
Last edited by tek; 06/26/06 15:54.
|
|
|
Re: enemies chase player and ladder ?
[Re: tek]
#79588
06/27/06 17:07
06/27/06 17:07
|
Joined: Jun 2006
Posts: 379 Flevoland, 5 meters under wate...
Roel
Senior Member
|
Senior Member
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
|
I got the chasing code:
var reaction_distance = 200; action enemy { while(me)//while I exist in the level { //check for the player if(player) { //turn to the player vec_set(temp.x,player.x) vec_sub(temp.x,my.x); vec_to_angle(my.pan,temp.x); if(vec_dist(my.x,player.x) < reaction_distance) { ent_move(vector(5,0,0),vector(0,0,-3) } } wait(1); } }
I haven't tested it but, it should work
|
|
|
Re: enemies chase player and ladder ?
[Re: Roel]
#79589
06/28/06 00:00
06/28/06 00:00
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
Thanks alot Roel I am sure it works the only thing is it gave me a couple of errors one I fixed, the other I am not sure whats wrong, the first was just it needed a semicolon the other one is this. var reaction_distance = 200; action enemy { while(me)//while I exist in the level { //check for the player if(player) { //turn to the player vec_set(temp.x,player.x); vec_sub(temp.x,my.x); vec_to_angle(my.pan,temp.x); if(vec_dist(my.x,player.x) < reaction_distance) { ent_move(vector(5,0,0),vector(0,0,-3) } } wait(1); } } the error says Quote:
< ent_move(vector(5,0,0),vector(0,0,-3) }> MYNEWGAME.WDL 90:-1 Error(6): script error last line . error in script
engine shutdown
I am not sure how to fix this.
Last edited by tek; 06/28/06 00:03.
|
|
|
Re: enemies chase player and ladder ?
[Re: tek]
#79590
06/28/06 15:31
06/28/06 15:31
|
Joined: Aug 2005
Posts: 199 houston
seneca
Member
|
Member
Joined: Aug 2005
Posts: 199
houston
|
add ";" to the end of ent_move,
ent_move(vector(5,0,0),vector(0,0,-3);
a8 commercial
|
|
|
Re: enemies chase player and ladder ?
[Re: seneca]
#79591
06/28/06 15:43
06/28/06 15:43
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
I tried that before it only gives me another error. Quote:
< ent_move(vector(5,0,0),vector(0,0,-3)> MYNEWGAME.WDL 179:0 Error(270): Syntax error--number of brackets . Error in script
Engine shutdown
Last edited by tek; 06/28/06 15:53.
|
|
|
Re: enemies chase player and ladder ?
[Re: tek]
#79592
06/28/06 16:09
06/28/06 16:09
|
Joined: Aug 2005
Posts: 199 houston
seneca
Member
|
Member
Joined: Aug 2005
Posts: 199
houston
|
ent_move(vector(5,0,0),vector(0,0,-3)); sorry i didn't catch that before
add a ")" just before the ";" and after the last ")". check above
a8 commercial
|
|
|
Re: enemies chase player and ladder ?
[Re: seneca]
#79593
06/28/06 16:20
06/28/06 16:20
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
|
|
|
Re: enemies chase player and ladder ?
[Re: tek]
#79594
06/29/06 02:35
06/29/06 02:35
|
Joined: May 2005
Posts: 222
tek
OP
Member
|
OP
Member
Joined: May 2005
Posts: 222
|
Thanks to you guys the code worked  ) I have done so many thinsg in my game. This is the picture of the bats in my underground pyramid cave level.  and here are the bats following me and when I shoot it they disappear.  I know i'm pushing it, but I want my game to have everything I want to make a super game I am sorry for keep asking advice. I would like to know how to make a entity appear for 5 seconds and dissapear for 5 seconds like in megaman. The entity platform is on top of a lava pit (which I already made)so I must jump from platform to platform, the danger is the platform that I jump on must appear and disappear and then appear again and dissapear and keep on (like 5 seconds its there and 5 seconds it disappear and vice versa) making it harder for me to get to the other side  that's my ingenius plan. Does anyone know how to do this, i tried coding this myself with everything I learned (ent_morph, functions etc etc) but I couldnt get the job done. any help would be greatly appreciated. What I did was something like this. my.passable=on; my.invisible=off; sleep(5); my.event=entity_dissapear; then in the function entity_dissapear something like my.passable=off; my.invisible=on; but the code keep giving me errors and I don't believe I am even close to accomplishing what I have in mind. i am trying to learn and thank you for all u guys help because I gotten so far. Does anyone know how I can do this ?
Last edited by tek; 06/29/06 02:43.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|