Page 1 of 1

.mis Error

Posted: 22 Jun 2012, 23:40
by Alberto
GTA2 .Mis File Error
____________________________________________|

.I Posted A .Mis File for my Next - Map, it has an error, (after compiling and testing the map - its Craches)
....
So I Need Someone to Check it For Me..And see whats the Error.
Thank You

RAEF

Re: .mis Error

Posted: 23 Jun 2012, 13:23
by T.M.
Learn to debug your own scripts:
- Comment out some (logical) parts of the code (for example half of the code at first, logical = not in a way that breaks the code syntax and just causes more errors!) and compile again, if still crashes, comment out more code until no more crash. Then uncomment some small parts of code until you find the line of code that causes the crash.

- When you find the line of code that caused the crash, you can come here again and say that line of code (with the whole source), and we may then help you to find a solution.

- What crashes and when/how? GTA2 or the compiler? Does it crash instantly, or after some time? etc. Does it give any error messages? and so on... Always give enough information when you report things like that.

Re: .mis Error

Posted: 23 Jun 2012, 15:56
by Sektor
You should always make sure a character, object or vehicle exists before using a command on it.

Wrong:

[mis]SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p2)[/mis]

Right:

[mis]
IF ( CHECK_CHARACTER_HEALTH ( p2 , 0 ) )
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p2)
ENDIF
[/mis]

Re: .mis Error

Posted: 23 Jun 2012, 16:05
by CarThief
Well i dont get any compiler or script errors while compiling this script with my mispad. And the only thing thats been altered is that my mispad has that improved compiler that takes more lines before it rejects too large scripts.

You'll have to provide more information then that if its not working on your end. Like is it run as a mission, or is the bug/crash in-game(in GTA2)?
And you probaly should take his advice and try to search and fix errors in your own script a bit more often perhaps. Most of the time the compiler will tell you the rough location of the line that produced the error, though this could be the above it or below it or whatnot, depending on whats causing the crash.

A poor layout like a IF statement or several made into one big one not having enough ENDIF's will show the most inaccurate locations when giving an error on compilation. So always keep good track of if there's enough ENDIF's to go with IF's. And like i said above, if the line it says doesnt seem to be the problem, its probaly above the line it mentions, either directly above it or a bit higher then that, sometimes it just keeps running for a bit and then crashes and thus causes something like that, or so i sometimes encounter.

If that all fails comment out parts of code and compile, and if that works? See what the problem is with that particular piece of code. This can be very handy when adding something to a script and it suddenly stops working. If it doesnt work uncomment it if you like and comment another portion of code. Just make sure not to comment any starts or ends of IF/WHILE/EXEC blocks without commenting out the other as well.

Oh, and like Sektor said, players are a bit of a different case, just make sure if a mis file has only 2 players set then that it requires purely 2 players, no more, no less. Same deal with other amounts past 1. Doesnt really matter though if a player exits the game and thus causes a crash, cant have everything.

Re: .mis Error

Posted: 23 Jun 2012, 20:17
by Alberto
The Error ( before the Reply ):
When i Start the Map, i see the First bot then the map Crashes ( 1 Second And then the map Crashes )
--------
Errors After Using Sektor's Answer:
When i Just kill the 1st Bot - the map crashes
When i kill the 3rd And The 4th - The Map Crashes
--------
The Error Message : Its the Normal one : (send error report / Dont send )
BUT
When the Bots Attack Me, It doesnt Crash.
Sektor , I Applied Your Code on the rest of the script : ( for P1_killer, P2_Killer, P3_Killer, P4_Killer )

- RAEF

Re: .mis Error

Posted: 23 Jun 2012, 21:46
by CarThief
Hm, almost forgot actually, IF statements, except possibily the one checking for health seem to crash the game if used on items/characters/cars not in the game, if they happen to be not created yet, deleted or simply declared and never used. Or so while making over 10 missions of the project seemed to be a repeating pattern for me. This is ussually fixed by declaring counters and checking/altering those for when the game should check for something, if you run the risk of checking for a nonexistant object, car or character.

As for the bugs and crashes, i dont know for sure but the corpses of the bots might be interfering with the script causing it to loop and crash?
Try doing a DELETE_ITEM(p1_killer), DELETE_ITEM(p2_killer), etc, at the very start of the IF block, before creating the character again.
So you'll end up with something like this for each bot:
[mis] IF (HAS_CHARACTER_DIED(p1_killer))
DELETE_ITEM(p1_killer)
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 0 CRIMINAL_TYPE2 END
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF[/mis]
If that doesnt work im not quire sure what else is the problem.

Re: .mis Error

Posted: 23 Jun 2012, 22:36
by Alberto
After Or Before The LEVELSTART Command :
NOTE:
The Map Still crashes
Can you guys fix the .mis file and send it to me, And i'll see the Error?

Re: .mis Error

Posted: 24 Jun 2012, 03:11
by CarThief
I just noticed each bot targets a different player. How have you been testing this? If you're testing this in singleplayer well there's your problem, the player peds that arent used will, as far as im aware, eventually disappear like any other ped when left behind and off the screen. And once that happens the script has no active player to refer to, and probaly thus crashes even with(and possibily due to) the health check command i assume.

You'll have to make different mis files and different mmp files for each player count. For example with 1 player make all bots target "p1", in 2 player maybe make 2 of the bots target player 1 and the other 2 bots target player 2. And if you're any good with counters, for 3 players you could let bot 1, 2 and 3 target player 1 2 and 3 respectively, and make the 4th bot switch between targets every time he dies, switching the counter and thus what he'll try and attack per death. And with 4 players just have each bot target one player no other bot targetted yet.

Cant make it much simpler, whatever you do dont refer to nonexistant players in your script, them existing is all fine as long as the bots intended for 1 player only practise dont target anything other then player 1.
If you still cant make anything out of this i could soup up 4 different scripts for you at a later point using the current script. Gotta sleep right now though. Cant promise the coordinates would be accurate though and those might need changing if you still need that help later on.

Re: .mis Error

Posted: 24 Jun 2012, 11:17
by Pyro
You don't need seperate MIS/SCR files per player nowadays since Vike removed the need to use the "PlayerCount" command in MMP files, assuming you're using the newest GTA2.exe (v11.9 or something). Besides, even if you declare multiple players and then use it in single player, the game will only take the first PLAYER_PED command and ignore the rest until it detects a multiplayer game.

As you've mentioned CarThief, careful use of the CHECK_CHARACTER_HEALTH(player_name,0) is all that's needed inside IF statements, though you have to get a little creative at times with it depending on what you want to do. Also you are right about stuff crashing mid-game if something doesn't exist, hence using counters as 'switches' to make it work. Some rough example:

[syntax=mis]PLAYER_PED p1 = (127.5,127/5,255.0) 25 180

CAR_DATA limo01 // limo for future use

COUNTER created_limo = 0 // has limo been created yet?
COUNTER loop = 1 // general game loop

LEVELSTART

WHILE_EXEC ( loop = 1 )

//check if player 'p1' has $5000 and then create limo
IF ((CHECK_SCORE_GREATER(p1,4999))
AND ( created_limo = 0 ))
SET created_limo = 1
ADD_SCORE (p1,-5000)
limo01 = CREATE_CAR (128.5,128.5,255.0) 03 180 LIMO END
ENDIF

ENDWHILE

LEVELEND[/syntax]

As mentioned, the above example is very rough code example but shows the use of counters as 'switches'. Later on in that example you could use an IF statement using "created_limo = 1" to do something else to the vehicle (or if it's destroyed, set it back to 0 if you want).

But like mentioned above as well, just do your code in small chunks and if something doesn't work, look over it and comment it out (use "/*" at the beginning and "*/" at the end to comment-out entire code sections, or just use "//" to comment-out one line only, without quotes of course) and go over it again bit by bit. Some common examples of why stuff doesn't work is stuff (character, car, object etc) doesn't exist, misplaced brackets in IF statements (quite common) and full stops in the wrong place.

Re: .mis Error

Posted: 24 Jun 2012, 22:19
by Alberto
I Solved the Problem, the CHAR_DATA who attacks the PLAYER_PED P1 reswamps But the second, third & Forth CHAR_DATA Attacks the PLAYER_PED P1 But when you Kill them..They dont Reswamp

Re: .mis Error

Posted: 24 Jun 2012, 23:28
by CarThief
Well i dont quite see whats causing that actually. Perhaps your map is just really weirdly setup in a way they cant spawn properly on some places.
Anyway using the script from here i made 1, 2, 3 and 4-player versions of each script, with an added mechanism of having the bot in the 3-player script switch targets upon death. I havent tested these though, as i dont got any good map for it. They did compile succesfully for me though.

Player 1 / Singleplayer script (only use this on singleplayer).
[mis]//Player one script. All bots should target player 1 ONLY.
//Players
PLAYER_PED P1 = ( 124.5, 118.5, 255.0 ) 37 180
//Other players arent needed for singleplayer.
//PLAYER_PED P2 = ( 113.5, 118.5, 255.0 ) 37 180
//PLAYER_PED P3 = ( 114.5, 130.5, 255.0 ) 37 180
//PLAYER_PED P4 = ( 124.5, 131.5, 255.0 ) 37 180

//Arrows
ARROW_DATA killerarrow1
ARROW_DATA killerarrow2
ARROW_DATA killerarrow3
ARROW_DATA killerarrow4

//chars
CHAR_DATA p1_killer
CHAR_DATA p2_killer
CHAR_DATA p3_killer
CHAR_DATA p4_killer

//Scriptvaraibles
COUNTER regenerating_characters = 1

LEVELSTART

// Create the killers:
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 315 CRIMINAL_TYPE1 END
p2_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 045 CRIMINAL_TYPE1 END
p3_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 2 225 CRIMINAL_TYPE1 END
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE1 END
//Point arrows at the bots.
POINT_ARROW_AT(killerarrow1, p1_killer)
POINT_ARROW_AT(killerarrow2, p2_killer)
POINT_ARROW_AT(killerarrow3, p3_killer)
POINT_ARROW_AT(killerarrow4, p4_killer)
// Arm the killers:
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
// Make the killers attack any nearby player:
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)//Only target player 1.
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p1)//As there is no other players.
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p1)
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p1)

// Respawn each killer if they die:
WHILE_EXEC (regenerating_characters = 1)
IF (HAS_CHARACTER_DIED(p1_killer))
REMOVE_ARROW(killerarrow1)
DELETE_ITEM(p1_killer)
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 0 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow1, p1_killer)
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p2_killer))
REMOVE_ARROW(killerarrow2)
DELETE_ITEM(p2_killer)
p2_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 1 45 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow2, p2_killer)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p3_killer))
REMOVE_ARROW(killerarrow3)
DELETE_ITEM(p3_killer)
p3_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 225 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow3, p3_killer)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER )
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p4_killer))
REMOVE_ARROW(killerarrow4)
DELETE_ITEM(p4_killer)
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow4, p4_killer)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF
ENDWHILE

LEVELEND[/mis]

Player 2 script (only use this with 2 players in total, aka with a friend online)
[mis]//Player two script. All bots should target player 1 and 2 ONLY.
//Players
PLAYER_PED P1 = ( 124.5, 118.5, 255.0 ) 37 180
PLAYER_PED P2 = ( 113.5, 118.5, 255.0 ) 37 180
//Other two players arent needed in a 2-player game.
//PLAYER_PED P3 = ( 114.5, 130.5, 255.0 ) 37 180
//PLAYER_PED P4 = ( 124.5, 131.5, 255.0 ) 37 180

//Arrows
ARROW_DATA killerarrow1
ARROW_DATA killerarrow2
ARROW_DATA killerarrow3
ARROW_DATA killerarrow4

//chars
CHAR_DATA p1_killer
CHAR_DATA p2_killer
CHAR_DATA p3_killer
CHAR_DATA p4_killer

//Scriptvaraibles
COUNTER regenerating_characters = 1

LEVELSTART

// Create the killers:
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 315 CRIMINAL_TYPE1 END
p2_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 045 CRIMINAL_TYPE1 END
p3_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 2 225 CRIMINAL_TYPE1 END
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE1 END
//Point arrows at the bots.
POINT_ARROW_AT(killerarrow1, p1_killer)
POINT_ARROW_AT(killerarrow2, p2_killer)
POINT_ARROW_AT(killerarrow3, p3_killer)
POINT_ARROW_AT(killerarrow4, p4_killer)
// Arm the killers:
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
// Make the killers attack any nearby player:
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)//Target player 1.
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p1)
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p2)//Target player 2.
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p2)

// Respawn each killer if they die:
WHILE_EXEC (regenerating_characters = 1)
IF (HAS_CHARACTER_DIED(p1_killer))
REMOVE_ARROW(killerarrow1)
DELETE_ITEM(p1_killer)
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 0 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow1, p1_killer)
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p2_killer))
REMOVE_ARROW(killerarrow2)
DELETE_ITEM(p2_killer)
p2_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 1 45 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow2, p2_killer)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p3_killer))
REMOVE_ARROW(killerarrow3)
DELETE_ITEM(p3_killer)
p3_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 225 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow3, p3_killer)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER )
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p2)
ENDIF

IF (HAS_CHARACTER_DIED(p4_killer))
REMOVE_ARROW(killerarrow4)
DELETE_ITEM(p4_killer)
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow4, p4_killer)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p2)
ENDIF
ENDWHILE

LEVELEND[/mis]

Player 3 script (only use this with three people in total. In this case you and two friends or something.)
[mis]//Player three script. All bots should target player 1, 2 and 3 ONLY.
//Players
PLAYER_PED P1 = ( 124.5, 118.5, 255.0 ) 37 180
PLAYER_PED P2 = ( 113.5, 118.5, 255.0 ) 37 180
PLAYER_PED P3 = ( 114.5, 130.5, 255.0 ) 37 180
//The 4th player wont be needed in a 3-player game.
//PLAYER_PED P4 = ( 124.5, 131.5, 255.0 ) 37 180

//Arrows
ARROW_DATA killerarrow1
ARROW_DATA killerarrow2
ARROW_DATA killerarrow3
ARROW_DATA killerarrow4

//chars
CHAR_DATA p1_killer
CHAR_DATA p2_killer
CHAR_DATA p3_killer
CHAR_DATA p4_killer //This bot will switch between targets.

//Scriptvaraibles
COUNTER regenerating_characters = 1
COUNTER killertarget = 1 //Used to switch between targets after respawning the 4th bot.
COUNTER targetset = 0 //Just a precaution so the target switching works properly.

LEVELSTART

// Create the killers:
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 315 CRIMINAL_TYPE1 END
p2_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 045 CRIMINAL_TYPE1 END
p3_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 2 225 CRIMINAL_TYPE1 END
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE1 END
//Point arrows at the bots.
POINT_ARROW_AT(killerarrow1, p1_killer)
POINT_ARROW_AT(killerarrow2, p2_killer)
POINT_ARROW_AT(killerarrow3, p3_killer)
POINT_ARROW_AT(killerarrow4, p4_killer)
// Arm the killers:
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
// Make the killers attack any nearby player:
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)//Target player 1.
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p2)//Target player 2.
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p3)//Target player 3.
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p1)//Target player 1 by default.
//Switch targets on death though.

// Respawn each killer if they die:
WHILE_EXEC (regenerating_characters = 1)
IF (HAS_CHARACTER_DIED(p1_killer))
REMOVE_ARROW(killerarrow1)
DELETE_ITEM(p1_killer)
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 0 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow1, p1_killer)
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p2_killer))
REMOVE_ARROW(killerarrow2)
DELETE_ITEM(p2_killer)
p2_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 1 45 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow2, p2_killer)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p2)
ENDIF

IF (HAS_CHARACTER_DIED(p3_killer))
REMOVE_ARROW(killerarrow3)
DELETE_ITEM(p3_killer)
p3_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 225 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow3, p3_killer)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER )
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p3)
ENDIF

IF (HAS_CHARACTER_DIED(p4_killer))
REMOVE_ARROW(killerarrow4)
DELETE_ITEM(p4_killer)
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow4, p4_killer)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
IF((killertarget = 1) AND (targetset = 0))
SET killertarget = 2
SET targetset = 1 //Makes sure the other IF blocks dont start up if this one did something.
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p2)
ENDIF
IF((killertarget = 2) AND (targetset = 0))
SET killertarget = 3
SET targetset = 1
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p3)
ENDIF
IF((killertarget = 3) AND (targetset = 0))
SET killertarget = 1 //Reset back to player 1 as target.
SET targetset = 1
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF
SET targetset = 0 //Makes all the IF blocks available again.
ENDIF
ENDWHILE

LEVELEND[/mis]

Player 4 script (only use this with 4 players in total)
[mis]//Player four script. All bots should target player 1, 2, 3 and 4 respectively.
//Players
PLAYER_PED P1 = ( 124.5, 118.5, 255.0 ) 37 180
PLAYER_PED P2 = ( 113.5, 118.5, 255.0 ) 37 180
PLAYER_PED P3 = ( 114.5, 130.5, 255.0 ) 37 180
PLAYER_PED P4 = ( 124.5, 131.5, 255.0 ) 37 180

//Arrows
ARROW_DATA killerarrow1
ARROW_DATA killerarrow2
ARROW_DATA killerarrow3
ARROW_DATA killerarrow4

//chars
CHAR_DATA p1_killer
CHAR_DATA p2_killer
CHAR_DATA p3_killer
CHAR_DATA p4_killer

//Scriptvaraibles
COUNTER regenerating_characters = 1

LEVELSTART

// Create the killers:
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 315 CRIMINAL_TYPE1 END
p2_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 045 CRIMINAL_TYPE1 END
p3_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 2 225 CRIMINAL_TYPE1 END
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE1 END
//Point arrows at the bots.
POINT_ARROW_AT(killerarrow1, p1_killer)
POINT_ARROW_AT(killerarrow2, p2_killer)
POINT_ARROW_AT(killerarrow3, p3_killer)
POINT_ARROW_AT(killerarrow4, p4_killer)
// Arm the killers:
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
// Make the killers attack any nearby player:
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)//Target player 1.
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p2)//Target player 3.
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p3)//Target player 2.
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p4)//Target player 4.

// Respawn each killer if they die:
WHILE_EXEC (regenerating_characters = 1)
IF (HAS_CHARACTER_DIED(p1_killer))
REMOVE_ARROW(killerarrow1)
DELETE_ITEM(p1_killer)
p1_killer = CREATE_CHAR ( 114.5,118.5,255.0 ) 0 0 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow1, p1_killer)
GIVE_WEAPON (p1_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p1_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p1_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p1_killer, KILL_CHAR_ON_FOOT, p1)
ENDIF

IF (HAS_CHARACTER_DIED(p2_killer))
REMOVE_ARROW(killerarrow2)
DELETE_ITEM(p2_killer)
p2_killer = CREATE_CHAR ( 122.5,131.5,255.0 ) 1 45 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow2, p2_killer)
GIVE_WEAPON (p2_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p2_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p2_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p2_killer, KILL_CHAR_ON_FOOT, p2)
ENDIF

IF (HAS_CHARACTER_DIED(p3_killer))
REMOVE_ARROW(killerarrow3)
DELETE_ITEM(p3_killer)
p3_killer = CREATE_CHAR ( 114.5,131.5,255.0 ) 1 225 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow3, p3_killer)
GIVE_WEAPON (p3_killer, ROCKET_LAUNCHER )
SET_CHAR_THREAT_SEARCH (p3_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p3_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p3_killer, KILL_CHAR_ON_FOOT, p3)
ENDIF

IF (HAS_CHARACTER_DIED(p4_killer))
REMOVE_ARROW(killerarrow4)
DELETE_ITEM(p4_killer)
p4_killer = CREATE_CHAR ( 122.5,119.5,255.0 ) 3 135 CRIMINAL_TYPE2 END
POINT_ARROW_AT(killerarrow4, p4_killer)
GIVE_WEAPON (p4_killer, ROCKET_LAUNCHER)
SET_CHAR_THREAT_SEARCH (p4_killer, AREA_PLAYER_ONLY)
SET_CHAR_THREAT_REACTION (p4_killer, REACT_AS_NORMAL)
SET_CHAR_OBJECTIVE (p4_killer, KILL_CHAR_ON_FOOT, p4)
ENDIF
ENDWHILE

LEVELEND[/mis]

There's probaly some tutorials around for creating basic mmp files in case you're unfamiliar with those, maybe i could link some later, for now try and see if the Player 1/singleplayer script works for you on your map. The coordinates may need ajusting though for it to work, or work optimally.

Edit: Oh, aside from deleting their corpses on death and stuff, i also gave them arrows. Now whatever you do if an object has an arrow on it and you want to delete it, delete the arrow fist and then call DELETE_ITEM, or else it will probaly crash.

Re: .mis Error

Posted: 25 Jun 2012, 14:45
by Alberto
The first Script worked Successfully
The Arrows Points at the bots And ALL The Bots spawn
I Can add the Map In The Forum for TEST

Re: .mis Error

Posted: 25 Jun 2012, 15:51
by CarThief
Uh, i suppose there should be no problem making a topic for the map to test it with someone, or to simply upload it somewhere on the internet and share it from the GH, you can even upload files onto the forums by adding attachments to any of your posts.

Just make sure when you make mmp files to test this map in multiplayer, to use script 1 for singleplayer only, no more then 1 player. The second script should only work for 2 players, third script only for 3 players and the fourth one only for 4 players, no more no less. If you do play them with the incorrect player amount it will crash or show servere bugs, this is always the case when making something complex that refers to player peds, it will need a different script for each player count / mmp file.

Some examples would be the scripts of bot maps where you can fight against the computer, those scripts are specially made for a specific player count per mmp file entry.
Edit: I see you already made a topic? Just remember the whole player thing though. Else scripts will keep crashing.

Re: .mis Error

Posted: 25 Jun 2012, 16:12
by Sektor
One script can support 1 to 6 players, it just requires careful use of CHECK_CHARACTER_HEALTH. It's usually best not to split them up since it can be harder to maintain and I already have more than 2400 files in my GTA2 data folder.

Re: .mis Error

Posted: 28 Jun 2012, 10:15
by Vike the Hube
Sektor wrote:I already have more than 2400 files in my GTA2 data folder.
This.