SET command/Scriptable instant gang
Posted: 08 Aug 2012, 21:40
Hi,
tried some map editing today, but run quickly into problems
I want to have an automatic instant gang which is always active and is constantly refilled. I got it working and it is quite stable, but sometimes it still crashes. Maybe you know how to do it better.
Here is my current version:
[syntax=mis]PLAYER_PED p1 = (120.1, 120.5, 255.0) 19 0
MAP_ZONE copgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
MAP_ZONE redgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
CHAR_DATA char
ONSCREEN_COUNTER onscreen
counter stage=1
counter bots = 1
counter died = 0
counter wait=9
CHAR_DATA botgroup
wait_short:
DELAY_HERE ( 100 )
RETURN
LEVELSTART
ADD_ONSCREEN_COUNTER (onscreen, died)
ADD_ONSCREEN_COUNTER (onscreen, bots)
SET_AMBIENT_LEVEL ( 0.3, 3 )
SET_GANG_INFO (copgang,23,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
3, 0.0,0.0,0.0,
10,TANK,24)
SET_GANG_INFO (redgang, 14,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
1, 0.0,0.0,0.0,
10,FIRETRUK,-1)
SET_GANG_KILL_REACTION (redgang, copgang, 10)
SET_GANG_KILL_REACTION (copgang, redgang, 10)
ADD_GROUP_TO_CHARACTER(p1, 0)
WHILE(stage=1)
IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))
IF(HAS_CHARACTER_DIED(p1))
IF(died=0)
SET died=1
SET bots=0
SET wait=1
ENDIF
ELSE
IF(died=1)
//DESTROY_GROUP(p1)
SET_ALL_CONTROLS_STATUS (p1, OFF )
ADD_GROUP_TO_CHARACTER(p1, 0)
SET died=0
//GOSUB wait_short:
ENDIF
ENDIF
IF(bots=1)
IF((NOT(CHECK_NUMBER_ALIVE_IN_GROUP (p1,9)))AND(NOT(IS_CHARACTER_STOPPED(p1))) )
botgroup = CREATE_CHAR ( 125.1, 120.5, 255.0 ) 12 90 PSYCHO END
GIVE_WEAPON(botgroup,PISTOL)
//ADD_GROUP_TO_CHARACTER (botgroup,0)
ADD_EXISTING_CHAR_TO_GROUP (p1, botgroup)
ENDIF
ENDIF
ENDIF
IF(wait>0)
++wait
ENDIF
IF(wait>=10)
SET_ALL_CONTROLS_STATUS ( p1 , ON )
SET bots=1
SET wait=0
ENDIF
ENDWHILE
LEVELEND[/syntax]
It still sometimes crashes if the player is shocked (hit by electrogun and laying on ground) or is hit by explosion and tries to move in the same moment. Thats why I deactive the controls status and check if the player is moving in first place. Is there no way to check if the player is lying on ground or flying after explosion? HAS_CHARACTER_DIED is triggering too late here.
Of course it also crashes if player is near bot spawning or seldom without appearent cause.
Sry for bad code formatting and thx in advance
tried some map editing today, but run quickly into problems
I want to have an automatic instant gang which is always active and is constantly refilled. I got it working and it is quite stable, but sometimes it still crashes. Maybe you know how to do it better.
Here is my current version:
[syntax=mis]PLAYER_PED p1 = (120.1, 120.5, 255.0) 19 0
MAP_ZONE copgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
MAP_ZONE redgang = ( 1000 , 0 , 0 , 0 , 1000 , 0 , 0 , 0 , 1000 , 0 , 1000 )
CHAR_DATA char
ONSCREEN_COUNTER onscreen
counter stage=1
counter bots = 1
counter died = 0
counter wait=9
CHAR_DATA botgroup
wait_short:
DELAY_HERE ( 100 )
RETURN
LEVELSTART
ADD_ONSCREEN_COUNTER (onscreen, died)
ADD_ONSCREEN_COUNTER (onscreen, bots)
SET_AMBIENT_LEVEL ( 0.3, 3 )
SET_GANG_INFO (copgang,23,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
3, 0.0,0.0,0.0,
10,TANK,24)
SET_GANG_INFO (redgang, 14,ELECTRO_GUN,ELECTRO_GUN,ELECTRO_GUN,
1, 0.0,0.0,0.0,
10,FIRETRUK,-1)
SET_GANG_KILL_REACTION (redgang, copgang, 10)
SET_GANG_KILL_REACTION (copgang, redgang, 10)
ADD_GROUP_TO_CHARACTER(p1, 0)
WHILE(stage=1)
IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))
IF(HAS_CHARACTER_DIED(p1))
IF(died=0)
SET died=1
SET bots=0
SET wait=1
ENDIF
ELSE
IF(died=1)
//DESTROY_GROUP(p1)
SET_ALL_CONTROLS_STATUS (p1, OFF )
ADD_GROUP_TO_CHARACTER(p1, 0)
SET died=0
//GOSUB wait_short:
ENDIF
ENDIF
IF(bots=1)
IF((NOT(CHECK_NUMBER_ALIVE_IN_GROUP (p1,9)))AND(NOT(IS_CHARACTER_STOPPED(p1))) )
botgroup = CREATE_CHAR ( 125.1, 120.5, 255.0 ) 12 90 PSYCHO END
GIVE_WEAPON(botgroup,PISTOL)
//ADD_GROUP_TO_CHARACTER (botgroup,0)
ADD_EXISTING_CHAR_TO_GROUP (p1, botgroup)
ENDIF
ENDIF
ENDIF
IF(wait>0)
++wait
ENDIF
IF(wait>=10)
SET_ALL_CONTROLS_STATUS ( p1 , ON )
SET bots=1
SET wait=0
ENDIF
ENDWHILE
LEVELEND[/syntax]
It still sometimes crashes if the player is shocked (hit by electrogun and laying on ground) or is hit by explosion and tries to move in the same moment. Thats why I deactive the controls status and check if the player is moving in first place. Is there no way to check if the player is lying on ground or flying after explosion? HAS_CHARACTER_DIED is triggering too late here.
Of course it also crashes if player is near bot spawning or seldom without appearent cause.
Sry for bad code formatting and thx in advance