jackusCTB Posted September 9, 2012 Share Posted September 9, 2012 I'm such a noob in cleo scripting, but I'm trying to write a cleo script which when you press "W" the hydra thrust is automatically set to horizontal. that's the 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 'NOVTOL' wait 0 if Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)03C0: [email protected] = actor $PLAYER_ACTOR car if 00E1: player 0 pressed_key 16 not Car.Wrecked([email protected])if [email protected] == 0 0745: set_hydra [email protected] thrust_to_horizontal As soon as i press "new game", the game crashes. i also want to add the function that when you press "~k~~VEHICLE_TURRETDOWN~", instead of going vertical, the thrust goes horizontal. i was thinking to: wait 000E1 player 0 pressed_key 300745: set_hydra [email protected] thrust_to_horizontal i appreciate every correction and.. thanks Link to comment Share on other sites More sharing options...
Bad.boy! Posted September 9, 2012 Share Posted September 9, 2012 Read a tutorial. And it isn't a good idea either, if you get into a hydra you can't take off vertical any more, this makes the hydra mission impossible. Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 c'mon dude, be more constructive... Link to comment Share on other sites More sharing options...
TheGodfather. Posted September 9, 2012 Share Posted September 9, 2012 // 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 'NOVTOL':NEW_1wait 0if Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)03C0: [email protected] = actor $PLAYER_ACTOR carif00E1: player 0 pressed_key 16 not Car.Wrecked([email protected]):NEW0745: set_hydra [email protected] thrust_to_horizontal jump @:NEW_1 I don't know whether it will work or not because I haven't got the time to check just have a look whether it works or not. Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 hey dude, thanks again there's an error in the last line: jump @:NEW_1 -should be-> jump @NEW_1, btw it doesn't work Link to comment Share on other sites More sharing options...
Jack Posted September 9, 2012 Share Posted September 9, 2012 Why do you want to build a scrypt for this stuff when there are controls that can do it? Here's your code: {$CLEO }0000: NOPwhile true repeat wait 250 until 0256: player $PLAYER_CHAR defined while true wait 1000 if and 00DD: actor $PLAYER_ACTOR driving_car_with_model #HYDRA 00E1: player 0 pressed_key 17 then 03C0: [email protected] = actor $PLAYER_ACTOR car 0745: set_hydra [email protected] thrust_to_horizontal if 8256: not player $PLAYER_CHAR defined then break end end endend Sorry about the high level code. if you don't like it then convert it to low with SB. Press and hold fire to activate hydra horizontal. Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 thanks man, the high code won't be a problem.... i think by the way, i forgot to say if you could add the function that when you're trying to change hydra's thrust from horizontal to vertical, you cant Link to comment Share on other sites More sharing options...
Jack Posted September 9, 2012 Share Posted September 9, 2012 It looks like that there's no opcode that can do the opposite then 0745. I think you already know this but there's a control for forcing hydra to thrust vertical slowly. Other then that I don't know. Try searching the memory findings for gta sa in III other section, maybe you find something. Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
Link2012 Posted September 9, 2012 Share Posted September 9, 2012 Assuming that hydra handle is at [email protected], loop this code and the hydra will always be thrusting horizontal. 0A97: [email protected] = get_car_struct [email protected]: [email protected] += 0x86C0A8C: write_memory [email protected] size 2 val 0 vp 0 aldrinjohnom 1 Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 @Link2012, as you said, I compiled your code into cleo and I got this: // 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---------------0000: NOP :NONAME_20A97: [email protected] = car [email protected] struct [email protected] += 2156 0A8C: write_memory [email protected] size 2 value 0 virtual_protect 0 jump @NONAME_2 But as soon as the menu (Start Game, Option and Exit) appears, the game crashes. correct me if i'm wrong. ----- @JACK JONES nope, you've misunderstood. i meant that when you press the key to change hydra's thrust FROM horizontal TO vertical, you can't. basically the hydra's thrust, also if you want to change it's direction, you cant. do you get my point? Link to comment Share on other sites More sharing options...
Link2012 Posted September 9, 2012 Share Posted September 9, 2012 Look what I said Assuming that hydra handle is at [email protected] [email protected] in your code is nothing, you must have the hydra created and it's handle at [email protected] to make the code to work. Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 yep, you're right. sorry i have a lot of to learn but how can i find my hydra handle and a question: what are these number that come before @, for example "[email protected]". are they variables? Link to comment Share on other sites More sharing options...
Link2012 Posted September 9, 2012 Share Posted September 9, 2012 Yes, they are variables, Did you come from another programming language? Anyway read a tutorial because this language syntax is very uncommon. You can get the handle in several ways, I will list some of these ways 1. Creating a new vehicle, you will get as result the vehicle handle e.g: 00A5: [email protected] = create_car #PONY at 0.0 0.0 0.0 [email protected] Now has the recently created pony handle. 2. Getting player vehicle Like what JACK_JONES did in his code. If player was driving a hydra then it gets the player vehicle handle with 03C0: [email protected] = actor $PLAYER_ACTOR car 3. Others... Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 so, in your first code there is one variable, [email protected] now, for the hydra handling, should i use [email protected] or [email protected]? Link to comment Share on other sites More sharing options...
Link2012 Posted September 9, 2012 Share Posted September 9, 2012 It's up to you. But you should know that one variables can't store more than one information: e.g.: If u have vehicle handle in [email protected] and replace the value at [email protected] to do some calculation, You lost the hydra handle. Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 (edited) all right. may i know where did you learn scripting with cleo and especially the variables things? anyway no, i don't come from any programming language, unfortunately Edited September 9, 2012 by jackusCTB Link to comment Share on other sites More sharing options...
Link2012 Posted September 9, 2012 Share Posted September 9, 2012 Begin reading ZaZ's tutorial: http://www.gtaforums.com/index.php?showtopic=403594 Then, your next base for informations of "how was it done?" is the main.scm, decompile it and see how R* did something in a mission. You can also learn from other people code, if the source code for the script is available it's better, if not you have to decompile the script. Read also the Sanny Builder help (F12). The rest you will discover logically and naturally. Link to comment Share on other sites More sharing options...
jackusCTB Posted September 9, 2012 Author Share Posted September 9, 2012 thanks =) Link to comment Share on other sites More sharing options...
jackusCTB Posted September 10, 2012 Author Share Posted September 10, 2012 (edited) @JACK JONES: Finally I did what I wanted to do. If it's helpful for someone, especially if you don't use a S/VTOL aircraft but you use a standare plane, like the A-10 Thunderbolt II <3, this script might be useful. Here's your edited code by me: // 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---------------0000: NOP :NONAME_2wait 250 Player.Defined($PLAYER_CHAR)jf @NONAME_2 :NONAME_19wait 0 if and Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)00E1: player 0 pressed_key 16 jf @NONAME_84 03C0: [email protected] = actor $PLAYER_ACTOR car 0745: set_hydra [email protected] thrust_to_horizontal if not Player.Defined($PLAYER_CHAR)jf @NONAME_84 jump @NONAME_129 :NONAME_84if and Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)00E1: player 0 pressed_key 3 jf @NONAME_19 03C0: [email protected] = actor $PLAYER_ACTOR car 0745: set_hydra [email protected] thrust_to_horizontal jump @NONAME_19 :NONAME_129jump @NONAME_2 Edited September 10, 2012 by jackusCTB Link to comment Share on other sites More sharing options...
Jack Posted September 10, 2012 Share Posted September 10, 2012 By looking into the address found by Link2012 I made you a new code that alow to quckly change horizontal and vertical seeting of the hydra by pressing 2 diferent buttons (I did that because with your code the plane can never fly vertical so if you are in the middle of some buildings the hydra won't be able to get out). So here's the code: {$CLEO}0000: NOPwhile true wait 250 if and 0256: player $PLAYER_CHAR defined 00DD: actor $PLAYER_ACTOR driving_car_with_model #HYDRA thenbreak endendwhile truewait 0 while true wait 0 03C0: [email protected] = actor $PLAYER_ACTOR car 0A97: [email protected] = get_car_struct [email protected] 000A: [email protected] += 0x86C if and 00DD: actor $PLAYER_ACTOR driving_car_with_model #HYDRA 00E1: player 0 pressed_key 1 // press stear up to change to fast horizontal (better be very high in the air) then 0A8C: write_memory [email protected] size 4 value 0 virtual_protect 0 // hydra is now horizontal break end end while true wait 0 03C0: [email protected] = actor $PLAYER_ACTOR car 0A97: [email protected] = get_car_struct [email protected] 000A: [email protected] += 0x86C if and 00DD: actor $PLAYER_ACTOR driving_car_with_model #HYDRA 00E1: player 0 pressed_key 6 // press hendbrake if you want fast hydra vertical seeting then 0A8C: write_memory [email protected] size 4 value 5000 virtual_protect 0 // hydra thrusts vertical now break end endend You could change the buttons as you like. Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
jackusCTB Posted September 10, 2012 Author Share Posted September 10, 2012 again, thanks you're very skilled. That has nothing to do with the script but is there a way to make the Sparrow able to shoot unguided rockets like the hunter? thanks again. Link to comment Share on other sites More sharing options...
Jack Posted September 10, 2012 Share Posted September 10, 2012 Well there are 2 ways for that: 1) to find the address that contain the IDE of a car which have the ability to fire hunter projectiles and then write sparrow value in it, 2) to put 2 invisible actors on the places you want the projectiles to be fired. Number 1 way would be the best but I don't have that address. Try the mem documentation in III other. Number 2 way recquire building a little complicated code (start reading the opcode database). Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now