Quantcast

Jump to content

» «
Photo

Scrypt error

13 replies to this topic
Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#1

Posted 01 April 2012 - 11:23 AM

Hi. I got some error in my scrypt and it's very hard to find it because it's happening very rarely (almost 1 in 100 cases). Before I start telling you about it I'm sure that the timers (16@ and 17@) are not causing it because I puted them in scrypt yesterday and me and this error met eachother a long time ago. The problem is that sometimes when I hit the pilot in the head or when I blow up a heli-the game crashes and just as I said before it's very rare (mostly when I shot a pilot in the head the game crashes before heli even start to simulate crash landing). The scrypt has several ideas (and I would like to stay that way): if a pilot is being shot the heli will simulate crashing, if a heli is blown up with a projectile he'll explode instantly. Here's the scrypt:
CODE
{$CLEO .cs}

:HUNTERATACK
thread 'HELI'

:LOAD
wait 250
if and
  Player.Defined($PLAYER_CHAR)
  Player.WantedLevel($PLAYER_CHAR) > 3
else_jump @LOAD
Model.Load(#HUNTER)
Model.Load(#ARMY)
Model.Load(#M4)
038B: load_requested_models

:CREATE
wait 0
if and
  Model.Available(#HUNTER)
  Model.Available(#ARMY)
  Model.Available(#M4)
else_jump @CREATE
04C4: create_coordinate 13@ 14@ 15@ from_actor $PLAYER_ACTOR offset 0.0 200.0 150.0
1@ = Car.Create(#HUNTER, 13@, 14@, 15@)
Car.Health(1@) = 150000
Car.ImmuneToNonPlayer(1@) = True
Car.SetImmunities(1@, 1, 1, 0, 1, 1)
0129: 3@ = create_actor 6 #ARMY in_car 1@ driverseat
9@ = Actor.Create(Cop, #ARMY, 13@, 14@, 15@)
10@ = Actor.Create(Cop, #ARMY, 13@, 14@, 15@)
0464: put_actor 9@ into_turret_on_car 1@ at_car_offset 0.8 0.0 0.5 position 3 angle 180.0 with_weapon 26
0464: put_actor 10@ into_turret_on_car 1@ at_car_offset -0.8 0.0 0.5 position 3 angle 180.0 with_weapon 26
02E2: set_actor 9@ weapon_accuracy_to 100
02E2: set_actor 10@ weapon_accuracy_to 100
Actor.Health(3@) = 10
Actor.Health(9@) = 10
Actor.Health(10@) = 10
Actor.Health(3@) = 10
Marker.TieToCar(4@, 1@, 4, 2)
Marker.SetColor(4@, 1)
Model.Destroy(#HUNTER)
Model.Destroy(#ARMY)
Model.Destroy(#M4)

:EVANTS
wait 0
if
8443:   not player $PLAYER_CHAR in_a_car
else_jump @GOHIGH
04C4: create_coordinate 13@ 14@ 15@ from_actor $PLAYER_ACTOR offset 0.0 40.0 20.9
04A2: heli 1@ fly_to 13@ 14@ 15@ speed 100
if
0184:   actor 3@ health >= 1
else_jump @CRASH
if
0185:   car 1@ health >= 149500
else_jump @BLOW
05E0: 0@ = read_memory 0x94AD28 size 4 virtual_protect 0  
0@ += 0x244
05E0: 2@ = read_memory 0@ size 1 virtual_protect 0
if or
  NOT 2@ == 62 // integer values
8117:   NOT   player $PLAYER_CHAR wasted
else_jump @END
wait 0
jump @EVANTS
05DC: end_custom_thread

:CRASH
wait 0
16@ = 0 // integer values

:CRASHH
wait 0
0564: set_vehicle 1@ helicopter_simulate_crash_landing
if
 16@ >= 4000 // integer values
else_jump @CRASHH

:BLOW
04C4: create_coordinate 5@ 6@ 7@ from_actor $PLAYER_ACTOR offset 0.0 40.0 0.0
02D4: car 1@ turn_off_engine
020B: explode_car 1@
Car.StorePos(1@, 5@, 6@, 7@)
020C: create_explosion_with_radius 11 at 5@ 6@ 7@
039D: scatter_particles 17 0.8 0 0 0 11000 at 5@ 6@ 7@ 0.1 0.0 0.2
jump @END

:GOHIGH
wait 0
04C4: create_coordinate 13@ 14@ 15@ from_actor $PLAYER_ACTOR offset 0.0 -25.0 75.0
04A2: heli 1@ fly_to 13@ 14@ 15@ speed 100
05E0: 0@ = read_memory 0x94AD28 size 4 virtual_protect 0  
0@ += 0x244
05E0: 2@ = read_memory 0@ size 1 virtual_protect 0
if or
 2@ == 62 // integer values
0117: player $PLAYER_CHAR wasted
else_jump @EVANTS

:END
wait 0
17@ = 0 // integer values

:ENDD
wait 0
if
 17@ >= 4000 // integer values
else_jump @ENDD
Marker.Disable(4@)
Actor.DestroyWithFade(3@)
Actor.DestroyWithFade(9@)
Actor.DestroyWithFade(10@)
Car.RemoveReferences(1@)
jump @LOAD

Just one more thing-why the below opcode crashing the game? Is it because it can't be used on a dead actor?
CODE
01C2: remove_references_to_actor 1@ ;; Like turning an actor into a random pedestrian

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009

#2

Posted 01 April 2012 - 11:42 AM

CODE
01C2: remove_references_to_actor 1@;; Like turning an actor into a random pedestrian

Just because actor is dead he isn't meant to vanish itself if he's on list of "needed" vehicles controlled by script.

Actually native SCM command was:
CODE
MARK_CHAR_AS_NO_LONGER_NEEDED

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#3

Posted 01 April 2012 - 01:58 PM Edited by JACK JONES, 01 April 2012 - 02:05 PM.

QUOTE
Just because actor is dead he isn't meant to vanish itself if he's on list of "needed" vehicles controlled by script.

Yes I know but when I put that opcode in the "ENDD" label-the game crashes instantly so I have no choice but to use "destroy_actor" command instead of "remove_references_to_actor". My question is will the game crash if I use "remove_references" on the alive actor? Also I'm guessing that scrypt error (that is happening rarely in a moment when pilot 3@ is killed) has something to do with heli (or pilot) helth. This damn error is boring me for the passed two weeks. Does anybody have any idea why the game crashes? Of course I could make heli to be completely bulletproof and explosion proof but it's much more realistic if a heli explodes when I hit him with a projectile (or start simulation of crash landing if a pilot is no longer in heli).

spaceeinstein
  • spaceeinstein

    巧克力

  • Members
  • Joined: 17 Jul 2003
  • None

#4

Posted 01 April 2012 - 05:31 PM

01C2 is for characters (actors). You have assigned 1@ to a car.

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#5

Posted 01 April 2012 - 05:52 PM

But my SB showing me 01C3 which is for cars. See it yourself:
user posted image

Bad.boy!
  • Bad.boy!

    SA modder

  • Members
  • Joined: 20 Jun 2010

#6

Posted 01 April 2012 - 05:55 PM

You're talking about different opcodes, spaceeinstein meant this:
QUOTE
CODE
01C2: remove_references_to_actor 1@;; Like turning an actor into a random pedestrian

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#7

Posted 01 April 2012 - 06:30 PM Edited by JACK JONES, 13 April 2012 - 12:06 PM.

Oh that - that's not an error - I chose number 1@ randomly to show that opcode which I expelled from the scrypt and replaced it with another one but I don't know why the game crashes sometimes when I kill the pilot.
EDIT: It's solved (I think).

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#8

Posted 13 April 2012 - 12:08 PM Edited by JACK JONES, 13 April 2012 - 12:22 PM.

I'm sorry for bringing this up guys but the same (pilot dead - start heli crash) error is happening again in my scrypt. The reason I want to talk about this is because I forgot to mention that I made some changes in the weapon.dat file so I got to ask - could such changes (in weapon.dat file) effect on my CLEO scrypt and cause the mysterious game crashing in a moment when I kill the pilot with one of the riffles? Here are the details about my weapon.dat:
CODE
Tec9  INSTANT_HIT 90.0  250  1000 30   40  -1.0 -1.0  -1.0  -1.0  0.88 -0.04 0.16   rifle    7.5 8 8   11 12 11   99  281 -1  28050 5
Uzi INSTANT_HIT 45.0  250  500  30   20  -1.0 -1.0  -1.0  -1.0  0.45  0.00 0.12   uzi 11 13 11  11 13 11   25  282 -1  28840 5
Mp5 INSTANT_HIT 45.0  250  500  30   35  -1.0 -1.0  -1.0  -1.0  0.51 -0.01 0.20   uzi 11 13 13  11 13 11   30  284 -1  28840 5

m4 INSTANT_HIT 90.0  250  1000 60   40  -1.0 -1.0  -1.0   -1.0 0.88 -0.04 0.16   rifle    11 12 11  11 12 11   99  280 -1  28050 6
Ruger INSTANT_HIT 90.0  250  1000 30   37  -1.0 -1.0  -1.0   -1.0 1.00 -0.06 0.17   rifle    11 13 13  11 13 11   99  276 -1  28040 6

Launcher PROJECTILE  55.0  100  1200 1    75  2.0  -1.0  1000.0 1.0  0.42 0.0 0.05   unarmed  0  99 14  0  99 14   99  287 -1   324 7

M60 INSTANT_HIT 75.0  1    60  100  100 -1.0 -1.0  -1.0   -1.0  1.0  0.00 0.23   rifle    11 12 11  11 12 11   99  289 -1   28050 7
Minigun INSTANT_HIT 75.0  1    350  500  140 -1.0 -1.0  -1.0  -1.0  1.28 0.00 0.50   flame    11 12 11  11 12 11   35  290 294  200 7

When I'm shooting at the heli I mostly use the m4 weapon which I changed to be the same as m16 from gtaIII (60 bullets in clip, higher speed of firying and increased damage effect). And I tested the scrypt for the past 6 days until I finaly realised that the same error is still happening.
EDIT: And this "remove_references_to_actor" opcode is working now but the game crashing (after pilots death) still continous (rarely).

Dilys95
  • Dilys95

    Player Hater

  • BUSTED!
  • Joined: 01 Apr 2012

#9

Posted 14 April 2012 - 01:59 AM

user posted imageJust because actor is dead he isn't meant to vanish itself if he's on list of "needed" vehicles controlled by script.

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#10

Posted 14 April 2012 - 10:51 AM Edited by JACK JONES, 16 April 2012 - 11:14 AM.

I just tested the scrypt in the original Vice City and the game crashing happened again (after I shot the actor 3@) which means that the error is definitely IN the CLEO scrypt - non related to anything else besides the scrypt. The crashing is probably happening because of this opcode:
CODE
0564: set_vehicle 1@ helicopter_simulate_crash_landing
I'm almost 95% sure because when I expel that opcode from the scrypt the crashing stops and this is not the first time that 0564 crashing the game. Does anyone know why this opcode making troubles in my scrypts? Maybe I don't use it properly? If anyone read this please tell me everything you know about the 0564.
Also I made some changes in my scrypt (it's basicly the same - I only used diferent method of scrypting so I could expand it in the future):
CODE
{$CLEO .cs}
thread 'H1'

:START
wait 0
if and
  Player.Defined($PLAYER_CHAR)
  Player.WantedLevel($PLAYER_CHAR) > 3
else_jump @START
Model.Load(#HUNTER)
Model.Load(#ARMY)
Model.Load(#M4)
038B: load_requested_models

:LOAD
wait 0
if and
  Model.Available(#HUNTER)
  Model.Available(#ARMY)
  Model.Available(#M4)
else_jump @LOAD
04C4: create_coordinate 13@ 14@ 15@ from_actor $PLAYER_ACTOR offset 0.0 40.0 30.0
1@ = Car.Create(#HUNTER, 13@, 14@, 15@)
Car.ImmuneToNonPlayer(1@) = True
Car.SetImmunities(1@, 1, 1, 0, 1, 1)
Car.Health(1@) = 150000
0129: 3@ = create_actor 4 #ARMY in_car 1@ driverseat
9@ = Actor.Create(CivMale, #ARMY, 13@, 14@, 15@)
10@ = Actor.Create(CivMale, #ARMY, 13@, 14@, 15@)
0464: put_actor 9@ into_turret_on_car 1@ at_car_offset 0.8 0.0 0.5 position 3 angle 180.0 with_weapon 26
0464: put_actor 10@ into_turret_on_car 1@ at_car_offset -0.8 0.0 0.5 position 3 angle 180.0 with_weapon 26
02E2: set_actor 9@ weapon_accuracy_to 10
02E2: set_actor 10@ weapon_accuracy_to 10
Actor.Health(9@) = 10
Actor.Health(10@) = 10
Actor.Health(3@) = 10
Marker.TieToCar(4@, 1@, 4, 2)
Marker.SetColor(4@, 1)
Model.Destroy(#HUNTER)
Model.Destroy(#ARMY)
Model.Destroy(#M4)

:GSB
wait 0
gosub @HELI1
05E0: 0@ = read_memory 0x94AD28 size 4 virtual_protect 0  
0@ += 0x244
05E0: 2@ = read_memory 0@ size 1 virtual_protect 0
if or
 2@ == 62 // integer values
0117:   player $PLAYER_CHAR wasted
  Actor.Dead(3@)
else_jump @GSB
16@ = 0 // integer values

:DESTROY
wait 0
if
 16@ >= 4000 // integer values
else_jump @DESTROY
Marker.Disable(4@)
Actor.DestroyWithFade(3@)
Actor.DestroyWithFade(9@)
Actor.DestroyWithFade(10@)
Car.Destroy(1@)
jump @START
05DC: end_custom_thread

:HELI1
wait 0
if
8443:   not player $PLAYER_CHAR in_a_car
else_jump @GOHIGH
04C4: create_coordinate 13@ 14@ 15@ from_actor $PLAYER_ACTOR offset 0.0 30.0 30.0
04A2: heli 1@ fly_to 13@ 14@ 15@ speed 100
if
0449:   actor 3@ in_a_car
else_jump @CRASH0
if
0185:   car 1@ health >= 149500
else_jump @EXPLO1

:Return1
return

:CRASH0
17@ = 0 // integer values
0564: set_vehicle 1@ helicopter_simulate_crash_landing

:CRASH1
wait 0
if
 17@ >= 4000 // integer values
else_jump @CRASH1

:EXPLO1
04C4: create_coordinate 5@ 6@ 7@ from_actor $PLAYER_ACTOR offset 0.0 40.0 0.0
02D4: car 1@ turn_off_engine
020B: explode_car 1@
Car.StorePos(1@, 5@, 6@, 7@)
020C: create_explosion_with_radius 2 at 5@ 6@ 7@
020C: create_explosion_with_radius 11 at 5@ 6@ 7@
020C: create_explosion_with_radius 1 at 5@ 6@ 7@
020C: create_explosion_with_radius 6 at 5@ 6@ 7@
039D: scatter_particles 17 0.8 0 0 0 11000 at 5@ 6@ 7@ 0.1 0.0 0.2
jump @Return1

:GOHIGH
wait 0
04C4: create_coordinate 13@ 14@ 15@ from_actor $PLAYER_ACTOR offset 0.0 -25.0 75.0
04A2: heli 1@ fly_to 13@ 14@ 15@ speed 100
jump @Return1

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#11

Posted 16 April 2012 - 11:14 AM

QUOTE
tell me everything you know about the 0564.

all i know about this is
0564 is not in my OPCrash list,
it used to make a Chopper crash on land,
it is used simply as others,
i have tested & it's 100% working.
----------------------------------------
does the game still crash after this Script ?
if yes then tell me what exactly you want this script to do!

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#12

Posted 16 April 2012 - 11:22 AM Edited by JACK JONES, 16 April 2012 - 11:55 AM.

Yes this last scrypt is still crashing (I spend the whole day testing it and the crashing is happening SOMETIMES when I eliminate the pilot 3@). The idea is that heli should start simulation of a crash landing only if a pilot is no longer in heli (like when I kill him he drops from the heli and the simulation starts but sometimes in that moment the game crashes - not always). And if a heli is hit with a projectile he'll explode instantly as you can see in the scrypt:
CODE
if
0185:   car 1@ health >= 149500
else_jump @EXPLO1

So if a pilot is outside the heli - crash landing simulation, if a heli is hit with a projectile - instant explosion. After one of these two evants everything goes from the begining - the hunter will dissappear and a new hunter will show up if the number of stars is bigger then 3. And if a player is wasted or busted the heli will dissappear and the code continuous from the start. And the heli should follow player in a certain distance. Soldiers have orders to shoot at him on site.
EDIT: 4 sec after crash landing simulation the heli should explode with radius 11.

Harriet61
  • Harriet61

    Player Hater

  • BUSTED!
  • Joined: 02 Apr 2012

#13

Posted 16 April 2012 - 01:28 PM

user posted imageI hate the mancinis as much as everyone else does.

Jack...
  • Jack...

    Wanted Level modifications

  • Feroci Racing
  • Joined: 06 Dec 2011
  • Serbia

#14

Posted 16 April 2012 - 01:55 PM Edited by JACK JONES, 16 April 2012 - 04:53 PM.

Your bullsh*t sentence doesn't mean anything and it's not related with my topic. WTF are you doing here? You're not one of those native english speakers aren't you? If that's the case then I'll tell you in your words: "Not to Spamming Here" biggrin.gif .




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users