Quantcast

Jump to content

» «
Photo

[GTA SA] ~ CLEO Script Tutorial ~

631 replies to this topic
ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#91

Posted 27 July 2010 - 08:21 PM Edited by ZAZ, 27 July 2010 - 08:36 PM.

QUOTE (bmb @ Jul 27 2010, 04:34)
Ok Zaz I need you expertise again.

I tried doing this:
CODE
:GANG_TASK_UNIT_585
if or
Player.WantedLevel($PLAYER_CHAR) = 1
Player.WantedLevel($PLAYER_CHAR) = 2
Player.WantedLevel($PLAYER_CHAR) = 3
Player.WantedLevel($PLAYER_CHAR) = 4
Player.WantedLevel($PLAYER_CHAR) = 5
else_jump @GANG_TASK_UNIT_585  
06E4: AS_actor 7@ attempt_to_bust_actor $PLAYER_ACTOR  
06E4: AS_actor 8@ attempt_to_bust_actor $PLAYER_ACTOR


Game crashes

Player.WantedLevel($PLAYER_CHAR) = 1 is no condition opcode, it means set player wanted level

------------------------------------------------------------------

The origin random_car (get_car_in_sphere handle_as 0@) have unstable aspects
just read the coords when 0@ is not -1 and then destroy it
and don't bind this check into the load model check
decrease the radius of 073E: instead checking if it is near player in radius of 100.0

don't spawn actors or vehicles in the same position
CODE
7@ = Actor.Create(Cop, #SPECIAL01, 1@, 2@, 3@)
8@ = Actor.Create(Cop, #SPECIAL02, 1@, 2@, 3@)
9@ = Actor.Create(gang1, #BALLAS3, 1@, 2@, 3@)


check if the tuningpart is loaded
CODE
06EA:   car_component_available #WHEEL_GN3


CODE
{$CLEO .cs}
thread 'GANG_TASK_UNIT'

:GANG_TASK_UNIT_19
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @GANG_TASK_UNIT_19
if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 1555.0 -1520.0 100.0 radius 1275.0 800.0 1000.0
jf @GANG_TASK_UNIT_19
00A0: store actor $PLAYER_ACTOR position to 1@ 2@ 3@
073E: get_car_in_sphere 1@ 2@ 3@ radius 100.0 model -1 handle_as 0@
if
  not 0@ == -1
jf @GANG_TASK_UNIT_19
0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 0.0 0.0
4@ = Car.Angle(0@)

:GANG_TASK_UNIT_169
wait 0
023C: load_special_actor 'TENPEN' as 1 // models 290-299
023C: load_special_actor 'PULASKI' as 2 // models 290-299
Model.Load(#COPCARLA)
Model.Load(#DESERT_EAGLE)
Model.Load(#SHOTGSPA)
Model.Load(#BALLAS3)
06E9: load_car_component #WHEEL_GN3
038B: load_requested_models
if and
023D:   special_actor 1 loaded
023D:   special_actor 2 loaded
  Model.Available(#COPCARLA)
  Model.Available(#DESERT_EAGLE)
  Model.Available(#SHOTGSPA)
  Model.Available(#BALLAS3)
06EA:   car_component #WHEEL_GN3 available
jf @GANG_TASK_UNIT_169
Car.Destroy(0@)
5@ = Car.Create(#COPCARLA, 1@, 2@, 3@)
06E7: 6@ = add_car_component #WHEEL_GN3 to_car 5@
0229: set_car 5@ primary_color_to 0 secondary_color_to 1
Car.SetMaxSpeed(5@, 20.0)
Car.Angle(5@) = 4@
Car.Health(5@) = 1000
Car.SetToNormalDriver(5@)
Car.SetDriverBehaviour(5@, KillThePlayer)
7@ = Actor.Create(Cop, #SPECIAL01, 0.0, 0.0, 100.0)
8@ = Actor.Create(Cop, #SPECIAL02, 1.0, 0.0, 100.0)
9@ = Actor.Create(Gang1, #BALLAS3, 2.0, 0.0, 100.0)
01B2: give_actor 7@ weapon 27 ammo 9999 // Load the weapon model before using this
Actor.WeaponAccuracy(7@) = 95
081A: set_actor 8@ weapon_skill_to 1
Actor.WeaponAccuracy(8@) = 95
087E: set_actor 7@ weapon_droppable 1
087E: set_actor 8@ weapon_droppable 1
07DD: set_actor 7@ temper_to 100 // see pedstats.dat
07DD: set_actor 8@ temper_to 100 // see pedstats.dat
0245: set_actor 7@ walk_style_to "SWAT"
0245: set_actor 8@ walk_style_to "SWAT"
0245: set_actor 9@ walk_style_to "GANG1"
072A: put_actor 8@ into_car 5@ driverseat
0430: put_actor 7@ into_car 5@ passenger_seat 0
0430: put_actor 9@ into_car 5@ passenger_seat 1
03FE: set_actor 7@ money 2491
0296: unload_special_actor  1
0296: unload_special_actor  2
Model.Destroy(#BALLAS3)
Model.Destroy(#COPCARLA)
Model.Destroy(#DESERT_EAGLE)
Model.Destroy(#SHOTGSPA)
Model.Destroy(#WHEEL_GN3)

:GANG_TASK_UNIT_565
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @GANG_TASK_UNIT_659
if or
  Car.Wrecked(5@)
01F4:   car 5@ flipped
8202:   not actor $PLAYER_ACTOR near_car 5@ radius 500.0 500.0 flag 0
jf @GANG_TASK_UNIT_633
jump @GANG_TASK_UNIT_659

:GANG_TASK_UNIT_633
if and
  Actor.Dead(7@)
  Actor.Dead(8@)
  Actor.Dead(9@)
jf @GANG_TASK_UNIT_565

:GANG_TASK_UNIT_659
Car.RemoveReferences(5@)
Actor.RemoveReferences(7@)
Actor.RemoveReferences(8@)
Actor.RemoveReferences(9@)
jump @GANG_TASK_UNIT_19


give the car a marker for better observation


bmb
  • bmb

    "Lots of ideas trying to learn the skills"

  • Members
  • Joined: 02 Feb 2010

#92

Posted 28 July 2010 - 03:48 PM

Thanks Zaz, for all your help. That script is much better and I even got opcode 06E4 to work now.

CODE
Car.SetDriverBehaviour(5@, KillThePlayer)


That was funny, can psychodriver or other words be used there too?

Going to re-read your tutorials for now, and try to pick up more ideas.

Great work as always. icon14.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#93

Posted 28 July 2010 - 04:19 PM

QUOTE (bmb @ Jul 28 2010, 15:48)
Thanks Zaz, for all your help. That script is much better and I even got opcode 06E4 to work now.

CODE
Car.SetDriverBehaviour(5@, KillThePlayer)


That was funny, can psychodriver or other words be used there too?

Going to re-read your tutorials for now, and try to pick up more ideas.

Great work as always.  icon14.gif

these keywords are working for Car.SetDriverBehaviour:
Nowhere, FollowRoad, KillThePlayer, DriveToPlayer, IgnoreRoadPaths

Matheus Reis
  • Matheus Reis

    Only other GTA Fan

  • Members
  • Joined: 01 May 2010

#94

Posted 12 August 2010 - 11:40 PM

Hi ZAZ, I want to create a thing but I don't know how, can you help me?

Is this: I want to create a scm path but give to the coords a range, because when I put two cars to drive along the same path, a car hit the other and vice-versa, how can I fix it?

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#95

Posted 13 August 2010 - 04:39 PM

QUOTE (Matheus Reis @ Aug 12 2010, 23:40)
Hi ZAZ, I want to create a thing but I don't know how, can you help me?

Is this: I want to create a scm path but give to the coords a range, because when I put two cars to drive along the same path, a car hit the other and vice-versa, how can I fix it?

"but give to the coords a range"? don't know what you with this

You could assign the carrec path with a delay to the next car.
But best would be to make own carrec paths for each car. Do much effort to get good paths.
The more you make experience the more you will get good results

Matheus Reis
  • Matheus Reis

    Only other GTA Fan

  • Members
  • Joined: 01 May 2010

#96

Posted 13 August 2010 - 06:24 PM Edited by Matheus Reis, 13 August 2010 - 06:37 PM.

I'm meaning that the cars don't have to pass exactly where I assigned in scm path, understand?

How can I make carrec paths? '-' With APE?

Can you give me an example script?

They respect the traffic light, how do I change it?

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#97

Posted 13 August 2010 - 08:09 PM

They should ignore the paths, yes, read the car drive tutorial
Go to the first post of this tut and look for the themes, there you find the link to the Car Drive Tutorial and to Use Carrec Paths

Matheus Reis
  • Matheus Reis

    Only other GTA Fan

  • Members
  • Joined: 01 May 2010

#98

Posted 14 August 2010 - 01:11 AM

QUOTE (Matheus Reis @ Aug 13 2010, 18:24)
I'm meaning that the cars don't have to pass exactly where I assigned in scm path, understand?

Is it impossible? '-'

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#99

Posted 14 August 2010 - 05:21 AM

QUOTE (Matheus Reis @ Aug 14 2010, 01:11)
QUOTE (Matheus Reis @ Aug 13 2010, 18:24)
I'm meaning that the cars don't have to pass exactly where I assigned in scm path, understand?

Is it impossible? '-'


add_point_to_scmpath gives the cardriver a destination of an point and not of an area
CODE

05D6: clear_scmpath
05D7: add_point_to_scmpath  2353.1528 -1658.6493 13.384
05D7: add_point_to_scmpath  2431.7739 -1674.7444 13.6643
07E7: AS_assign_scmpath_to_actor 12@ in_car 0@ speed  20.0 flags  0  0  5


fourth param in 07E7: belongs to paths of nodes.dat
0 0 5 let it drive on paths
2 0 5 ignore the paths



If you wanna check if the car is near that point within a radius of maybe 20.0 units, then add a check
CODE
01AF:   car 0@  0 ()near_point 1@ 2@ 3@ radius  20.0  20.0  50.0

and give him new destionations
CODE

05D6: clear_scmpath
05D7: add_point_to_scmpath  < x, y, z, new destination>
07E7: AS_assign_scmpath_to_actor 12@ in_car 0@ speed  20.0 flags  0  0  5

Matheus Reis
  • Matheus Reis

    Only other GTA Fan

  • Members
  • Joined: 01 May 2010

#100

Posted 16 August 2010 - 06:31 PM Edited by Matheus Reis, 16 August 2010 - 08:03 PM.

I've created a carrec path but the car ignore the obstacles, for example:

I've entered in the front of the car that I assigned the path, it ignore me and hit CJ, how can I change it?

And I want to move camera with mouse, I've made it but now I don't know what i've did, help me! (I saw it in carrec path camera)

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#101

Posted 16 August 2010 - 09:24 PM

QUOTE (Matheus Reis @ Aug 16 2010, 18:31)
I've created a carrec path but the car ignore the obstacles, for example:

I've entered in the front of the car that I assigned the path, it ignore me and hit CJ, how can I change it?

And I want to move camera with mouse, I've made it but now I don't know what i've did, help me! (I saw it in carrec path camera)

The vehicle moves like train on a carrec-track.
Assigne the vehicle to carrec path when player has entered the car.
Camera works normal.
Did you tried my script example? click

If you had a camera problem, did it worked then again correct when you played then normally?

Matheus Reis
  • Matheus Reis

    Only other GTA Fan

  • Members
  • Joined: 01 May 2010

#102

Posted 17 August 2010 - 01:10 AM

So, how can I create a race like Rockstar ?! (With carrecs it occur, and with scm path or drive sequence is possible only to create 4 or 5 route-points), help me, you shouldn't know how much I want to know how to do that. dontgetit.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#103

Posted 17 August 2010 - 05:39 PM

QUOTE (Matheus Reis @ Aug 17 2010, 01:10)
So, how can I create a race like Rockstar ?! (With carrecs it occur, and with scm path or drive sequence is possible only to create 4 or 5 route-points), help me, you shouldn't know how much I want to know how to do that. dontgetit.gif

Not possible to explain. It's a theme for advanced coders. I'm the only one who made such scripts. (or maybe Desinka for Alien city)
[CLEO|WIP] New Races and NFS Outrun, Play the GTA SA races with every car you want
I adapted Rockstars CPRACE script and translated for cleo all globals into locals and edited a lot more.
It's a multiple script which use arrays and reads for each race a table of coords. It doesn' matter if it have 3 checkpoints or 30
For map mods I used the part which was done for the heli races to change the code to let opponent cars drive on carrec paths.

Well, it would be possible do make a more simple script.
You should read the car drive tutorial carfully, test the example scripts and try to understand just to get praxis with car driving scripts.
To use carrec paths, assigne the path to the car immediately after it is created.

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#104

Posted 29 August 2010 - 08:07 PM

I'm not a noob just not a coder so someone please answer my SIMPLE question!!!!!!! Ped spawn, how? i can spawn one but it just stands there. I wanna spawn a ped at my coords, set it to aggressive or no, and have it walk around, then repeat. suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif suicidal.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#105

Posted 30 August 2010 - 10:57 PM

QUOTE (kal-el5676 @ Aug 29 2010, 20:07)
I'm not a noob just not a coder so someone please answer my SIMPLE question!!!!!!! Ped spawn, how? i can spawn one but it just stands there. I wanna spawn a ped at my coords, set it to aggressive or no, and have it walk around, then repeat.  suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif   suicidal.gif



script below: go into red sphere in Grovestreet to spawn swat actor
CODE
{$CLEO .cs}
:ActorWalk_1
03A4: name_thread 'MODL'

:ActorWalk_2
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ActorWalk_2
00D6: if  0
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot 2491.5  -1667.5  13.35 radius  1.0  1.0  1.0
004D: jump_if_false @ActorWalk_2

0247: request_model #SWAT

:Load_Model_Check
0001: wait  0 ms
00D6: if  0
0248:   model #SWAT available
004D: jump_if_false @Load_Model_Check

009A: 1@ = create_actor_pedtype 22 model #SWAT at 2487.5  -1660.5  13.35
0173: set_actor 1@ z_angle_to 255.3781
0249: release_model #SWAT

0615: define_action_sequences 13@
05D6: clear_scmpath
05D7: add_point_to_scmpath  2474.4036 -1671.1002 13.3314
05D7: add_point_to_scmpath  2482.3828 -1682.174 13.3304
05D7: add_point_to_scmpath  2480.8169 -1726.5841 13.5547
05D7: add_point_to_scmpath  2522.562 -1725.4154 13.5469  

05D7: add_point_to_scmpath  2522.7358 -1718.514 13.5312
05D7: add_point_to_scmpath  2535.6318 -1706.942 13.4372
05D7: add_point_to_scmpath  2528.6187 -1690.41 13.7015
05D7: add_point_to_scmpath  2509.6377 -1676.5874 13.5469
05D8: AS_assign_scmpath to_actor -1 flags  7  3  
0616: define_action_sequences_end 13@
0618: assign_actor 1@ to_action_sequences 13@
061B: remove_references_to_AS_pack 13@



:ActorWalk_3
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ActorWalk_3
if  or
  Actor.Dead(1@)
80FF:   NOT   actor $PLAYER_ACTOR  0 ()near_point_on_foot 2491.5  -1667.5  13.35 radius  100.0  100.0  2.0
004D: jump_if_false @ActorWalk_3
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
0002: jump @ActorWalk_2

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#106

Posted 31 August 2010 - 04:24 AM

Thanks for responding zaz, however maybe i wasn't clear enough.

This code i need will be for a cleaned map so there won't be a grove street. I want to place a ped either have it walk around randomly or use the "go to" opcode so it walks, then either set it aggressive or not. I don't want any type of prompt. no button press, no sphere.

I was getting close with this basic code:

CODE

{$CLEO .cs}

//-------------MAIN---------------
thread 'SURVIVOR'
0A95: enable_thread_saving

:Thread
wait 0
Model.Load(#FBI)
if
Model.Available(#FBI)
jf @Thread
009A: 0@ = create_actor_pedtype 4 model #FBI at X Y Z
05E2: AS_actor 0@ kill_actor $PLAYER_ACTOR
0A93: end_custom_thread


I left out the go to opcode. it works when i spawn near the ped, but if i approach the ped from a distance it's all bright like in dyom and standing crooked. can you see what i'm going for? just spawn ped, aggressive or no, and walk to a place. i'd like it to walk but if it see's the player it attacks. no weapons, no prompts just this code to spawn a ped. also i'd like to be able to repeat it for many many peds. think of it as me trying to get peds into my custom map. And again, thanks a million zaz.

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#107

Posted 31 August 2010 - 08:13 AM Edited by ZAZ, 31 August 2010 - 08:15 AM.

QUOTE (kal-el5676 @ Aug 31 2010, 04:24)
Thanks for responding zaz, however maybe i wasn't clear enough.

I think so too and posting a script attempt is better than smilies
QUOTE
This code i need will be for a cleaned map so there won't be a grove street. I want to place a ped either have it walk around randomly or use the "go to" opcode so it walks, then either set it aggressive or not. I don't want any type of prompt. no button press, no sphere.

It's the wrong approach to do it without check (prompt)
A valid game action is only playing in that area where the player and the cam is available
For a solid coding you have to check if the player is the action area.
Create your stuff only when you need and dismiss it when it's not needed, if player is far away, if the action ends,
if player is wasted or busted, remove the reference of the item handles.

Build the script structure in 2 Loops
first loop before the event
second loop after the event

start the script in a default state loop which checks any condition to start the action
find the proper condition for your plan
opcode 00FF: is very usefull, it allows to increase the radius for the check
it can also display a red sphere by changing sphere-parameter
00FF: actor $PLAYER_ACTOR 1<---change it to 0 to disable the red sphere

-Script head
-1.Loop-Adress
-wait code
-IF player_defined-check
-Conditional Check
-Event
-2.Loop-Adress
-wait code
-IF player_defined-check
-Conditional Check
-Normal jump instruction to 1.LoopAdress


My posted script works also on a cleaned map it just needs to change the coords
the "walk to" opcode instead the scm-path definition is also possible
CODE
05D3: AS_actor 1@ goto_point -1268.4003 -384.2416 17.1894 mode 4 999999 ms // versionA

have tested on a TC
have also tested the scm-path definition on TC
just 4 points at this time
CODE
0615: define_action_sequences 13@
05D6: clear_scmpath
05D7: add_point_to_scmpath  -1289.3685 -386.396 17.1894
05D7: add_point_to_scmpath  -1295.3685 -386.396 17.1894
05D7: add_point_to_scmpath  -1295.3685 -380.396 17.1894
05D7: add_point_to_scmpath  -1310.3685 -380.396 17.1894  


05D8: AS_assign_scmpath to_actor -1 flags  4  3  
0616: define_action_sequences_end 13@
0618: assign_actor 1@ to_action_sequences 13@
061B: remove_references_to_AS_pack 13@


QUOTE
I was getting close with this basic code:

CODE

{$CLEO .cs}

//-------------MAIN---------------
thread 'SURVIVOR'
0A95: enable_thread_saving

:Thread
wait 0
Model.Load(#FBI)
if
Model.Available(#FBI)
jf @Thread
009A: 0@ = create_actor_pedtype 4 model #FBI at X Y Z
05E2: AS_actor 0@ kill_actor $PLAYER_ACTOR
0A93: end_custom_thread

I left out the go to opcode. it works when i spawn near the ped, but if i approach the ped from a distance it's all bright like in dyom and standing crooked. can you see what i'm going for? just spawn ped, aggressive or no, and walk to a place. i'd like it to walk but if it see's the player it attacks. no weapons, no prompts just this code to spawn a ped. also i'd like to be able to repeat it for many many peds. think of it as me trying to get peds into my custom map. And again, thanks a million zaz.



As I said above:
For a solid coding you have to check if the player is the action area.
Create your stuff only when you need and dismiss it when it's not needed, if player is far away, if the action ends,
if player is wasted or busted, remove the reference of the item handles.
Build the script structure in 2 Loops
first loop before the event
second loop after the event

Then the script can repeating


As next you have to find the proper method for your plan if you wanna spawn a lot of actors
-spawning more actors in the script at predefined coords
-spawning more actors in the script in relation to player position
-let the same cs-script running in multiple instances
-writing a missionscript by creating a cleo.cm file to have more local variables and can do more

Then you should decide what the actors should do if they reach their destination
therefore you must check if the he reached the point

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#108

Posted 03 September 2010 - 03:11 PM

Thank you so much zaz. just a few more questions. How do i get the actor to act aggressive toward the player? Also can the actor be summoned while in a vehicle (aircraft also) as well as on foot? And the actor runs to these points. Can we make him walk?

Your code modified to my mod so far:

CODE
{$CLEO .cs}
:ActorWalk_1
03A4: name_thread 'MODL'

:ActorWalk_2
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ActorWalk_2
00D6: if  0
00FF:   actor $PLAYER_ACTOR  0 (in-sphere)near_point_on_foot 0.0 0.0 0.0 radius  10.0  10.0  10.0
004D: jump_if_false @ActorWalk_2

0247: request_model #FAM3

:Load_Model_Check
0001: wait  0 ms
00D6: if  0
0248:   model #FAM3 available
004D: jump_if_false @Load_Model_Check

009A: 1@ = create_actor_pedtype 22 model #FAM3 at 0.0 0.0 0.0
0173: set_actor 1@ z_angle_to 0.0
0249: release_model #FAM3

0615: define_action_sequences 13@
05D6: clear_scmpath
05D7: add_point_to_scmpath  471.5384 734.5942 1.714
05D7: add_point_to_scmpath  -897.4615 -711.4058 1.7277
05D7: add_point_to_scmpath  889.5385 -1379.4058 1.7331
05D7: add_point_to_scmpath  -92.0696 -493.3648 1.7212  

05D7: add_point_to_scmpath  840.9304 704.6352 1.714
05D7: add_point_to_scmpath  -719.0696 665.6352 1.713
05D7: add_point_to_scmpath  -719.0696 -1027.3647 2.1997
05D7: add_point_to_scmpath  916.9304 -969.3647 1.7204
05D8: AS_assign_scmpath to_actor -1 flags  7  3  
0616: define_action_sequences_end 13@
0618: assign_actor 1@ to_action_sequences 13@
061B: remove_references_to_AS_pack 13@



:ActorWalk_3
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ActorWalk_3
if  or
 Actor.Dead(1@)
80FF:   NOT   actor $PLAYER_ACTOR  0 ()near_point_on_foot 0.0 0.0 0.0 radius  100.0  100.0  2.0
004D: jump_if_false @ActorWalk_3
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
0002: jump @ActorWalk_2

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#109

Posted 04 September 2010 - 01:38 PM

QUOTE (kal-el5676 @ Sep 3 2010, 15:11)
Thank you so much zaz. just a few more questions. How do i get the actor to act aggressive toward the player? Also can the actor be summoned while in a vehicle (aircraft also) as well as on foot? And the actor runs to these points. Can we make him walk?

The usual opcode to act the actor aggressive toward the player is 05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
You have it in your first script.
The actor will then be assigned to an exe coded routine.
He do nothing if the distance is to big, he goes in cover, follows player
and exit also the vehicle.

The opcode 05D3: AS_actor 1@ goto_point let the actor also exit the vehicle

Try the script below:
Actor and car will be spawned in Grovestreet
Actor enters car and drive to a point, ca. 30 meters beside the spawn location
you can brake the drive with keypress Backspace

play around with the codes
CODE
//05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
//0633: AS_actor 1@ exit_vehicle
05D3: AS_actor 1@ goto_point 2500.7986 -1672.2833 13.3518 mode 4 999999 ms // versionA

deactivate the goto_point code and activate another code

CODE
{$CLEO .cs}
:Action
03A4: name_thread 'AKT'

:StartLoop_1
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @StartLoop_1
00D6: if  0
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point 2498.84 -1666.013  13.4 radius  3.0  3.0  3.0  
004D: jump_if_false @StartLoop_1
0247: request_model #COLT45
0247: request_model #FAM1
0247: request_model #BULLET

:LoadModel_1
0001: wait  0 ms
00D6: if  2
0248:   model #COLT45 available
0248:   model #FAM1 available
0248:   model #BULLET available
004D: jump_if_false @LoadModel_1


009A: 1@ = create_actor  24 #fam1 at  2472.02  -1668.41  13.4
0173: set_actor 1@ z_angle_to  270.0

01B2: give_actor 1@ weapon  22 ammo  99999  // Load the weapon model before using this

00A5: 2@ = create_car #BULLET at  2472.4994  -1659.546  13.4
0175: set_car 2@ z_angle_to  205.0

0249: release_model #fam1
0249: release_model #BULLET
0249: release_model #COLT45

05CB: AS_actor 1@ enter_car_as_driver 2@ delay  10000

:Loop_2
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CleanUp1
00D6: if  1
8119:   NOT   car 2@ wrecked
8118:   NOT   actor 1@ dead
004D: jump_if_false @CleanUp1
00D6: if  0
00DB:   actor 1@ in_car 2@
004D: jump_if_false @Loop_2

00A7: car 2@ drive_to  2502.112 -1664.745  13.4
00AD: set_car 2@ max_speed_to  20.0

:Loop_3
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CleanUp1
00D6: if  1
8119:   NOT   car 2@ wrecked
8118:   NOT   actor 1@ dead
004D: jump_if_false @CleanUp1
if  or
0AB0:   key_pressed 8// key = Backspace
01AF:   car 2@  0 ()near_point  2502.112 -1664.745  13.4 radius  2.0  2.0  2.0
004D: jump_if_false @Loop_3

//05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
//0633: AS_actor 1@ exit_vehicle
05D3: AS_actor 1@ goto_point 2500.7986 -1672.2833 13.3518 mode 4 999999 ms // versionA

:Loop_4
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CleanUp1
00D6: if  1
8119:   NOT   car 2@ wrecked
8118:   NOT   actor 1@ dead
004D: jump_if_false @CleanUp1
00D6: if  0
80DB:   NOT   actor 1@ in_car 2@
004D: jump_if_false @Loop_4

//05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR

:Loop_5
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CleanUp1
00D6: if  21
0119:   car 2@ wrecked
0118:   actor 1@ dead
004D: jump_if_false @Loop_5

:CleanUp1
01C2: remove_references_to_actor 1@  // Like turning an actor into a random pedestrian
01C3: remove_references_to_car 2@  // Like turning a car into any random car
0002: jump @StartLoop_1

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#110

Posted 05 September 2010 - 04:12 PM

I appreciate the extra info zaz! However, I'm still having a few problems. Basically i'm trying to use this as a spawn script for my Dino's in the new JP mod. So i don't really want them driving cars or shooting guns. wink.gif So far i have almost got it worked out but... when I'm driving/walking around the map, I'd like them to spawn from a far enough distance that you can't really see them just appear. This works on foot when i increase the radius but not in a car. Would it also be possible to have them spawn as you fly overhead? The aggression is working and so is the scm path although they do run sometimes still. And also lets say that cj is within the ped spawning radius, when i get in and out of a car they spawn over and over which isn't so bad if your far enough away. Just didn't know if you had an easy solution. I really appreciate your help and patients. For some reason this seems to be a tough concept for me to grasp this whole coding thing.

biggrin.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#111

Posted 05 September 2010 - 08:24 PM Edited by ZAZ, 05 September 2010 - 08:27 PM.

QUOTE (kal-el5676 @ Sep 5 2010, 16:12)
I appreciate the extra info zaz! However, I'm still having a few problems. Basically i'm trying to use this as a spawn script for my Dino's in the new JP mod. So i don't really want them driving cars or shooting guns. wink.gif So far i have almost got it worked out but...  when I'm driving/walking around the map, I'd like them to spawn from a far enough distance that you can't really see them just appear. This works on foot when i increase the radius but not in a car. Would it also be possible to have them spawn as you fly overhead? The aggression is working and so is the scm path although they do run sometimes still. And also lets say that cj is within the ped spawning radius, when i get in and out of a car they spawn over and over which isn't so bad if your far enough away. Just didn't know if you had an easy solution. I really appreciate your help and patients. For some reason this seems to be a tough concept for me to grasp this whole coding thing.

biggrin.gif

Dinos in JP, how interessting.
Well yes, it's an old problem, how to spawn the actor relativ to player but don't show the spawning, especially where.
Btw. i don't know what you mean with "spawn as you fly overhead?"

The first method would be to spawn at fixed defined coords and check if player is near in that area.
But check additional if player is near the spawn location to prevent the spawn because it can be observed.
That will be a lot of work depending to the plan how many spawn location should be done.
And at the end it will happen that you see it though.

Another method is to spawn relative with opcode 04C4: with bigger distance and maybe a bit in the air
I tested a zombiemod which used that method. It was not bad but had the disadvantage that the actor can stuck in buildings or is captured in a garden

I worked also with zombiescripts and if you know my Cleo_Zombie_Alarm, I let them crawling out of the ground
I think the best way to get the spawnlocation is reading the position of a random actor or random car because they are always on the save traffic paths but this requires to have paths and traffic.

For my unreleased zomiescript i used an extended method of reading coords of actor and car in traffic.
I made a stripped version as example:
The script reads the coords behind the camera view field to find there a random ped and spawn the actor 0.5 units behind him.
If the random ped drives a vehicle it spawns the actor 2.5 units beside the ped.

If player is driving it will be more difficult.
In that case the script catches a random car in a field with minimum distance of 70.0 units infront of player
Try to increase the Y-offset of 70.0 but i think it's the optimum and 100.0 should be the maximum
If player drives slow it will be good
If player drives fast it can be seen perhaps
If player drives very fast there is no chance and it also makes no sense


Try the sript below, I assume that you have the required paths and traffic.
Shure the actor isn't a dino but the example with the actor which kills the player shows the effect of the spawning
and the command to kill player give it more dynamic alien.gif
Set the marker mode to 2 because with marker above actor you will see him in any case if you drive fast
CODE
{$CLEO .cs}
:Spawn_by_random_actor_or_car
thread 'SPAWNAC'

:Spawn_1
0001: wait 0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @Spawn_1
077E: get_active_interior_to 29@
if  and//-----check several situations when the spawning don't makes sense
0039:   29@ ==  0  // integer values
8965:  not actor $PLAYER_ACTOR swimming
84A7:   not actor $PLAYER_ACTOR driving_boat
89AE:   not actor $PLAYER_ACTOR driving_train
004D: jump_if_false @Spawn_1  
0819: 30@ = actor $PLAYER_ACTOR distance_from_ground
if
0023:   20.0 > 30@
004D: jump_if_false @Spawn_1
0006: 1@ =  -1  // integer values
if
00DF: actor $PLAYER_ACTOR driving
004D: jump_if_false @Spawn_3
0050: gosub @Spawn_searchCarsub_1//leads the readingprocess to a subscript
//the readingprocess continues here with reading as soon as the return of the subscript is readed
if
8039:   NOT   1@ ==  -1  // checks if a radondom actor was found to get his coords
004D: jump_if_false @Spawn_1
0006: 1@ =  -1  // integer values
0002: jump @Spawn_Actor1

:Spawn_3
0050: gosub @Spawn_searchPedsub_1//leads the readingprocess to a subscript
//the readingprocess continues here with reading as soon as the return of the subscript is readed
if
8039:   NOT   1@ ==  -1  // checks if a radondom actor was found to get his coords
004D: jump_if_false @Spawn_1
01C2: remove_references_to_actor 1@
0006: 1@ =  -1  // integer values
0002: jump @Spawn_Actor1



:Spawn_Actor1
0247: request_model #WMOICE
0247: request_model #AK47

:Spawn_Actor3
0001: wait  0 ms
00D6: if  and
0248:   model #WMOICE available
0248:   model #AK47 available
004D: jump_if_false @Spawn_Actor3

009A: 2@ = create_actor  24 #WMOICE at  25@ 26@ 27@
0173: set_actor 2@ z_angle_to  0.0
01B2: give_actor 2@ weapon  30 ammo  99999  // Load the weapon model before using this
02E2: set_actor 2@ weapon_accuracy_to  100//decrease this value if you don't want to be killed
0223: set_actor 2@ health_to  1000
0946: set_actor 2@ actions_uninterupted_by_weapon_fire 1
060B: set_actor 2@ decision_maker_to 32
0187: 5@ = create_marker_above_actor 2@
018B: set_marker 5@ radar_mode 3//set marker to mode 2 to show it only on radar
05E2: AS_actor 2@ kill_actor $PLAYER_ACTOR
0249: release_model #WMOICE


:Spawn_action_Loop
0001: wait 0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @Spawn_Cleanup
if and
8118:   NOT   actor 2@ dead
0104:   actor $PLAYER_ACTOR near_actor 2@ radius  80.0  80.0  10.0 sphere  0
004D: jump_if_false @Spawn_Cleanup
0002: jump @Spawn_action_Loop

:Spawn_Cleanup
0164: disable_marker 5@
01C2: remove_references_to_actor 2@

:Spawn_Restart// an extra loop to give a delay after Player respawn
0001: wait 0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @Spawn_Restart
wait 2000
0002: jump @Spawn_1





:Spawn_searchCarsub_1//subscript must end with 0051: return
04C4: create_coordinate 14@ 15@ 16@ from_actor $PLAYER_ACTOR offset -100.0  70.0  0.0// increase the y-offset
04C4: create_coordinate 18@ 19@ 30@ from_actor $PLAYER_ACTOR offset  100.0  150.0  0.0
053E: 0@ = get_random_car_with_model -1 in_rectangle_cornerA 14@ 15@ cornerB 18@ 19@
0001: wait  50 ms
if
8039:   NOT   0@ ==  -1  // integer values
004D: jump_if_false @Spawn_searchCarsub_3
0001: wait  50 ms
0407: create_coordinate 25@ 26@ 27@ from_car 0@ with_offset 0.0 0.0 1.0
0001: wait  50 ms
00A6: destroy_car 0@
0001: wait  250 ms
0006: 1@ =  1  // integer values

:Spawn_searchCarsub_3
0051: return





:Spawn_searchPedsub_1//subscript must end with 0051: return
if
80E1:   not player 0 pressed_key 19
004D: jump_if_false @Spawn_searchPedsub_5
04C4: create_coordinate 14@ 15@ 16@ from_actor $PLAYER_ACTOR offset  0.0  0.0 0.0
068D: get_camera_position_to 18@ 19@ 30@
0087: 21@ = 18@  // floating-point values only
0087: 22@ = 19@  // floating-point values only
0087: 30@ = 18@  // floating-point values only
0087: 31@ = 19@  // floating-point values only
0063: 30@ -= 14@  // floating-point values
0063: 31@ -= 15@  // floating-point values
0013: 30@ *=  -2.0  // floating-point values
0013: 31@ *=  -2.0  // floating-point values
005B: 18@ += 30@  // floating-point values
005B: 19@ += 31@  // floating-point values
0063: 18@ -= 14@  // floating-point values
0063: 19@ -= 15@  // floating-point values
0013: 18@ *=  -15.0  // floating-point values
0013: 19@ *=  -15.0  // floating-point values
005B: 21@ += 18@  // floating-point values
005B: 22@ += 19@  // floating-point values
08E5: get_actor_in_sphere 21@ 22@ 16@ radius 31.5 handle_as 1@
0001: wait  50 ms
if
8039:   NOT   1@ ==  -1  // integer values
004D: jump_if_false @Spawn_searchPedsub_5
if
00DF: actor 1@ driving
004D: jump_if_false @Spawn_searchPedsub_3
04C4: store_coords_to 25@ 26@ 27@ from_actor 1@ with_offset -2.5 0.0 0.5
0002: jump @Spawn_searchPedsub_5

:Spawn_searchPedsub_3
04C4: store_coords_to 25@ 26@ 27@ from_actor 1@ with_offset -0.5 0.0 0.0

:Spawn_searchPedsub_5
0051: return

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#112

Posted 12 September 2010 - 03:43 PM Edited by kal-el5676, 12 September 2010 - 03:46 PM.

Thats an awesome code zaz! It works well, unfortunately in my mod i have the blank path nodes installed. I would try to add new ped paths, but all the links to ashcrafts path editor are dead. Perhaps your first suggestion? I don't have many buildings and no gardens so that might work.

Spawn as you fly overhead, meaning if your in a plane flying low enough that the ped will spawn.

BTW, did you ever release a version of your zombie alarm with no fire and perhaps a zombie attack?

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#113

Posted 12 September 2010 - 04:40 PM

QUOTE (kal-el5676 @ Sep 12 2010, 15:43)
Thats an awesome code zaz! It works well, unfortunately in my mod i have the blank path nodes installed. I would try to add new ped paths, but all the links to ashcrafts path editor are dead.

download APE 1.1

QUOTE
Perhaps your first suggestion? I don't have many buildings and no gardens so that might work.

You mean my second suggestion, let it rain dinos in relation to player position

QUOTE
Spawn as you fly overhead, meaning if your in a plane flying low enough that the ped will spawn.

plane is fast, then my first suggestion would be better
spawn at fixed defined coords and check if player is near in that area, radius of maybe 300.0 or max. 500.0

QUOTE
BTW, did you ever release a version of your zombie alarm with no fire and perhaps a zombie attack?

No, it's to complicated

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#114

Posted 12 September 2010 - 05:04 PM Edited by kal-el5676, 12 September 2010 - 05:13 PM.

QUOTE (ZAZ @ Sep 12 2010, 16:40)

QUOTE
Perhaps your first suggestion? I don't have many buildings and no gardens so that might work.

You mean my second suggestion, let it rain dinos in relation to player position

QUOTE
Spawn as you fly overhead, meaning if your in a plane flying low enough that the ped will spawn.

plane is fast, then my first suggestion would be better
spawn at fixed defined coords and check if player is near in that area, radius of maybe 300.0 or max. 500.0

QUOTE
BTW, did you ever release a version of your zombie alarm with no fire and perhaps a zombie attack?

No, it's to complicated

Would there perhaps be a way to write 2 separate scripts 1 for letting it "rain dino's" tounge.gif and one for spawning in the radius? That sounds best.

And yeah, too bad about the zombie alarm, however it is amazing work my friend. wink.gif

And also i suppose thanks to your mirrored download, your last code example would work beautifully as well if i were to getmy paths working correctly.

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#115

Posted 12 September 2010 - 05:56 PM

QUOTE (kal-el5676 @ Sep 12 2010, 17:04)
QUOTE (ZAZ @ Sep 12 2010, 16:40)

QUOTE
Perhaps your first suggestion? I don't have many buildings and no gardens so that might work.

You mean my second suggestion, let it rain dinos in relation to player position

QUOTE
Spawn as you fly overhead, meaning if your in a plane flying low enough that the ped will spawn.

plane is fast, then my first suggestion would be better
spawn at fixed defined coords and check if player is near in that area, radius of maybe 300.0 or max. 500.0

QUOTE
BTW, did you ever release a version of your zombie alarm with no fire and perhaps a zombie attack?

No, it's to complicated

Would there perhaps be a way to write 2 separate scripts 1 for letting it "rain dino's" tounge.gif and one for spawning in the radius? That sounds best.

And yeah, too bad about the zombie alarm, however it is amazing work my friend. wink.gif

And also i suppose thanks to your mirrored download, your last code example would work beautifully as well if i were to getmy paths working correctly.

Fine.
Btw. did you made or convert the dino modells? I still have ripped files of the KingKong game.

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#116

Posted 12 September 2010 - 06:08 PM

No i did not make them. they are from the jurassic park operation genesis game.

Sorry, but did you already state the raining dinos code in an example?

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#117

Posted 13 September 2010 - 11:57 AM Edited by ZAZ, 15 September 2010 - 07:58 AM.

QUOTE (kal-el5676 @ Sep 12 2010, 18:08)
No i did not make them. they are from the jurassic park operation genesis game.

Sorry, but did you already state the raining dinos code in an example?

Haha, a script request biggrin.gif
Writing a script with one actor is easy but with more actors is advanced.
I have to use arrays and 10 actor with marker are maximum in a cs file.
More actors are possible without markers.
To understand the methods you need to dive into the themes Arrays and Math coding

The Dinopark script below spawns the actors in a height of 50.0 in relation to player position.
They are first unvisible and immun to prevent their dead.
The timercheck for 33@ gives acces to make them visible and unimmun
So it have allways a delay till they appear.
They get then the command to walk along scm paths.
If an actor dies, he will be refreshed, same by other condition like if he is not near 180.0
After refreshing it needs again a time check till he appears.
So if you kill more actors in a row the timer will be reseted and you have to wait till the last actor is refreshed inclusiv the timechck-delay till the refreshed actor appear.
You can observe this clearly when you drive over the map and the actors disappear which are to far away
After a while they appear again in a group

Using a teleporter causes a bug and all actor stucking inside each other in the air.

CODE
{$CLEO .cs}
:DinoPark
03A4: name_thread 'DINOPK'
wait 2000
0006: 30@ =  0  // Array index

:DINOPK_2
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @DINOPK_2
//if
//0AB0:   key_pressed 57//----------------key 9
//004D: jump_if_false @DINOPK_2
077E: get_active_interior_to 31@
if  and
8965:  not actor $PLAYER_ACTOR swimming
84A7:   not actor $PLAYER_ACTOR driving_boat
89AE:   not actor $PLAYER_ACTOR driving_train  
0039:   31@ ==  0  // integer values
004D: jump_if_false @DINOPK_2
0819: 27@ = actor $PLAYER_ACTOR distance_from_ground
0001: wait 0 ms
00D6: if
0023:   20.0 > 27@
004D: jump_if_false @DINOPK_2

0247: request_model #WMOICE

:DINOPK_3
0001: wait  0 ms
if   and
0248:   model #WMOICE available
004D: jump_if_false @DINOPK_3
0007: 31@ = 0.0
wait 2000

:DINOPK_4
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @DINOPK_4
if
001B:    10 > 30@  // integer values
004D: jump_if_false @DINOPK_10
02F6: 28@ = cosine 31@  // sinus swapped with cosine
0013: 28@ *= 120.0  // floating-point values
02F7: 29@ = sinus 31@ // cosine swapped with sinus
0013: 29@ *= 120.0  // floating-point values
000B: 31@ += 36.0
04C4: create_coordinate 24@ 25@ 26@ from_actor $PLAYER_ACTOR offset 28@  29@  50.2
009A: 0@(30@,12i) = create_actor_pedtype 24 model #WMOICE at 24@ 25@ 26@
04D8: set_actor 0@(30@,12i) drowns_in_water 1
0946: set_actor 0@(30@,12i) actions_uninterupted_by_weapon_fire 1
060B: set_actor 0@(30@,12i) decision_maker_to 32
0489: set_actor 0@(30@,12i) muted 1
03FE: set_actor 0@(30@,12i) money 0
0337: set_actor 0@(30@,12i) visibility 0
02AB: set_actor 0@(30@,12i) immunities BP 1 FP 1 EP 1 CP 1 MP 1
0187: 10@(30@,12i) = create_marker_above_actor 0@(30@,12i)
018B: set_marker 10@(30@,12i) radar_mode 0//set marker to mode 2 to show it only on radar
000A: 30@ +=  1  // Array index
0002: jump @DINOPK_4


:DINOPK_10
0006: 30@ =  0  // Array index
0006: 33@ =  0  // reset timer

:DINOPK_11
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @DINOPK_40
077E: get_active_interior_to 31@
if  and
89AE:   not actor $PLAYER_ACTOR driving_train  
0039:   31@ ==  0  // integer values
004D: jump_if_false @DINOPK_40
0819: 27@ = actor $PLAYER_ACTOR distance_from_ground
0001: wait 0 ms
00D6: if
0023:   50.0 > 27@
004D: jump_if_false @DINOPK_40
if  and
33@ > 7000
10000 > 33@
004D: jump_if_false @DINOPK_12
0002: jump @DINOPK_30

:DINOPK_12
//if
//8AB0:   not key_pressed 57//----------------key 9
//004D: jump_if_false @DINOPK_40
if
001B:    10 > 30@  // integer values
004D: jump_if_false @DINOPK_19
if
8039:   not 0@(30@,12i) ==  -1  // integer values
004D: jump_if_false @DINOPK_17
if or
0118:  actor 0@(30@,12i) dead
8104:   not actor $PLAYER_ACTOR near_actor 0@(30@,12i) radius  180.0  180.0  100.0 sphere  0
004D: jump_if_false @DINOPK_17
0164: disable_marker 10@(30@,12i)
01C2: remove_references_to_actor 0@(30@,12i)
if  or
04A7:   actor $PLAYER_ACTOR driving_boat
0965:   actor $PLAYER_ACTOR swimming
004D: jump_if_false @DINOPK_13
0006: 0@(30@,12i) = -1

:DINOPK_13
if
31@ > 350.0
004D: jump_if_false @DINOPK_15
0007: 31@ = 0.0

:DINOPK_15
02F6: 28@ = cosine 31@  // sinus swapped with cosine
0013: 28@ *= 120.0  // floating-point values
02F7: 29@ = sinus 31@ // cosine swapped with sinus
0013: 29@ *= 120.0  // floating-point values
000B: 31@ += 36.0
04C4: create_coordinate 24@ 25@ 26@ from_actor $PLAYER_ACTOR offset 28@  29@  50.2
009A: 0@(30@,12i) = create_actor_pedtype 24 model #WMOICE at 24@ 25@ 26@
04D8: set_actor 0@(30@,12i) drowns_in_water 1
0946: set_actor 0@(30@,12i) actions_uninterupted_by_weapon_fire 1
060B: set_actor 0@(30@,12i) decision_maker_to 32
0489: set_actor 0@(30@,12i) muted 1
03FE: set_actor 0@(30@,12i) money 0
0337: set_actor 0@(30@,12i) visibility 0
02AB: set_actor 0@(30@,12i) immunities BP 1 FP 1 EP 1 CP 1 MP 1
0187: 10@(30@,12i) = create_marker_above_actor 0@(30@,12i)
018B: set_marker 10@(30@,12i) radar_mode 0//set marker to mode 2 to show it only on radar
000A: 30@ +=  1  // Array index
0006: 33@ =  0  // reset timer
0002: jump @DINOPK_11


:DINOPK_17
000A: 30@ +=  1  // Array index
0002: jump @DINOPK_11

:DINOPK_19
0006: 30@ =  0  // Array index
0002: jump @DINOPK_11




:DINOPK_30
0006: 30@ =  0  // Array index

:DINOPK_35
wait 0
if
001B:    10 > 30@  // integer values
004D: jump_if_false @DINOPK_39
if
8039:   not 0@(30@,12i) ==  -1  // integer values
004D: jump_if_false @DINOPK_37
if
8118:  not actor 0@(30@,12i) dead
004D: jump_if_false @DINOPK_37
0337: set_actor 0@(30@,12i) visibility 1
02AB: set_actor 0@(30@,12i) immunities BP 0 FP 0 EP 0 CP 0 MP 0

0208: 27@ = random_float_in_ranges -50.2 50.2
04C4: create_coordinate 24@ 25@ 26@ from_actor 0@(30@,12i) offset 20.0  27@  0.0
0208: 27@ = random_float_in_ranges -50.2 50.2
04C4: create_coordinate 21@ 22@ 23@ from_actor 0@(30@,12i) offset -20.0  27@  0.0

05D6: clear_scmpath
05D7: add_point_to_scmpath  24@ 25@ 26@
05D7: add_point_to_scmpath  21@ 22@ 23@
05D8: AS_assign_scmpath to_actor 0@(30@,12i) flags  4  2  
018B: set_marker 10@(30@,12i) radar_mode 2//set marker to mode 2 to show it only on radar

:DINOPK_37
000A: 30@ +=  1  // Array index
0002: jump @DINOPK_35


:DINOPK_39
0006: 28@ =  0  // counter for dead actors
0006: 30@ =  0  // Array index
0006: 33@ =  11000
0002: jump @DINOPK_11





:DINOPK_40
0006: 30@ =  0  // Array index

:DINOPK_45
wait 0
if
001B:    10 > 30@  // integer values
004D: jump_if_false @DINOPK_50
if
8039:   not 0@(30@,12i) ==  -1  // integer values
004D: jump_if_false @DINOPK_47
0164: disable_marker 10@(30@,12i)
01C2: remove_references_to_actor 0@(30@,12i) // Like turning an actor into a random pedestrian

:DINOPK_47
000A: 30@ +=  1  // Array index
0002: jump @DINOPK_45

:DINOPK_50
0006: 28@ =  0  // counter for dead actors
0006: 30@ =  0  // Array index
0249: release_model #WMOICE
0001: wait  1000 ms
0002: jump @DINOPK_2


Bennington
  • Bennington

    With a gun in your Face...

  • Members
  • Joined: 24 May 2010
  • Germany

#118

Posted 18 September 2010 - 02:06 PM Edited by Bennington, 19 September 2010 - 09:42 AM.

Hey ZAZ, thatīs a great tutorial!
Thereīs one little thing I need help with:
I want to teleport the player out of an interior with opcode 04BB: select_interior 0
At first it failed, and I got into the Black Hell.
Now I found opcode 04FA: reset_interior 0 colors, and it works, but thereīs still a problem: the radar stays empty.
057E: set_radar_grey 0 didnīt help, and, probably, there are more things I forgot.
Can you show me a code how a such a teleport would proceed without errors?
Thanks

EDIT: I found out myself now, anyway thanks!

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#119

Posted 20 September 2010 - 04:51 PM

QUOTE (Bennington @ Sep 18 2010, 14:06)
Hey ZAZ, thatīs a great tutorial!
Thereīs one little thing I need help with:
I want to teleport the player out of an interior with opcode 04BB: select_interior 0
At first it failed, and I got into the Black Hell.
Now I found opcode 04FA: reset_interior 0 colors, and it works, but thereīs still a problem: the radar stays empty.
057E: set_radar_grey 0  didnīt help, and, probably, there are more things I forgot.
Can you show me a code how a such a teleport would proceed without errors?
Thanks

EDIT: I found out myself now, anyway thanks!


057E: set_radar_grey 0 is right but look, for the interior color is another opcode
CODE
__from outside into interior:
select_interior 3
04F9: set_interior 1 color_to 0
057E: set_radar_grey 1

__from interior to outside:
select_interior 0
04FA: reset_interior 0 colors
057E: set_radar_grey 0


I believe, we can get rid of the radar opcode
work without opcode 057E: also by entering interiors
try the script below
press 0 to tele into PoliceDept., press again 0 to tele back, always outside
CODE
{$CLEO .cs}
03A4: name_thread 'INTEL'

:INTEL_1
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @INTEL_1
00D6: if  0
0AB0:   key_pressed 48//--------------- key 0
004D: jump_if_false @INTEL_1
00A0: store actor $PLAYER_ACTOR position to 1@ 2@ 3@
0172: 4@ = actor $PLAYER_ACTOR z_angle
016A: fade 0 time 1000
0001: wait 1000 ms
04E4: unknown_refresh_game_renderer_at  230.6252 76.141
03CB: set_camera  230.6252 76.141 1005.03
00A1: put_actor $PLAYER_ACTOR at 230.6252 76.141 1005.03
0860: link_actor $PLAYER_ACTOR to_interior 6
04BB: select_interior 6
0001: wait 500 ms
016A: fade 1 time 1000



:INTEL_2
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @INTEL_2
00D6: if  0
0AB0:   key_pressed 48//--------------- key 0
004D: jump_if_false @INTEL_2

016A: fade 0 time 1000
0001: wait 1000 ms
select_interior 0
04FA: reset_interior_colors  0
04E4: unknown_refresh_game_renderer_at  1@  2@
03CB: set_camera  1@  2@  3@
0860: link_actor $PLAYER_ACTOR to_interior  0
00A1: put_actor $PLAYER_ACTOR at  1@  2@  3@
0173: set_actor $PLAYER_ACTOR z_angle_to  4@
0001: wait 500 ms
016A: fade 1 time 1000
jump @INTEL_1

Bennington
  • Bennington

    With a gun in your Face...

  • Members
  • Joined: 24 May 2010
  • Germany

#120

Posted 23 September 2010 - 08:21 PM

Thanks, ZAZ, thatīs what I found out wink.gif




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users