Razor[PL] Posted November 12, 2008 Share Posted November 12, 2008 Hi I don`t know why but created bots kill player only one time. Next they do nothing (like normal dummy). Script: CHAR_DATA hunterelvis1CHAR_DATA hunterelvis2CHAR_DATA hunterelvis3CHAR_DATA hunterelvis4CHAR_DATA elvis1 = ( 209.5 , 181.5 , 2.0 ) 12 0 CRIMINAL_TYPE2CAR_DATA elviscar1 = ( 208.5 , 181.5 , 2.0 ) 34 45 MERCARROW_DATA hunterelvis1_arrARROW_DATA hunterelvis2_arrARROW_DATA hunterelvis3_arrARROW_DATA hunterelvis4_arrSAVED_COUNTER true = 1SAVED_COUNTER false = 0COUNTER loop = 1COUNTER loop2 = 0LEVELSTARTSET_CHAR_OBJECTIVE ( elvis1 , ENTER_CAR_AS_DRIVER , elviscar1 )SET_CHAR_THREAT_REACTION ( elvis1 , REACT_AS_NORMAL )WHILE ( loop = 1 )IF ( HAS_CHARACTER_DIED ( elvis1 ) )IF ( elvisonce = 1 ) SET loop2 = 1hunterelvis1 = CREATE_CHAR ( 170.5, 179.5 , 2.0 ) 12 0 CRIMINAL_TYPE1 ENDhunterelvis2 = CREATE_CHAR ( 170.5, 154.5 , 2.0 ) 12 0 CRIMINAL_TYPE1 ENDhunterelvis3 = CREATE_CHAR ( 163.5, 190.5 , 2.0 ) 12 0 CRIMINAL_TYPE1 ENDhunterelvis4 = CREATE_CHAR ( 220.5, 188.5 , 2.0 ) 12 0 CRIMINAL_TYPE1 ENDDISPLAY_BRIEF ( 1221 )SET_ARROW_COLOUR ( hunterelvis1_arr , blue )SET_ARROW_COLOUR ( hunterelvis2_arr , blue )SET_ARROW_COLOUR ( hunterelvis3_arr , blue )SET_ARROW_COLOUR ( hunterelvis4_arr , blue )SET_CHAR_THREAT_REACTION ( hunterelvis1 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis2 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis3 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis4 , REACT_AS_NORMAL )POINT_ARROW_AT ( hunterelvis1_arr , hunterelvis1 )POINT_ARROW_AT ( hunterelvis2_arr , hunterelvis2 )POINT_ARROW_AT ( hunterelvis3_arr , hunterelvis3 )POINT_ARROW_AT ( hunterelvis4_arr , hunterelvis4 )GIVE_WEAPON ( hunterelvis1 , ROCKET_LAUNCHER )GIVE_WEAPON ( hunterelvis2 , MACHINE_GUN )GIVE_WEAPON ( hunterelvis3 , ELECTRO_GUN )GIVE_WEAPON ( hunterelvis4 , FLAME_THROWER )SET_CHAR_OBJECTIVE ( hunterelvis1 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis2 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis3 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis4 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_THREAT_SEARCH ( hunterelvis1 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis2 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis3 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis4 , AREA )++elvisonceENDIFENDIFENDWHILEWHILE ( loop2 = 1 )IF (NOT( HAS_CHARACTER_DIED ( hunterelvis1 ) ))IF ( HAS_CHARACTER_DIED ( p1 ) )SET_CHAR_THREAT_SEARCH ( hunterelvis1 , LINE_OF_SIGHT_PLAYER_ONLY )SET_CHAR_THREAT_SEARCH ( hunterelvis2 , LINE_OF_SIGHT_PLAYER_ONLY )SET_CHAR_THREAT_SEARCH ( hunterelvis3 , LINE_OF_SIGHT_PLAYER_ONLY )SET_CHAR_THREAT_SEARCH ( hunterelvis4 , LINE_OF_SIGHT_PLAYER_ONLY )SET_CHAR_OBJECTIVE ( hunterelvis1 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis2 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis3 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis4 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_THREAT_REACTION ( hunterelvis1 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis2 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis3 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis4 , REACT_AS_NORMAL )ENDIFENDIFIF (NOT( HAS_CHARACTER_DIED ( hunterelvis2 ) ))IF ( HAS_CHARACTER_DIED ( p1 ) )SET_CHAR_THREAT_SEARCH ( hunterelvis1 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis2 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis3 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis4 , AREA )SET_CHAR_OBJECTIVE ( hunterelvis1 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis2 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis3 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis4 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_THREAT_REACTION ( hunterelvis1 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis2 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis3 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis4 , REACT_AS_NORMAL )ENDIFENDIFIF (NOT( HAS_CHARACTER_DIED ( hunterelvis3 ) ))IF ( HAS_CHARACTER_DIED ( p1 ) )SET_CHAR_THREAT_SEARCH ( hunterelvis1 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis2 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis3 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis4 , AREA )SET_CHAR_OBJECTIVE ( hunterelvis1 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis2 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis3 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis4 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_THREAT_REACTION ( hunterelvis1 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis2 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis3 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis4 , REACT_AS_NORMAL )ENDIFENDIFIF (NOT( HAS_CHARACTER_DIED ( hunterelvis4 ) ))IF ( HAS_CHARACTER_DIED ( p1 ) )SET_CHAR_THREAT_SEARCH ( hunterelvis1 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis2 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis3 , AREA )SET_CHAR_THREAT_SEARCH ( hunterelvis4 , AREA )SET_CHAR_OBJECTIVE ( hunterelvis1 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis2 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis3 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_OBJECTIVE ( hunterelvis4 , KILL_CHAR_ANY_MEANS , p1 )SET_CHAR_THREAT_REACTION ( hunterelvis1 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis2 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis3 , REACT_AS_NORMAL )SET_CHAR_THREAT_REACTION ( hunterelvis4 , REACT_AS_NORMAL )ENDIFENDIF///////////////IF ( HAS_CHARACTER_DIED ( hunterelvis1 ) )REMOVE_ARROW (hunterelvis1_arr)ENDIFIF ( HAS_CHARACTER_DIED ( hunterelvis2 ) )REMOVE_ARROW (hunterelvis2_arr)ENDIFIF ( HAS_CHARACTER_DIED ( hunterelvis3 ) )REMOVE_ARROW (hunterelvis3_arr)ENDIFIF ( HAS_CHARACTER_DIED ( hunterelvis4 ) )REMOVE_ARROW (hunterelvis4_arr)ENDIFENDWHILELEVELEND Can anyone help me? PS: My level of English is weak Link to comment Share on other sites More sharing options...
Sektor Posted November 13, 2008 Share Posted November 13, 2008 (edited) The first WHILE loop will never end because LOOP is always equal to 1. That means the code in the second while loop is never started. You check IF ( elvisonce = 1 ) before running the attack player code but then you ++elvisonce and I don't see anywhere that resets elvisonce back to 1, so it will keep going up, never equal 1 and the code in that IF statement won't run. Edited November 13, 2008 by Sektor Link to comment Share on other sites More sharing options...
Razor[PL] Posted November 13, 2008 Author Share Posted November 13, 2008 so i must remove ++elvisonce ? (i just started work with looping) Link to comment Share on other sites More sharing options...
Lantyz Posted November 17, 2008 Share Posted November 17, 2008 Why do you use two loops in the first place? What is it exactly you want the bots to do? I think you first need to tidy your code a bit by adding comments and tab IFs and WHILEs like this: IF ( NOT ( HAS_CHARACTER_DIED ( hunterelvis4 ) ) ) IF ( HAS_CHARACTER_DIED ( p1 ) ) //Do stuff here ENDIFENDIF Also, you can merge IFs inside another IF with AND, to reduce code. Tidy code makes it easier to spot errors for both us and you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now