Quantcast

Jump to content

» «
Photo

[GTA SA] ~ CLEO Script Tutorial ~

624 replies to this topic
ZAZ
  • ZAZ

    Kernlochbohrer

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

#571

Posted 17 March 2013 - 08:27 PM

QUOTE (bondlover1313 @ Sunday, Mar 17 2013, 15:53)
Well jeez thanks for putting it so plainly, lol. Yeah your right I am a little out of my league here, but I still wanted to try and achieve this. I did what you said and it sort of looked it worked. You said the code wasn't good enough to realize my plan, and I totally agree, but do you have any ideas or advice on how to improve it? Thanks


Thanks, Bests
Bondlover1313 smile.gif

Well, consider that this is a tutorial to write CLEO scripts, so i assume that you wanna do your Kitt-mod as cleoscript.
In that order study the tutorial careful from beginning, forget your Kitt-mod plan for the next time and learn coding by writing small and simple scripts.
You should understand the content of these first chapters:
Chapterlesson
First Steps in Cleo scripting
with Sannybuilder
- Start for newbies
The Editor- The main functions
- Option: different view of the decompiled code
- Classes and Keywords
Data types- locals @, globals $, "strings '
and hash # to enter modelname
Scripting/Writing a Thread

coding in praxis,
a must-read for newbies
- Using conditional checks
- The IF - Variation
- Script structure simple
- Script structure extended
- Script exemble: Slowmotion

- Spawn a 3D model
- Placing cars by using parked_car_generator
Special Particularities in Cleo- enable_thread_saving
- special cleo global var

- Script Exemble by using Special Global Cleo Variable/ Store a car at any place
Test the example scripts, modify them a little bit, expand them a little bit,
important is, that you gain practice
At the end you should be able to to spawn the cars in a propper way...
...then add the attach code



bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#572

Posted 17 March 2013 - 10:43 PM

QUOTE (ZAZ @ Sunday, Mar 17 2013, 20:27)
QUOTE (bondlover1313 @ Sunday, Mar 17 2013, 15:53)
Well jeez thanks for putting it so plainly, lol. Yeah your right I am a little out of my league here, but I still wanted to try and achieve this. I did what you said and it sort of looked it worked. You said the code wasn't good enough to realize my plan, and I totally agree, but do you have any ideas or advice on how to improve it? Thanks


Thanks, Bests
Bondlover1313 smile.gif

Well, consider that this is a tutorial to write CLEO scripts, so i assume that you wanna do your Kitt-mod as cleoscript.
In that order study the tutorial careful from beginning, forget your Kitt-mod plan for the next time and learn coding by writing small and simple scripts.
You should understand the content of these first chapters:
Chapterlesson
First Steps in Cleo scripting
with Sannybuilder
- Start for newbies
The Editor- The main functions
- Option: different view of the decompiled code
- Classes and Keywords
Data types- locals @, globals $, "strings '
and hash # to enter modelname
Scripting/Writing a Thread

coding in praxis,
a must-read for newbies
- Using conditional checks
- The IF - Variation
- Script structure simple
- Script structure extended
- Script exemble: Slowmotion

- Spawn a 3D model
- Placing cars by using parked_car_generator
Special Particularities in Cleo- enable_thread_saving
- special cleo global var

- Script Exemble by using Special Global Cleo Variable/ Store a car at any place
Test the example scripts, modify them a little bit, expand them a little bit,
important is, that you gain practice
At the end you should be able to to spawn the cars in a propper way...
...then add the attach code

Umm, ok this is gonna sound rude, but your help is appreciated but you redirecting me to the intro of your tutorial doesn't help me at all. Your tutorial has nothing to do with what I would like to achieve. It's like a guy who wants to build a bookshelf being told to read a guide on quantum physics, it doesn't help and just wastes his time. what I want to do doesn't seem that hard it just seems like I need a little direction in how to do it, not some repetitive examples that show things I already know or have nothing to do with what I need to know. BTW I read your tutorial LONG ago before you told me to, and it doesn't explain things to inexperienced people it just bombards them with examples that do not seem applicable to what a person might do. A good tutorial starts with a basic, simple concept and keeps building on that so people can follow that and learn how it can all interconnect to the total goal, not just random examples that can't be fused to get a final project. I know this because I have taken programming classes before and that is how they all start and teach, through building and building upon concepts already shown and learned. Try to now take that the wrong way. Now so far I've found 4 opcodes that might so what I would like They are:

CODE

0681: attach_object 71@ to_car 60@ with_offset 0.5 0.3 0.3 rotation 0.0 0.0 0.0
0682: detach_object 38@(119@,4i) 0.0 0.0 0.0 collision_detection 0
0683: attach_car 208@ to_car 188@ with_offset 0.0 -4.6 0.65 rotation 15.0 0.0 0.0
0684: detach_car 208@ 20.0 180.0 0.0 collision_detection 0


These seem like they would work but every time I try them they don't. I was also thinking maybe instead of having an attached/detach code maybe I could have a model spawn/or have the car that's in there removed in side the trailer when I pressed a button but that would make to many errors in terms of certain abilities of KITTs, might it not? Thanks

P.S. Maybe you could make a script for what I wanna do and I could pay you for it? I am not interested in claiming scripts as my own when they're not, it would be yours but I could use it, how about that?

Thanks, Bests
Bondlover1313 smile.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#573

Posted 18 March 2013 - 10:29 PM

Try the script below, press Backspace on foot to spawn truck, trailer and a car infront of CJ and to put CJ into the car.
Then drive into the sphere and press Backspace to attach the car to the trailer
Exit the car and drive around with truck and trailer
Press TAB to detach the car from trailer
CODE
{$CLEO .cs}
:Attach_Kitt_Car
03A4: name_thread 'ATTCHKT'

:AttchKt_2// default Loop
wait  0
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_2
if and
044B:   actor $PLAYER_ACTOR on_foot
0AB0:   key_pressed 8//-----------------------------press backspace
jf @AttchKt_2
0247: request_model #ALPHA
0247: request_model #RDTRAIN
0247: request_model #artict1

:AttchKt_3// load model Loop
wait  0
if  and
0248:   model #ALPHA available
0248:   model #RDTRAIN available
0248:   model #artict1 available
jf @AttchKt_3
0172: 14@ = actor $PLAYER_ACTOR Z_angle
14@ += 90.0
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset -10.0  5.0  0.2
00A5: 0@ = create_car #RDTRAIN at 11@ 12@ 13@
0175: set_car 0@ z_angle_to 14@
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0  5.0  0.2
00A5: 1@ = create_car #artict1 at 11@ 12@ 13@
0175: set_car 1@ z_angle_to 14@
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 10.0  5.0  0.2
00A5: 2@ = create_car #ALPHA at 11@ 12@ 13@
0175: set_car 2@ z_angle_to 14@
0249: release_model #ALPHA
0249: release_model #RDTRAIN
0249: release_model #artict1
wait 250
0893: put_trailer 1@ on_cab 0@
036A: put_actor $PLAYER_ACTOR in_car 2@
wait 1000


:AttchKt_13// Loop 1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
8119:  not   car 2@ wrecked
81F4:  not   car 2@ flipped
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @AttchKt_35
if and
0AB0:   key_pressed 8//-----------------------------press backspace
0202:    actor $PLAYER_ACTOR near_car 1@ radius 5.0 5.0 flag 1
00DB:   actor $PLAYER_ACTOR in_car 2@
jf @AttchKt_13
0683: attach_car 2@ to_car 1@ with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0


:AttchKt_15// Loop 2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
8119:  not   car 2@ wrecked
0686:   car 2@ attached
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0  
jf @AttchKt_35
if
0AB0:   key_pressed 9//-----------------------------press TAB
jf @AttchKt_15
0684: detach_car 2@ 0.0 0.0 0.0 collision_detection 0


:AttchKt_35
01C3: remove_references_to_car 0@  // Like turning a car into any random car
01C3: remove_references_to_car 1@
01C3: remove_references_to_car 2@
jump @AttchKt_2


bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#574

Posted 19 March 2013 - 05:15 AM

Wow, thanks Zaz. It's awesome and works totally the way I wanted. Just one small question, lol sorry for annoying you. I modified the script a little to work out the kinks and make it function a bit better, but I don't know if it's possible but is there a way to be able to attach and detach KITT while in the cab and while on foot as well as in the car, this is due to in case the trailer disconnects and the player can't get to KITT. Here is my edited version of the code (I made it so any car the player drives will work, because there are some issues with spawning KITT and main.scm modding is not gonna happen due to the complexity and I don't wanna mess that thing up ever). Thanks a million smile.gif smile.gif smile.gif

CODE
:AttchKt_13// Loop 1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @AttchKt_35
if and
0AB0:   key_pressed 8//-----------------------------press backspace
0202:    actor $PLAYER_ACTOR near_car 1@ radius 50.0 50.0 flag 1
jf @AttchKt_13
03C0: 25@ = actor $PLAYER_ACTOR car
if or
00DB:   actor $PLAYER_ACTOR in_car 25@
00DB:   actor $PLAYER_ACTOR in_car 0@
jf @AttchKt_13
0683: attach_car 25@ to_car 1@ with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0


:AttchKt_15// Loop 2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
0686:   car 25@ attached
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @AttchKt_35
if and
0AB0:   key_pressed 9//-----------------------------press TAB
jf @AttchKt_15
03C0: 25@ = actor $PLAYER_ACTOR car
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @AttchKt_13


:AttchKt_35
01C3: remove_references_to_car 0@  // Like turning a car into any random car
01C3: remove_references_to_car 1@
01C3: remove_references_to_car 2@
01C3: remove_references_to_car 25@
jump @AttchKt_2


P.S. I left out the spawning part as I didn't change that at all, or anything before that part. smile.gif

Thanks, Bests
Bondlover1313 smile.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#575

Posted 19 March 2013 - 10:04 AM

03C0: should not run in a loop but before the loop

CODE

if
00DF:   actor $PLAYER_ACTOR driving
jf @AttchKt_5
03C0: 25@ = actor $PLAYER_ACTOR car

:AttchKt_13// Loop 1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
8119:  not   car 25@ wrecked
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @AttchKt_35
if and
0AB0:   key_pressed 8//-----------------------------press backspace
0202:    actor $PLAYER_ACTOR near_car 1@ radius 50.0 50.0 flag 1
jf @AttchKt_13
if or
00DB:   actor $PLAYER_ACTOR in_car 25@
00DB:   actor $PLAYER_ACTOR in_car 0@
jf @AttchKt_13
0683: attach_car 25@ to_car 1@ with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0


:AttchKt_15// Loop 2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @AttchKt_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
8119:  not   car 25@ wrecked
0686:   car 25@ attached
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @AttchKt_35
if and
0AB0:   key_pressed 9//-----------------------------press TAB
jf @AttchKt_15
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @AttchKt_13


:AttchKt_35
01C3: remove_references_to_car 0@  // Like turning a car into any random car
01C3: remove_references_to_car 1@
jump @AttchKt_2

bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#576

Posted 19 March 2013 - 08:59 PM

Yeah, ok but I wanted to know if there is a way to do the following:

Scenario 1: Attach and Detach KITT while driving him.
Scenario 2: Attach and Detach KITT while driving cab.
Scenario 3: Attach and Detach KITT while on foot.

Also, they can kind of overlap. What I mean by that is a sort of if you attach KITT in the cab or while driving him you can detach him either on foot, in the cab, or in himself. If that makes any sense? There might be a sort of check if such and such condition is met or not met and then direct to the appropriate entry. Once again if that makes sense?

Keep in mind as well I can't just spawn KITT because the people who made the original mod made it so that only 1 KITT while spawn ever until it is destroyed and then a new can be spawned but only via specific scenario. I thought maybe there was an opcode that remembers the player's previous car and makes that previous car a variable. I have only found a memory address that kind of does that but not really and it goes into hex editing which I am sorry to say is just rocket science to me. The address was 0x969084 and I have no idea what that means or how to use it. So if you could help get this script like this I won't ask another thing. Thanks

Thanks, Bests
Bondlover1313 smile.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#577

Posted 20 March 2013 - 09:32 AM

QUOTE (bondlover1313 @ Tuesday, Mar 19 2013, 21:59)


Also, they can kind of overlap. What I mean by that is a sort of if you attach KITT in the cab or while driving him you can detach him either on foot, in the cab, or in himself. If that makes any sense? There might be a sort of check if such and such condition is met or not met and then direct to the appropriate entry. Once again if that makes sense?

Keep in mind as well I can't just spawn KITT because the people who made the original mod made it so that only 1 KITT while spawn ever until it is destroyed and then a new can be spawned but only via specific scenario. I thought maybe there was an opcode that remembers the player's previous car and makes that previous car a variable. I have only found a memory address that kind of does that but not really and it goes into hex editing which I am sorry to say is just rocket science to me. The address was 0x969084 and I have no idea what that means or how to use it. So if you could help get this script like this I won't ask another thing. Thanks

Thanks, Bests
Bondlover1313 smile.gif

so change the conditional check

if or
either on foot,
in the cab,
or in himself.
jf @
if
key_pressed




yeh the kittmod was always a main mod
doesn't matter
you have to modify the default loop
check
if and
player actor drive car model #phoenix
keypressed
then
03C0: 2@ = actor $PLAYER_ACTOR car

you have then your Kitt, or could the phoenix not be Kitt?
you do NOT need to remove reference car handle when using 03C0:

then spawn cab and trailer
as long as all three vehicles are not wrecked and player is near trailer and Kitt radius 100.0 can you keep the code running in the first and second loop
and if not, then run into the cleanup block to start from beginnig in the default loop

bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#578

Posted 21 March 2013 - 12:19 AM Edited by bondlover1313, 21 March 2013 - 03:57 AM.

QUOTE (ZAZ @ Wednesday, Mar 20 2013, 09:32)
QUOTE (bondlover1313 @ Tuesday, Mar 19 2013, 21:59)


Also, they can kind of overlap. What I mean by that is a sort of if you attach KITT in the cab or while driving him you can detach him either on foot, in the cab, or in himself. If that makes any sense? There might be a sort of check if such and such condition is met or not met and then direct to the appropriate entry. Once again if that makes sense?

Keep in mind as well I can't just spawn KITT because the people who made the original mod made it so that only 1 KITT while spawn ever until it is destroyed and then a new can be spawned but only via specific scenario. I thought maybe there was an opcode that remembers the player's previous car and makes that previous car a variable. I have only found a memory address that kind of does that but not really and it goes into hex editing which I am sorry to say is just rocket science to me. The address was 0x969084 and I have no idea what that means or how to use it. So if you could help get this script like this I won't ask another thing. Thanks

Thanks, Bests
Bondlover1313 smile.gif

so change the conditional check

if or
either on foot,
in the cab,
or in himself.
jf @
if
key_pressed




yeh the kittmod was always a main mod
doesn't matter
you have to modify the default loop
check
if and
player actor drive car model #phoenix
keypressed
then
03C0: 2@ = actor $PLAYER_ACTOR car

you have then your Kitt, or could the phoenix not be Kitt?
you do NOT need to remove reference car handle when using 03C0:

then spawn cab and trailer
as long as all three vehicles are not wrecked and player is near trailer and Kitt radius 100.0 can you keep the code running in the first and second loop
and if not, then run into the cleanup block to start from beginnig in the default loop

I know I said I wouldn't bother you anymore but this has really thrown me for a loop. I've tried every possible thing I can think of for the past 2 days and I get close then some part just doesn't work and it's back to the drawing board. I am trying to combine 2 loops (one is the attach/detach KITT and the other is a SEMIRAMP Up/Down) and they both work on their own but when you put two of them together one takes priority over the other. I bet I am probably overlooking a simple little thing but here is my entire code and I wanted to know if you could help me get both loops going, like I can attach/detach and Ramp Up/Down at the same time with both of the two being active. Thanks smile.gif

SPAWNER/RAMPMODEL ATTACH
CODE
thread 'SEMIKITT'

:SEMIKITT_19
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_19
if
 $ONMISSION == 0
jf @SEMIKITT_19
wait 0
if
0AB0:   key_pressed 118
jf @SEMIKITT_19
Model.Load(#RDTRAIN)
Model.Load(#WMYMECH)
Model.Load(#ARTICT1)
Model.Load(19007)
04C4: store_coords_to $411 $412 $413 from_actor $PLAYER_ACTOR with_offset -10.0 5.0 0.2
04C4: store_coords_to $415 $416 $419 from_actor $PLAYER_ACTOR with_offset 0.0 5.0 0.2

:SEMIKITT_148
wait 0
if and
  Model.Available(#RDTRAIN)
  Model.Available(#ARTICT1)
  Model.Available(#WMYMECH)
jf @SEMIKITT_148
wait 0
$420 = Car.Create(#RDTRAIN, $411, $412, $413)
$421 = Car.Create(#ARTICT1, $415, $416, $419)
0893: put_trailer $421 on_cab $420
0129: $425 = create_actor_pedtype 50 model #WMYMECH in_car $420 driverseat
03CC: enable_car $420 stuck_check_distance_to 2.0 time_to 2000
$426 = Marker.CreateAboveCar($420)
Marker.SetColor($426, 1)
Car.RemoveReferences($420)
053F: set_car $420 tires_vulnerability 1
Car.SetImmunities($420, 1, 1, 1, 1, 1)
053F: set_car $421 tires_vulnerability 1
Car.SetImmunities($421, 1, 1, 1, 1, 1)
wait 0
0633: AS_actor $425 exit_car
Car.DoorStatus($420) = 0
02D4: car $420 turn_off_engine
Actor.Angle($425) = 269.5674
wait 0
Car.DoorStatus($420) = 0
Actor.RemoveReferences($425)
wait 0
Marker.Disable($426)
wait 0
if
  Model.Available(19007)
$11440 = -2.0
$11438 = Object.Create(19007, 1833.36, -1995.45, 12.5)
Object.CollisionDetection($11438) = True
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_497


ATTACH/DETACH KITT
CODE
:SEMIKITT_497
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_804
if and
81F4:   not car $421 flipped
0202:   actor $PLAYER_ACTOR near_car $421 radius 80.0 80.0 flag 0
jf @SEMIKITT_804
if and
0AB0:   key_pressed 8
0202:   actor $PLAYER_ACTOR near_car $421 radius 50.0 50.0 flag 0
jf @SEMIKITT_497
03C0: 25@ = actor $PLAYER_ACTOR car
if or
  Actor.InCar($PLAYER_ACTOR, 25@)
  Actor.InCar($PLAYER_ACTOR, 0@)
jf @SEMIKITT_497
0683: attach_car 25@ to_car $421 with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0

:SEMIKITT_676
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_804
if and
0686:   car 25@ attached
0202:   actor $PLAYER_ACTOR near_car $421 radius 80.0 80.0 flag 0
jf @SEMIKITT_804
if
0AB0:   key_pressed 9
jf @SEMIKITT_676
03C0: 25@ = actor $PLAYER_ACTOR car
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @SEMIKITT_497

:SEMIKITT_804
Car.RemoveReferences(0@)
Car.RemoveReferences($421)
Car.RemoveReferences(25@)
jump @SEMIKITT_497


RAMP UP/DOWN
CODE
:SEMIKITT_778
wait 0
if
0AB0:   key_pressed 116
jf @SEMIKITT_882
jump @SEMIKITT_804

:SEMIKITT_804
if
  not $11440 == -110.0
jf @SEMIKITT_882
$11440 = -110.0
wait 10
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_882

:SEMIKITT_882
wait 0
if
0AB0:   key_pressed 117
jf @SEMIKITT_778
jump @SEMIKITT_908

:SEMIKITT_908
if
  not $11440 == 0.0
jf @SEMIKITT_778
$11440 = 0.0
wait 10
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_497

:SEMIKITT_986
wait 0
jump @SEMIKITT_497


So any help that can be provided would be deeply appreciated, as I'm so close to finally getting this a script done. Thanks

Thanks, Bests
Bondlover1313:)

MRobinson
  • MRobinson

    Secret Agent

  • Members
  • Joined: 05 Jul 2012

#579

Posted 21 March 2013 - 01:37 PM Edited by MRobinson, 28 March 2013 - 12:13 PM.

ZAZ help me in my topic plz, I do not want to spam up your topic.

http://www.gtaforums...T&f=49&t=548598

EDIT: Doubts Cleared and Topic Locked.

ZAZ
  • ZAZ

    Kernlochbohrer

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

#580

Posted 23 March 2013 - 09:36 PM

QUOTE (bondlover1313 @ Thursday, Mar 21 2013, 01:19)
I am trying to combine 2 loops (one is the attach/detach KITT and the other is a SEMIRAMP Up/Down) and they both work on their own but when you put two of them together one takes priority over the other. I bet I am probably overlooking a simple little thing but here is my entire code and I wanted to know if you could help me get both loops going, like I can attach/detach and Ramp Up/Down at the same time with both of the two being active. Thanks smile.gif

Thanks, Bests
Bondlover1313:)

ok, open your eyes monocle.gif and study the script below
i used 2893, kmb_ramp, kmb_ramp_txd, 100, 0
30@ = 2893
change 2893 with your ramp model id

SEMI_KNIGHT_TRACK
press backspace to SPAWN TRUCK AT CAR PATH AND BRING TO PLAYER

press h key to open/close ramp
player must drive PHOENIX to get the car handle then he can leave or stay in in phoenix
ramp must be at 0.0 x_angle then phoenix must be in red sphere then press TAB to attach PHOENIX to SEMI trailer
press backspace to detach PHOENIX

CODE
{$CLEO .cs}
:SEMI_KNIGHT_TRACK
{
press backspace to SPAWN TRUCK AT CAR PATH AND BRING TO PLAYER

Loop 1 : if truck is near player then - stop truck, put trailer on cab, attach ramp to trailer
Loop 2 : controle ramp if player don't drive phoenix
Loop 3: controle ramp if player drive phoenix then attach phoenix by keypress if near trailer
Loop 4: : controle ramp if  phoenix is attached to trailer and detach phoenix

press h key    to open/close ramp
player must drive PHOENIX to get the car handle then he can leave or stay in in phoenix
ramp must be at 0.0 x_angle then phoenix must be in red sphere then press TAB to attach  PHOENIX to SEMI trailer
press backspace to detach PHOENIX
}


thread 'SEMI'
//2893, kmb_ramp, kmb_ramp_txd, 100, 0
30@ = 2893

:SEMI_2// default Loop
wait  0
if
0256:   player $PLAYER_CHAR defined
jf @SEMI_2
if
0AB0:   key_pressed 8//-----------------------------press backspace
jf @SEMI_2
//---------------------------------------------------------------------------------------
//SPAWN TRUCK AT CAR PATH AND BRING TO PLAYER
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0  0.0  0.0
06F8: get_nearest_route_for 11@ 12@ 13@ in_direction 1 store_to 15@ 16@ 17@ Z_angle_to 14@
0247: request_model 30@
0247: request_model #RDTRAIN
0247: request_model #artict1

:SEMI_3// load model Loop           SPAWN TRUCK AT CAR PATH AND BRING TO PLAYER
wait  0
if  and
0248:   model 30@ available
0248:   model #RDTRAIN available
0248:   model #artict1 available
jf @SEMI_3
17@ += 1.0
00A5: 0@ = create_car #RDTRAIN at 15@ 16@ 17@
0175: set_car 0@ z_angle_to 14@
17@ -= 51.0
00A5: 1@ = create_car #artict1 at 15@ 16@ 17@
0175: set_car 1@ z_angle_to 14@
099A: set_car 1@ collision_detection 0
16@ += 9.0
0107: 2@ = create_object 30@ at  15@ 16@ 17@
0249: release_model #RDTRAIN
0249: release_model #artict1
0249: release_model 30@
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0  5.0  0.0
wait 250
039F: set_car 0@ race_to 11@ 12@
04BA: set_car 0@ speed_to 50.0
wait 10
if
8202:  not  actor $PLAYER_ACTOR near_car 0@ radius 20.0 20.0 flag 0
jf @SEMI_7
039F: set_car 0@ race_to 11@ 12@
04BA: set_car 0@ speed_to 50.0
if
8202:  not  actor $PLAYER_ACTOR near_car 0@ radius 50.0 50.0 flag 0
jf @SEMI_7
wait 500
00AD: set_car 0@ max_speed_to 45.0
00AE: set_car 0@ traffic_behaviour_to 2
00AF: set_car 0@ driver_behaviour_to  4//-- 2 as last param let chase the player
//SPAWN TRUCK AT CAR PATH AND BRING TO PLAYER

//---------------------------------------------------------------------------------------
:SEMI_7// Loop 1 : if truck is near player then - stop truck, put trailer on cab, attach ramp to trailer
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @SEMI_35
if  and
8119:  not   car 0@ wrecked
8119:  not   car 1@ wrecked
81F4:  not   car 0@ flipped
0202:    actor $PLAYER_ACTOR near_car 0@ radius 80.0 80.0 flag 0
jf @SEMI_35
if
0202:    actor $PLAYER_ACTOR near_car 0@ radius 9.0 9.0 flag 0
jf @SEMI_7
04BA: set_car 0@ speed_to 0.0
0519: lock_vehicle 0@ in_current_position  1
wait 50
099A: set_car 1@ collision_detection 1
0893: put_trailer 1@ on_cab 0@
wait 250
0519: lock_vehicle 0@ in_current_position  0


7@ = -130.0
0681: attach_object 2@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 7@ 0.0 0.0
8@ = 0
//- stop truck, put trailer on cab, attach ramp to trailer
if
80DD: not  actor $PLAYER_ACTOR driving_car_with_model #PHOENIX
jf @SEMI_11

//---------------------------------------------------------------------------------------
:SEMI_9// Loop 2 : controle ramp if player don't drive phoenix
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @SEMI_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
0202:    actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @SEMI_35
if and
0AB0:   key_pressed 72//------------------------------ press h key    to open/close ramp
0202:    actor $PLAYER_ACTOR near_car 1@ radius 45.0 45.0 flag 0
jf @SEMI_11
gosub @SEMI_Ramp_sub_1// subscript to move ramp up/down

:SEMI_11
if
00DD:   actor $PLAYER_ACTOR driving_car_with_model #PHOENIX
jf @SEMI_9
03C0: 5@ = actor $PLAYER_ACTOR car
jump @SEMI_13


//---------------------------------------------------------------------------------------
:SEMI_13// Loop 3: controle ramp if player drive phoenix then attach phoenix by keypress if near trailer
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @SEMI_35
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
0202:    actor $PLAYER_ACTOR near_car 1@ radius 150.0 150.0 flag 0
jf @SEMI_35
if and
0AB0:   key_pressed 72//------------------------------ press h key    to open/close ramp
0202:    actor $PLAYER_ACTOR near_car 1@ radius 45.0 45.0 flag 0
jf @SEMI_15
gosub @SEMI_Ramp_sub_1// subscript to move ramp up/down

:SEMI_15
if
00DD:   actor $PLAYER_ACTOR driving_car_with_model #PHOENIX
jf @SEMI_16
if
00DB:   actor $PLAYER_ACTOR in_car 5@
jf @SEMI_29

:SEMI_16
if and
8119:  not   car 5@ wrecked
0202:    actor $PLAYER_ACTOR near_car 5@ radius 150.0 150.0 flag 0
jf @SEMI_9// jump into Loop 2 controle ramp if player don't drive phoenix
if and
8@ == 1
7@ > -5.0
jf @SEMI_13
0407: store_coords_to 11@ 12@ 13@ from_car 1@ with_offset 0.0 0.0 0.0
if and
0AB0:   key_pressed 9//-----------------------------press TAB to attach  PHOENIX to SEMI trailer
01AD:   car 5@ sphere 1 near_point 11@ 12@ radius 5.0 5.0
jf @SEMI_13
0683: attach_car 5@ to_car 1@ with_offset 0.0 0.0 1.0 rotation 0.0 0.0 0.0

//---------------------------------------------------------------------------------------
:SEMI_17// Loop 4: : controle ramp if  phoenix is attached to trailer and detach phoenix
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @SEMI_45
if  and
8119:  not   car 0@ wrecked
81F4:  not   car 0@ flipped
8119:  not   car 1@ wrecked
81F4:  not   car 1@ flipped
0202:    actor $PLAYER_ACTOR near_car 1@ radius 150.0 150.0 flag 0  
jf @SEMI_45
if and
0AB0:   key_pressed 72//------------------------------ press h key    to open/close ramp
0202:    actor $PLAYER_ACTOR near_car 1@ radius 45.0 45.0 flag 0
jf @SEMI_18
gosub @SEMI_Ramp_sub_1// subscript to move ramp up/down

:SEMI_18
if
0119:   car 5@ wrecked
jf @SEMI_19
0684: detach_car 5@ 0.0 0.0 0.0 collision_detection 0
jump @SEMI_9// jump into Loop 2 controle ramp if player don't drive phoenix


:SEMI_19
if
0686:  car 5@ attached
jf @SEMI_13// jump into Loop 3 controle ramp if player drive phoenix
if
0AB0:   key_pressed 8//-----------------------------press backspace to detach car
jf @SEMI_17
0684: detach_car 5@ 0.0 0.0 0.0 collision_detection 0
04BA: set_car 5@ speed_to -20.0
if
00DB:   actor $PLAYER_ACTOR in_car 5@
jf @SEMI_9// jump into Loop 2 controle ramp if player don't drive phoenix
jump @SEMI_13// jump into Loop 3 controle ramp if player drive phoenix

:SEMI_29
01C3: remove_references_to_car 5@
wait 1000
jump @SEMI_9// jump into Loop 2 controle ramp if player don't drive phoenix



// Cleanup if any of truck or trailer is wrecked or if trailer is far away or if player died or got arrested


:SEMI_35
0108: destroy_object 2@
01C3: remove_references_to_car 0@  // Like turning a car into any random car
01C3: remove_references_to_car 1@
jump @SEMI_2

:SEMI_45
0108: destroy_object 2@
0684: detach_car 5@ 0.0 0.0 0.0 collision_detection 0
01C3: remove_references_to_car 0@  // Like turning a car into any random car
01C3: remove_references_to_car 1@
jump @SEMI_2






:SEMI_Ramp_sub_1
if and
8@ == 0
1.0 > 7@
jf @SEMI_Ramp_sub_3
0681: attach_object 2@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 7@ 0.0 0.0
7@ += 1.0
jump @SEMI_Ramp_sub_5

:SEMI_Ramp_sub_3
if and
8@ == 1
7@ > -135.0
jf @SEMI_Ramp_sub_5
0681: attach_object 2@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 7@ 0.0 0.0
7@ -= 1.0

:SEMI_Ramp_sub_5
if and
8@ == 0
7@ > 0.0
jf @SEMI_Ramp_sub_7
8@ = 1
0681: attach_object 2@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 0.0 0.0 0.0
wait 500
jump @SEMI_Ramp_sub_9

:SEMI_Ramp_sub_7
if and
8@ == 1
-134.0 > 7@
jf @SEMI_Ramp_sub_9
8@ = 0
0681: attach_object 2@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation -134.0 0.0 0.0
wait 500

:SEMI_Ramp_sub_9
return


bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#581

Posted 24 March 2013 - 01:02 AM

QUOTE (ZAZ @ Saturday, Mar 23 2013, 21:36)
QUOTE (bondlover1313 @ Thursday, Mar 21 2013, 01:19)
I am trying to combine 2 loops (one is the attach/detach KITT and the other is a SEMIRAMP Up/Down) and they both work on their own but when you put two of them together one takes priority over the other. I bet I am probably overlooking a simple little thing but here is my entire code and I wanted to know if you could help me get both loops going, like I can attach/detach and Ramp Up/Down at the same time with both of the two being active. Thanks smile.gif

Thanks, Bests
Bondlover1313:)

ok, open your eyes monocle.gif and study the script below
i used 2893, kmb_ramp, kmb_ramp_txd, 100, 0
30@ = 2893
change 2893 with your ramp model id

SEMI_KNIGHT_TRACK
press backspace to SPAWN TRUCK AT CAR PATH AND BRING TO PLAYER

press h key to open/close ramp
player must drive PHOENIX to get the car handle then he can leave or stay in in phoenix
ramp must be at 0.0 x_angle then phoenix must be in red sphere then press TAB to attach PHOENIX to SEMI trailer
press backspace to detach PHOENIX

Off-Topic: Calm down, I am not as smart as you. You need to be patient with me, I am not a genius at coding like you. I am doing my best to understand what you are telling me, and trust me that is hard for me (it's not your fault). Despite what you may think, I do not like to just copy someone else's code/work and just slap it in a file and go "look at me and my code!" I would rather say "here is a code that I got major help with but I didn't steal or plagiarize it. This was a cooperative effort." and share the acknowledgement equally, or more like 85% to 15%, your favor. So I am sorry if I am making you feel frustrated, angry, annoyed, deterred, hatred toward me, etc. finally, making you also dislike coding just a little bit every time you see a message/post from me, and for that I am truly sorry. sad.gif

On-Topic: Ok, I've looked and looked at that script but, there is still my problem even when I add a gosub routine it still doesn't work (That was one of my first thoughts before posting this problem). I tried your code and it works but your code has a lot of unnecessary stuff and its hard to sift through and it looks like you added another spawner and another code all together if the player is in the car or not. Also, you added car paths and things like that which makes things even more complicated and adds the ability to crash more often. I am going for simple as possible, if you look at my code it is REALLY simple compared to yours. If you could just use my code, it would be better as I don't wanna completely overload my script with more code then needed and I don't wanna steal your code. Thanks


Thanks, Bests
Bondlover1313 smile.gif

bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#582

Posted 26 March 2013 - 04:54 AM Edited by bondlover1313, 26 March 2013 - 07:32 PM.

Hey ZAZ update, I FINALLY HAVE FIGURED IT OUT!!!!! I just finished the code and my god was it easier then I thought, I actually had it earlier but I forgot to just separate a few lines of code. But yes finally I will shut up and stop annoying you on here! lol sorry smile.gif So thanks for all the help I consider this code to be 60% you 20% Me and 20% headache and aggravation (that is your other 20% lol). I am just so Happy! smile.gif Here it is so you can see. Due note this code is the copyrighted to both you and me, so no one else pirate this code, lol random forum viewers, lol.

F.L.A.G. Semi Code ALPHA STAGE 1: 100% DONE!
CODE

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'SEMIKITT'

:SEMIKITT_19
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_19
if
  Actor.DrivingVehicleType($PLAYER_ACTOR, #BFINJECT)
jf @SEMIKITT_19
03C0: 25@ = actor $PLAYER_ACTOR car
if
 $ONMISSION == 0
jf @SEMIKITT_19
wait 0
if
0AB0:   key_pressed 118
jf @SEMIKITT_19
Model.Load(#RDTRAIN)
Model.Load(#WMYMECH)
Model.Load(#ARTICT1)
Model.Load(19007)
04C4: store_coords_to $411 $412 $413 from_actor $PLAYER_ACTOR with_offset -10.0 5.0 0.2
04C4: store_coords_to $415 $416 $419 from_actor $PLAYER_ACTOR with_offset 0.0 5.0 0.2

:SEMIKITT_148
wait 0
if and
  Model.Available(#RDTRAIN)
  Model.Available(#ARTICT1)
  Model.Available(#WMYMECH)
jf @SEMIKITT_148
wait 0
$420 = Car.Create(#RDTRAIN, $411, $412, $413)
$421 = Car.Create(#ARTICT1, $415, $416, $419)
0893: put_trailer $421 on_cab $420
0129: $425 = create_actor_pedtype 50 model #WMYMECH in_car $420 driverseat
03CC: enable_car $420 stuck_check_distance_to 2.0 time_to 2000
$426 = Marker.CreateAboveCar($420)
Marker.SetColor($426, 1)
Car.RemoveReferences($420)
053F: set_car $420 tires_vulnerability 1
Car.SetImmunities($420, 1, 1, 1, 1, 1)
053F: set_car $421 tires_vulnerability 1
Car.SetImmunities($421, 1, 1, 1, 1, 1)
wait 0
0633: AS_actor $425 exit_car
Car.DoorStatus($420) = 0
02D4: car $420 turn_off_engine
Actor.Angle($425) = 269.5674
wait 0
Car.DoorStatus($420) = 0
Actor.RemoveReferences($425)
wait 0
Marker.Disable($426)
wait 0
if
  Model.Available(19007)
$11440 = -2.0
$11438 = Object.Create(19007, 1833.36, -1995.45, 12.5)
Object.CollisionDetection($11438) = True
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_900
wait 0
if
0AB0: key pressed 8
else_jump @SEMIKITT_901
jump @SEMIKITT_497

:SEMIKITT_901
if
0AB0: key pressed 9
else_jump @SEMIKITT_902
jump @SEMIKITT_676

:SEMIKITT_902
if
0AB0: key pressed 116
else_jump @SEMIKITT_903
jump @SEMIKITT_830

:SEMIKITT_903
if
0AB0: key pressed 117
else_jump @SEMIKITT_900
jump @SEMIKITT_820

:SEMIKITT_497
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_900
if and
81F4:   not car $421 flipped
0202:   actor $PLAYER_ACTOR near_car $421 radius 80.0 80.0 flag 0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900  
if and
0AB0:   key_pressed 8
0202:   actor $PLAYER_ACTOR near_car $421 radius 50.0 50.0 flag 0
jf @SEMIKITT_900  
0683: attach_car 25@ to_car $421 with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0
jump @SEMIKITT_901

:SEMIKITT_676
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_900
if and
0686:   car 25@ attached
0202:   actor $PLAYER_ACTOR near_car $421 radius 80.0 80.0 flag 0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900  
if
0AB0:   key_pressed 9
jf @SEMIKITT_900
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @SEMIKITT_900

:SEMIKITT_804
wait 0
jump @SEMIKITT_900

:SEMIKITT_830
wait 0
if and
0AB0: key pressed 116
$11440 = 0.0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900
$11440 = -110.0  
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_903

:SEMIKITT_820
wait 0
if and
0AB0: key pressed 117
$11440 = -110.0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900
$11440 = 0.0  
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_902


Thanks ZAZ, and Bests forever ZAZ
Bondlover1313 smile.gif smile.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#583

Posted 26 March 2013 - 06:32 PM

QUOTE (bondlover1313 @ Tuesday, Mar 26 2013, 05:54)
Hey ZAZ update, I FINALLY HAVE FIGURED IT OUT!!!!! I just finished the code and my god was it easier then I thought, I actually had it earlier but I forgot to just separate a few lines of code. But yes finally I will shut up and stop annoying you on here! lol sorry smile.gif So thanks for all the help I consider this code to be 60% you 20% Me and 20% headache and aggravation (that is your other 20% lol). I am just so Happy! smile.gif Here it is so you can see. Due note this code is the copyrighted to both you and me, so no one else pirate this code, lol random forum viewers, lol.

F.L.A.G. Semi Code 100% DONE!
CODE

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'SEMIKITT'

:SEMIKITT_19
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_19
if
  Actor.DrivingVehicleType($PLAYER_ACTOR, #BFINJECT)
jf @SEMIKITT_19
03C0: 25@ = actor $PLAYER_ACTOR car
if
 $ONMISSION == 0
jf @SEMIKITT_19
wait 0
if
0AB0:   key_pressed 118
jf @SEMIKITT_19
Model.Load(#RDTRAIN)
Model.Load(#WMYMECH)
Model.Load(#ARTICT1)
Model.Load(19007)
04C4: store_coords_to $411 $412 $413 from_actor $PLAYER_ACTOR with_offset -10.0 5.0 0.2
04C4: store_coords_to $415 $416 $419 from_actor $PLAYER_ACTOR with_offset 0.0 5.0 0.2

:SEMIKITT_148
wait 0
if and
  Model.Available(#RDTRAIN)
  Model.Available(#ARTICT1)
  Model.Available(#WMYMECH)
jf @SEMIKITT_148
wait 0
$420 = Car.Create(#RDTRAIN, $411, $412, $413)
$421 = Car.Create(#ARTICT1, $415, $416, $419)
0893: put_trailer $421 on_cab $420
0129: $425 = create_actor_pedtype 50 model #WMYMECH in_car $420 driverseat
03CC: enable_car $420 stuck_check_distance_to 2.0 time_to 2000
$426 = Marker.CreateAboveCar($420)
Marker.SetColor($426, 1)
Car.RemoveReferences($420)
053F: set_car $420 tires_vulnerability 1
Car.SetImmunities($420, 1, 1, 1, 1, 1)
053F: set_car $421 tires_vulnerability 1
Car.SetImmunities($421, 1, 1, 1, 1, 1)
wait 0
0633: AS_actor $425 exit_car
Car.DoorStatus($420) = 0
02D4: car $420 turn_off_engine
Actor.Angle($425) = 269.5674
wait 0
Car.DoorStatus($420) = 0
Actor.RemoveReferences($425)
wait 0
Marker.Disable($426)
wait 0
if
  Model.Available(19007)
$11440 = -2.0
$11438 = Object.Create(19007, 1833.36, -1995.45, 12.5)
Object.CollisionDetection($11438) = True
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_900
wait 0
if
0AB0: key pressed 8
else_jump @SEMIKITT_901
jump @SEMIKITT_497

:SEMIKITT_901
if
0AB0: key pressed 9
else_jump @SEMIKITT_902
jump @SEMIKITT_676

:SEMIKITT_902
if
0AB0: key pressed 116
else_jump @SEMIKITT_903
jump @SEMIKITT_830

:SEMIKITT_903
if
0AB0: key pressed 117
else_jump @SEMIKITT_900
jump @SEMIKITT_820

:SEMIKITT_497
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_900
if and
81F4:   not car $421 flipped
0202:   actor $PLAYER_ACTOR near_car $421 radius 80.0 80.0 flag 0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900  
if and
0AB0:   key_pressed 8
0202:   actor $PLAYER_ACTOR near_car $421 radius 50.0 50.0 flag 0
jf @SEMIKITT_900  
0683: attach_car 25@ to_car $421 with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0
jump @SEMIKITT_901

:SEMIKITT_676
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_900
if and
0686:   car 25@ attached
0202:   actor $PLAYER_ACTOR near_car $421 radius 80.0 80.0 flag 0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900  
if
0AB0:   key_pressed 9
jf @SEMIKITT_900
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @SEMIKITT_900

:SEMIKITT_804
wait 0
jump @SEMIKITT_900

:SEMIKITT_830
wait 0
if and
0AB0: key pressed 116
$11440 = 0.0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900
$11440 = -110.0  
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_903

:SEMIKITT_820
wait 0
if and
0AB0: key pressed 117
$11440 = -110.0
jf @SEMIKITT_900
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car $420
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900
$11440 = 0.0  
0681: attach_object $11438 to_car $421 with_offset -0.05 -10.56 -0.82 rotation $11440 0.0 0.0
jump @SEMIKITT_902


Thanks ZAZ, and Bests forever ZAZ
Bondlover1313 smile.gif smile.gif


congraz for your first own script
then the mistakes
1. don't use globals like this in cleoscripts because they can cause bugs and crashes
use locals instead


2. you can't use anymore this variable $420 after Car.RemoveReferences($420)
QUOTE
Car.RemoveReferences($420)
053F: set_car $420 tires_vulnerability 1
Car.SetImmunities($420, 1, 1, 1, 1, 1)
wait 0
Car.DoorStatus($420) = 0
02D4: car $420 turn_off_engine


also, this check don't work:
QUOTE
00DB:   actor $PLAYER_ACTOR in_car $420


3. you have to remove reference of $421 (trailer) at any case
add a cleanup part and add there also the truck's Car.RemoveReferences
then can you spawn truck and trailer again

4. these checks for the the ramp rotaion don't work:
QUOTE
if and
0AB0: key pressed 116
$11440 = 0.0//  <--------- must have 2 Equals signs to work as condition
jf @SEMIKITT_900

must have 2 Equals signs to work as condition
CODE
if
$11440 == 0.0


this declares the var:
CODE
$11440 = -110.0


5. you can write it more slim
CODE
{$CLEO .cs}

//-------------MAIN---------------
thread 'SEMIKITT'

:SEMIKITT_19
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_19
if
  Actor.DrivingVehicleType($PLAYER_ACTOR, #BFINJECT)
jf @SEMIKITT_19
03C0: 25@ = actor $PLAYER_ACTOR car
if
 $ONMISSION == 0
jf @SEMIKITT_19
if
0AB0:   key_pressed 118
jf @SEMIKITT_19
Model.Load(#RDTRAIN)
Model.Load(#WMYMECH)
Model.Load(#ARTICT1)
Model.Load(19007)
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -10.0 5.0 0.2

:SEMIKITT_148
wait 0
if and
  Model.Available(#RDTRAIN)
  Model.Available(#ARTICT1)
  Model.Available(#WMYMECH)
  Model.Available(19007)
jf @SEMIKITT_148
wait 0
0@ = Car.Create(#RDTRAIN, 11@, 12@, 13@)
13@ -= 50.0
1@ = Car.Create(#ARTICT1, 11@, 12@, 13@)
0893: put_trailer 1@ on_cab 0@
0129: 2@ = create_actor_pedtype 50 model #WMYMECH in_car 0@ driverseat
3@ = Marker.CreateAboveCar(0@)
Marker.SetColor(3@, 1)
053F: set_car 0@ tires_vulnerability 1
Car.SetImmunities(0@, 1, 1, 1, 1, 1)
053F: set_car 1@ tires_vulnerability 1
Car.SetImmunities(1@, 1, 1, 1, 1, 1)
wait 0
0633: AS_actor 2@ exit_car
Car.DoorStatus(0@) = 0
02D4: car 0@ turn_off_engine
wait 0
Car.DoorStatus(0@) = 0
Marker.Disable(3@)
Actor.RemoveReferences(2@)
15@ = 0.0
5@ = Object.Create(19007, 1833.36, -1995.45, 12.5)
Object.CollisionDetection(5@) = True
0681: attach_object 5@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 15@ 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_900
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_1300
if and
  not Car.Wrecked(1@)
  not Car.Wrecked(0@)
81F4:   not car 1@ flipped
0202:   actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @SEMIKITT_1300
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car 0@
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900
if
0AB0: key pressed 8
jf @SEMIKITT_901
0683: attach_car 25@ to_car 1@ with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0
jump @SEMIKITT_902

:SEMIKITT_901
if
0AB0: key pressed 9
jf @SEMIKITT_902
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @SEMIKITT_902

:SEMIKITT_902
if and
0AB0: key pressed 116
 15@ == 0.0
jf @SEMIKITT_903
15@ = -110.0
0681: attach_object 5@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 15@ 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_903
if and
0AB0: key pressed 117
 15@ == -110.0
jf @SEMIKITT_900
15@ = 0.0
0681: attach_object 5@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 15@ 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_1300
Car.RemoveReferences(0@)
Car.RemoveReferences(1@)
jump @SEMIKITT_19  

bondlover1313
  • bondlover1313

    KITT2000

  • Members
  • Joined: 30 Nov 2008

#584

Posted 26 March 2013 - 07:31 PM

QUOTE (ZAZ @ Tuesday, Mar 26 2013, 18:32)
QUOTE (bondlover1313 @ Tuesday, Mar 26 2013, 05:54)
Hey ZAZ update, I FINALLY HAVE FIGURED IT OUT!!!!! I just finished the code and my god was it easier then I thought, I actually had it earlier but I forgot to just separate a few lines of code. But yes finally I will shut up and stop annoying you on here! lol sorry smile.gif So thanks for all the help I consider this code to be 60% you 20% Me and 20% headache and aggravation (that is your other 20% lol). I am just so Happy! smile.gif Here it is so you can see. Due note this code is the copyrighted to both you and me, so no one else pirate this code, lol random forum viewers, lol.



congraz for your first own script
then the mistakes
1. don't use globals like this in cleoscripts because they can cause bugs and crashes
use locals instead


2. you can't use anymore this variable $420 after Car.RemoveReferences($420)
QUOTE
Car.RemoveReferences($420)
053F: set_car $420 tires_vulnerability 1
Car.SetImmunities($420, 1, 1, 1, 1, 1)
wait 0
Car.DoorStatus($420) = 0
02D4: car $420 turn_off_engine


also, this check don't work:
QUOTE
00DB:   actor $PLAYER_ACTOR in_car $420


3. you have to remove reference of $421 (trailer) at any case
add a cleanup part and add there also the truck's Car.RemoveReferences
then can you spawn truck and trailer again

4. these checks for the the ramp rotaion don't work:
QUOTE
if and
0AB0: key pressed 116
$11440 = 0.0//  <--------- must have 2 Equals signs to work as condition
jf @SEMIKITT_900

must have 2 Equals signs to work as condition
CODE
if
$11440 == 0.0


this declares the var:
CODE
$11440 = -110.0


5. you can write it more slim
CODE
{$CLEO .cs}

//-------------MAIN---------------
thread 'SEMIKITT'

:SEMIKITT_19
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_19
if
  Actor.DrivingVehicleType($PLAYER_ACTOR, #BFINJECT)
jf @SEMIKITT_19
03C0: 25@ = actor $PLAYER_ACTOR car
if
 $ONMISSION == 0
jf @SEMIKITT_19
if
0AB0:   key_pressed 118
jf @SEMIKITT_19
Model.Load(#RDTRAIN)
Model.Load(#WMYMECH)
Model.Load(#ARTICT1)
Model.Load(19007)
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -10.0 5.0 0.2

:SEMIKITT_148
wait 0
if and
  Model.Available(#RDTRAIN)
  Model.Available(#ARTICT1)
  Model.Available(#WMYMECH)
  Model.Available(19007)
jf @SEMIKITT_148
wait 0
0@ = Car.Create(#RDTRAIN, 11@, 12@, 13@)
13@ -= 50.0
1@ = Car.Create(#ARTICT1, 11@, 12@, 13@)
0893: put_trailer 1@ on_cab 0@
0129: 2@ = create_actor_pedtype 50 model #WMYMECH in_car 0@ driverseat
3@ = Marker.CreateAboveCar(0@)
Marker.SetColor(3@, 1)
053F: set_car 0@ tires_vulnerability 1
Car.SetImmunities(0@, 1, 1, 1, 1, 1)
053F: set_car 1@ tires_vulnerability 1
Car.SetImmunities(1@, 1, 1, 1, 1, 1)
wait 0
0633: AS_actor 2@ exit_car
Car.DoorStatus(0@) = 0
02D4: car 0@ turn_off_engine
wait 0
Car.DoorStatus(0@) = 0
Marker.Disable(3@)
Actor.RemoveReferences(2@)
15@ = 0.0
5@ = Object.Create(19007, 1833.36, -1995.45, 12.5)
Object.CollisionDetection(5@) = True
0681: attach_object 5@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 15@ 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_900
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @SEMIKITT_1300
if and
  not Car.Wrecked(1@)
  not Car.Wrecked(0@)
81F4:   not car 1@ flipped
0202:   actor $PLAYER_ACTOR near_car 1@ radius 80.0 80.0 flag 0
jf @SEMIKITT_1300
if or
044B:   actor $PLAYER_ACTOR on_foot
00DB:   actor $PLAYER_ACTOR in_car 0@
00DB:   actor $PLAYER_ACTOR in_car 25@
jf @SEMIKITT_900
if
0AB0: key pressed 8
jf @SEMIKITT_901
0683: attach_car 25@ to_car 1@ with_offset 0.0 -7.0 0.0 rotation 0.0 0.0 0.0
jump @SEMIKITT_902

:SEMIKITT_901
if
0AB0: key pressed 9
jf @SEMIKITT_902
0684: detach_car 25@ 0.0 0.0 0.0 collision_detection 0
jump @SEMIKITT_902

:SEMIKITT_902
if and
0AB0: key pressed 116
 15@ == 0.0
jf @SEMIKITT_903
15@ = -110.0
0681: attach_object 5@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 15@ 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_903
if and
0AB0: key pressed 117
 15@ == -110.0
jf @SEMIKITT_900
15@ = 0.0
0681: attach_object 5@ to_car 1@ with_offset -0.05 -10.56 -0.82 rotation 15@ 0.0 0.0
jump @SEMIKITT_900

:SEMIKITT_1300
Car.RemoveReferences(0@)
Car.RemoveReferences(1@)
jump @SEMIKITT_19  

Yeah, I was just so excited yesterday that the script worked, but yeah I am gonna tweak it and re tweak it. Baby steps ZAZ, baby steps lol. Thanks still for everything. smile.gif
I am going to work on it more and when I reach beta stage 2 I might post it here, lol just so happy I have a base to work with.

Thanks, Bests
Bondlover1313 smile.gif

MRobinson
  • MRobinson

    Secret Agent

  • Members
  • Joined: 05 Jul 2012

#585

Posted 30 March 2013 - 11:32 AM

Hey Zaz im back! LOL SORRY TO ASK SOMETHING AGAIN! tounge2.gif

I wish to ask where we find the walk styles? the opcode..
0245: set_actor $ACTOR_SMOKE walk_style_to "FATMAN"
in my opinion can set walkstyles of any actor in anyway.

My code in middle is something like this..

CODE
0245: set_actor 12@ walk_style_to "GunMove_FWD" \\ as in ped.ifp zaz
07CD: AS_actor 12@ walk_to 1@ 2@ 3@ stop_with_angle 0.0 within_radius 0.5


I found the walk style in ped.ifp, if its not a walk style.. then what the hell is a walk style?! If it is.. whenever I test my script, all works fine in the script until when it comes to the point of moving actor 12@ to 1@ 2@ 3@... the game crashes then.
Please Help. sleepy.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#586

Posted 31 March 2013 - 05:25 AM

QUOTE (MRobinson @ Saturday, Mar 30 2013, 12:32)
I wish to ask where we find the walk styles? the opcode..

find it by trail and error, based on these animations of ped.ifp
WALK_armed
WALK_civi
WALK_csaw
Walk_DoorPartial
WALK_drunk
WALK_fat
WALK_fatold
WALK_gang1
WALK_gang2
WALK_old
WALK_player
WALK_rocket
WALK_shuffle
WALK_start
WALK_start_armed
WALK_start_csaw
WALK_start_rocket
Walk_Wuzi
WOMAN_walkbusy
WOMAN_walkfatold
WOMAN_walknorm
WOMAN_walkold
WOMAN_walkpro
WOMAN_walksexy
WOMAN_walkshop

MRobinson
  • MRobinson

    Secret Agent

  • Members
  • Joined: 05 Jul 2012

#587

Posted 31 March 2013 - 08:04 AM

QUOTE (ZAZ @ Sunday, Mar 31 2013, 10:55)
QUOTE (MRobinson @ Saturday, Mar 30 2013, 12:32)
I wish to ask where we find the walk styles? the opcode..

find it by trail and error, based on these animations of ped.ifp
WALK_armed
WALK_civi
WALK_csaw
Walk_DoorPartial
WALK_drunk
WALK_fat
WALK_fatold
WALK_gang1
WALK_gang2
WALK_old
WALK_player
WALK_rocket
WALK_shuffle
WALK_start
WALK_start_armed
WALK_start_csaw
WALK_start_rocket
Walk_Wuzi
WOMAN_walkbusy
WOMAN_walkfatold
WOMAN_walknorm
WOMAN_walkold
WOMAN_walkpro
WOMAN_walksexy
WOMAN_walkshop

You mean I got to use only opcode 07CD and just add armed or walk pro or whatever in the code like this.. and try all one by one bro?

07CD: AS_actor 80@ walk_Wuzi_to 362.2674 -2035.844 6.836 stop_with_angle 270.0 within_radius 4.0

???

or you mean walking style change one by one like this...

0245: set_actor $ACTOR_SMOKE walk_style_to "walkold"

???

By the way I want the walkstyle for actor pointing the gun in front and moving to 1@ 2@ 3@ as I told you ZAZ, sorry but I didn't get you completely.. whatsthat.gif


Silent
  • Silent

    Moderating Cookie Monster

  • Members
  • Joined: 01 Feb 2010
  • Poland

#588

Posted 31 March 2013 - 09:33 PM

Use animgrp.dat names for walkstyles. Simple as that tounge.gif

MRobinson
  • MRobinson

    Secret Agent

  • Members
  • Joined: 05 Jul 2012

#589

Posted 01 April 2013 - 07:59 AM Edited by MRobinson, 02 April 2013 - 11:28 AM.

QUOTE (SilentPL @ Monday, Apr 1 2013, 03:03)
Use animgrp.dat names for walkstyles. Simple as that tounge.gif

swat_run
Thats what I wanted to use bro, Can you guyz help me with the code I asked? which one of the 2 opcodes?

EDIT: Leave the previous one if you do not know ZAZ, just ignore it, I also want to ask how to prevent the pay'n'spray door from shutting..? Seems I won't have a reply for a long time now... sad.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#590

Posted 02 April 2013 - 03:38 PM

use opcode search tool and search for garage

MRobinson
  • MRobinson

    Secret Agent

  • Members
  • Joined: 05 Jul 2012

#591

Posted 03 April 2013 - 09:32 AM

QUOTE (ZAZ @ Tuesday, Apr 2 2013, 21:08)
use opcode search tool and search for garage

LoL!! Thanks I was searching for "pay" in the search tool. Done. Sorry for the nooby question..



AmaZinG_ToXiN974
  • AmaZinG_ToXiN974

    Player Hater

  • Members
  • Joined: 12 Apr 2013

#592

Posted 12 April 2013 - 06:03 PM Edited by AmaZinG_ToXiN974, 12 April 2013 - 06:09 PM.

Hi everybody, i'm new on GtaForums. I'm not experienced at all in Cleo Scripts and i wanted to know how to use this code :

0503: create_actor_on_rope_with_pedtype ( here the code doesn't have his parameters )

here is an exemple of this code in a scripts :

"0503: create_actor_on_rope_with_pedtype 8 model #NULL at 2@ 3@ 4@ handle_as 9@"

So if someone could explain me how does this code work and what are the parameters ect... biggrin.gif (with simple words if possible because i'm french ).
My idea is to do a script like that, i'll write the "script" with simple sentences :

>Check if player is on foot (player must be on foot)
>Then if press a key
>He use a rope (and rope animation so player can't move) and when if he reach the ground or fall in water, the rope disappear and the player can move.

Thank you, i know that i ask you to do the script for me but if you could explain ( just explain if you don't want to script for me biggrin.gif ) how does
this code work, it could be fine. I want to learn, and i think i have to talk about that with english people. thanks again.

ZAZ
  • ZAZ

    Kernlochbohrer

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

#593

Posted 12 April 2013 - 07:11 PM

QUOTE (AmaZinG_ToXiN974 @ Friday, Apr 12 2013, 19:03)
Hi everybody, i'm new on GtaForums. I'm not experienced at all in Cleo Scripts and i wanted to know how to use this code :

0503: create_actor_on_rope_with_pedtype ( here the code doesn't have his parameters )

here is an exemple of this code in a scripts :

"0503: create_actor_on_rope_with_pedtype 8 model #NULL at 2@ 3@ 4@ handle_as 9@"

So if someone could explain me how does this code work and what are the parameters ect...  biggrin.gif (with simple words if possible because i'm french ).
My idea is to do a script like that, i'll write the "script" with simple sentences :

>Check if player is on foot (player must be on foot)
>Then if press a key
>He use a rope (and rope animation so player can't move) and when if he reach the ground or fall in water, the rope disappear and the player can move.

Thank you, i know that i ask you to do the script for me but if you could explain ( just explain if you don't want to script for me  biggrin.gif ) how does
this code work, it could be fine. I want to learn, and i think i have to talk about that with english people. thanks again.


The code creates a new actor on a rope, like the swat when coming down from police helicopter, at specified position
You posted this code with variables as specified position
You could first determine these variables with coords
CODE

2@ = 2485.22
3@ =  -1672.941
4@ = 13.73
0503: create_actor_on_rope_with_pedtype 8 model #NULL at 2@ 3@ 4@ handle_as 9@
then the actor will be created at Grovestreet

or insert the coords directly in the code
CODE
0503: create_actor_on_rope_with_pedtype 8 model #NULL at 2485.22 -1672.941 13.73 handle_as 9@
the actor will be model NULL, which will be a copy of the Player_actor

To let a swat model appear on rope needs to insert the swat model name
CODE
0503: create_actor_on_rope_with_pedtype 8 model #SWAT at 2485.22 -1672.941 13.73 handle_as 9@

look also for the opcode description at gtag.gtagaming.com/opcode-database/opcode/0503/

How to write a script to can use the code? ..... you have to learn the basics
Study the tutorial careful from beginning and learn coding by writing small and simple scripts.
Test the example scripts, modify them a little bit, expand them a little bit,
important is, that you gain practice
After the 4. chapter should you be able to to spawn an actor with weapon to kill player_actor

AmaZinG_ToXiN974
  • AmaZinG_ToXiN974

    Player Hater

  • Members
  • Joined: 12 Apr 2013

#594

Posted 13 April 2013 - 03:10 PM

Okay thanks! I'll continue reading your tutorial.

Decoi
  • Decoi

    Player Hater

  • Members
  • Joined: 14 Apr 2013

#595

Posted 14 April 2013 - 11:16 AM

Need help my .cs file keeps crashing because it keeps else_jump instead of jf here is the code by the way I am new but been experimenting please help.

CODE
// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
0662: NOP "SYSTEMFV12"
wait 0
thread "NONAME"
03F0: enable_text_draw 1

:NONAME_32
wait 0
04DD: 2@ = actor $PLAYER_ACTOR armour
03E4: enable_text_draw_align_right 1
033F: set_text_draw_letter_size 0.3 1.1
081C: draw_text_outline 1 RGBA 0 0 0 255
045A: draw_text_1number 538.0 37.5 GXT 'NUMBER' number 2@  // ~1~
if
  not 2@ >= 250
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 114 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 155
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 115 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 150
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 116 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 145
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 117 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 331
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 118 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 135
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 119 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 130
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 120 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 125
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 121 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 120
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 122 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 115
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 123 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 110
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 124 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 105
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 125 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 100
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 126 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 95
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 127 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 90
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 128 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 85
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 129 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 80
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 130 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 75
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 131 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 70
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 132 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 65
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 133 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 60
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 134 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 55
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 135 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 50
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 136 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 45
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 137 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 40
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 138 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 35
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 139 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 30
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 140 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 25
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 141 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 20
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 142 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 15
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 143 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 10
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 144 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 5
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 145 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 2@ >= 2
else_jump @NONAME_32
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 146 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @NONAME_32

ZAZ
  • ZAZ

    Kernlochbohrer

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

#596

Posted 14 April 2013 - 06:16 PM

QUOTE (Decoi @ Sunday, Apr 14 2013, 12:16)
Need help my .cs file keeps crashing because it keeps else_jump instead of jf here is the code by the way I am new but been experimenting please help.

else_jump works as well as jf

the textur load is missing
have a look to the example below
CODE
{$CLEO .cs}
:TXD_1
03A4: name_thread "TXD"
wait 2000

:TXD_2
wait 0
if
0256: player $PLAYER_CHAR defined
jf @TXD_2
0390: load_txd_dictionary "ld_bum"
038F: load_texture "bum2" as 1 // Load dictionary with 0390 first  

:TXD_3
wait 0
if
0256: player $PLAYER_CHAR defined
else_jump @TXD_2
03F0: enable_text_draw 1
038D: draw_texture 1 position 150.0 130.0 size 180.5 210.0 RGBA 255 255 255 255
jump @TXD_3

Decoi
  • Decoi

    Player Hater

  • Members
  • Joined: 14 Apr 2013

#597

Posted 14 April 2013 - 08:42 PM Edited by Decoi, 14 April 2013 - 08:53 PM.

I got it working thanks for the reply, all the textures are loaded in another script, here is what I did oh and I tried like halving a picture and when I put the txd file back to the txd folder and loaded the game and the picture was just a white box why is that?

CODE

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
0662: NOP "SYSTEMFV12"
wait 0
thread "TXD"
03F0: enable_text_draw 1

:TXD_29
wait 0
if
  Player.Defined($PLAYER_CHAR)
else_jump @TXD_29
0390: load_txd_dictionary "ARM"
038F: load_texture "RADAR" as 124 // Load dictionary with 0390 first

:TXD_67
wait 0
038D: draw_texture 124 position 9999.0 363.5 size 137.0 113.0 RGBA 255 255 255 255
04DD: 1@ = actor $PLAYER_ACTOR armour
if
  not 1@ >= 190
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 93 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 95
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 94 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 90
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 95 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 85
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 96 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 80
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 97 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 75
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 98 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 70
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 99 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 65
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 100 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 60
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 101 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 55
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 102 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 50
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 103 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 45
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 104 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 40
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 105 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 35
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 106 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 30
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 107 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 25
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 108 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 20
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 109 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 15
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 110 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 10
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 111 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
  not 1@ >= 5
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 112 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
if
 1@ > 1
else_jump @TXD_67
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 113 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

ZAZ
  • ZAZ

    Kernlochbohrer

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

#598

Posted 15 April 2013 - 07:21 PM

QUOTE (Decoi @ Sunday, Apr 14 2013, 21:42)
I got it working thanks for the reply, all the textures are loaded in another script, here is what I did oh and I tried like halving a picture and when I put the txd file back to the txd folder and loaded the game and the picture was just a white box why is that?

The game draws a white field if it should load a texture which not exist.
Or it happens also for users which have more than one mod running which draws textures, for example a speedometer and any other texture mod...
... and because the other mod ends with this code: 0391: release_txd_dictionary
... but the speedometer is still running and it's texture is deloaded then

btw. your script is not good because it overlays all the the textures as smaller the armour is
for example, if the armour is 10, then the game draws the texture 93 and over that the texture 94 and over that the texture 95 and over that the texture 96 and over that the texture 97 and over that the texture 98 and over that the texture 99 and over that the texture 100 and so on..... 20 textures overlayed to each other
That's a waste of performance

Would be better to do it in this way:
CODE
:TXD_67
wait 0
038D: draw_texture 124 position 9999.0 363.5 size 137.0 113.0 RGBA 255 255 255 255
04DD: 1@ = actor $PLAYER_ACTOR armour
if
 not 1@ >= 190
else_jump @TXD_67
if
1@ > 90
jf @TXD_68
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 93 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_68
if
1@ > 85
jf @TXD_69
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 94 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_69
if
1@ > 80
jf @TXD_70
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 95 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_70
if
1@ > 75
jf @TXD_71
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 96 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_71
if
1@ > 70
jf @TXD_and_so_on
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 97 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

then it draws only the one texture which fits the armour value

Decoi
  • Decoi

    Player Hater

  • Members
  • Joined: 14 Apr 2013

#599

Posted 15 April 2013 - 09:02 PM Edited by Decoi, 16 April 2013 - 11:34 AM.

QUOTE (ZAZ @ Monday, Apr 15 2013, 19:21)
QUOTE (Decoi @ Sunday, Apr 14 2013, 21:42)
I got it working thanks for the reply, all the textures are loaded in another script, here is what I did oh and I tried like halving a picture and when I put the txd file back to the txd folder and loaded the game and the picture was just a white box why is that?

The game draws a white field if it should load a texture which not exist.
Or it happens also for users which have more than one mod running which draws textures, for example a speedometer and any other texture mod...
... and because the other mod ends with this code: 0391: release_txd_dictionary
... but the speedometer is still running and it's texture is deloaded then

btw. your script is not good because it overlays all the the textures as smaller the armour is
for example, if the armour is 10, then the game draws the texture 93 and over that the texture 94 and over that the texture 95 and over that the texture 96 and over that the texture 97 and over that the texture 98 and over that the texture 99 and over that the texture 100 and so on..... 20 textures overlayed to each other
That's a waste of performance

Would be better to do it in this way:
CODE
:TXD_67
wait 0
038D: draw_texture 124 position 9999.0 363.5 size 137.0 113.0 RGBA 255 255 255 255
04DD: 1@ = actor $PLAYER_ACTOR armour
if
 not 1@ >= 190
else_jump @TXD_67
if
1@ > 90
jf @TXD_68
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 93 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_68
if
1@ > 85
jf @TXD_69
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 94 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_69
if
1@ > 80
jf @TXD_70
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 95 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_70
if
1@ > 75
jf @TXD_71
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 96 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

:TXD_71
if
1@ > 70
jf @TXD_and_so_on
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 97 position 538.0 46.0 size 45.0 80.0 RGBA 255 255 255 255
jump @TXD_67

then it draws only the one texture which fits the armour value

Ok thanks ZAZ I sorted everything it all works, I see it would be more efficient to do that way is there any possibility it could go wrong the way I did it?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#600

Posted 16 April 2013 - 10:24 PM

not wrong, just bad




5 user(s) are reading this topic

1 members, 4 guests, 0 anonymous users