IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


Pages: (2) [1] 2   ( Go to first unread post ) Reply to this topicStart new topicStart Poll

 Help with a Cleo mod

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 10:12
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



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
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: 0@ = actor $PLAYER_ACTOR car
if
00E1:   player 0 pressed_key 16
  not Car.Wrecked(0@)
if
 6@ == 0
0745: set_hydra 0@ 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:
CODE

wait 0
00E1 player 0 pressed_key 3
00745: set_hydra 0@ thrust_to_horizontal

i appreciate every correction and.. thanks
PM
  Top
 

 
Bad.boy!  
Posted: Sunday, Sep 9 2012, 10:44
Quote Post


SA modder
Group Icon
Group: Members
Joined: Jun 20, 2010

nl.gif

XXXXX



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.
PM
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 13:30
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



c'mon dude, be more constructive...
PM
  Top
 

 
arijitsen  
Posted: Sunday, Sep 9 2012, 13:37
Quote Post


Modder,Gamer & GFX Artist
Group Icon
Group: Members
Joined: Jun 19, 2012

ia.gif

XXXXX



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'
:NEW_1
wait 0
if
 Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)
03C0: 0@ = actor $PLAYER_ACTOR car
if
00E1:   player 0 pressed_key 16
 not Car.Wrecked(0@)
:NEW
0745: set_hydra 0@ 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.
Users WebsitePM
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 13:59
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



hey dude, thanks again smile.gif there's an error in the last line: jump @:NEW_1 -should be-> jump @NEW_1, btw it doesn't work sad.gif
PM
  Top
 

 
JACK JONES  
Posted: Sunday, Sep 9 2012, 15:00
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



Why do you want to build a scrypt for this stuff when there are controls that can do it? Here's your code:
CODE
{$CLEO }
0000: NOP

while 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: 0@ = actor $PLAYER_ACTOR car  
               0745: set_hydra 0@ thrust_to_horizontal
               if
                      8256:   not   player $PLAYER_CHAR defined
               then
       break
               end
           end
       end
end

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.
PM
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 15:04
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



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
PM
  Top
 

 
JACK JONES  
Posted: Sunday, Sep 9 2012, 19:05
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



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.
PM
  Top
 

 
Link2012  
Posted: Sunday, Sep 9 2012, 19:46
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



Assuming that hydra handle is at 20@, loop this code and the hydra will always be thrusting horizontal.
CODE
0A97: 0@ = get_car_struct 20@
000A: 0@ += 0x86C
0A8C: write_memory 0@ size 2 val 0 vp 0
PMMSN
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 21:02
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



@Link2012, as you said, I compiled your code into cleo and I got this:
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---------------
0000: NOP

:NONAME_2
0A97: 0@ = car 20@ struct
0@ += 2156
0A8C: write_memory 0@ 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?
PM
  Top
 

 
Link2012  
Posted: Sunday, Sep 9 2012, 21:07
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



Look what I said
QUOTE
Assuming that hydra handle is at 20@

20@ in your code is nothing, you must have the hydra created and it's handle at 20@ to make the code to work.
PMMSN
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 21:28
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



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 "20@". are they variables?
PM
  Top
 

 
Link2012  
Posted: Sunday, Sep 9 2012, 21:49
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



Yes, they are variables, Did you come from another programming language? tounge.gif
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:
CODE
00A5: 0@ = create_car #PONY at 0.0 0.0 0.0

0@ 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
CODE
03C0: 0@ = actor $PLAYER_ACTOR car


3. Others...
PMMSN
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 21:51
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



so, in your first code there is one variable, 0@. now, for the hydra handling, should i use 0@ or 1@?
PM
  Top
 

 
Link2012  
Posted: Sunday, Sep 9 2012, 21:54
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



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 0@ and replace the value at 0@ to do some calculation, You lost the hydra handle.
PMMSN
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 21:56
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



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 sad.gif

This post has been edited by jackusCTB on Sunday, Sep 9 2012, 22:00
PM
  Top
 

 
Link2012  
Posted: Sunday, Sep 9 2012, 22:02
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



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.
PMMSN
  Top
 

 
jackusCTB  
Posted: Sunday, Sep 9 2012, 22:04
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



thanks =)
PM
  Top
 

 
jackusCTB  
Posted: Monday, Sep 10 2012, 06:30
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Jun 29, 2012

eu.gif

XXXXX



@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:
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---------------
0000: NOP

:NONAME_2
wait 250
  Player.Defined($PLAYER_CHAR)
jf @NONAME_2

:NONAME_19
wait 0
if and
  Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)
00E1:   player 0 pressed_key 16
jf @NONAME_84
03C0: 0@ = actor $PLAYER_ACTOR car
0745: set_hydra 0@ thrust_to_horizontal
if
  not Player.Defined($PLAYER_CHAR)
jf @NONAME_84
jump @NONAME_129

:NONAME_84
if and
  Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA)
00E1:   player 0 pressed_key 3
jf @NONAME_19
03C0: 0@ = actor $PLAYER_ACTOR car
0745: set_hydra 0@ thrust_to_horizontal
jump @NONAME_19

:NONAME_129
jump @NONAME_2


This post has been edited by jackusCTB on Monday, Sep 10 2012, 06:38
PM
  Top
 

 
JACK JONES  
Posted: Monday, Sep 10 2012, 09:16
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



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:
CODE
{$CLEO}
0000: NOP

while true
   wait 250
   if and
       0256:   player $PLAYER_CHAR defined
       00DD:   actor $PLAYER_ACTOR driving_car_with_model #HYDRA
   then
break
   end
end

while true
wait 0
   while true
       wait 0
       03C0: 0@ = actor $PLAYER_ACTOR car
       0A97: 1@ = get_car_struct 0@
       000A: 1@ += 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 1@ size 4 value 0 virtual_protect 0  // hydra is now horizontal
   break
       end
   end

       while true
           wait 0
           03C0: 0@ = actor $PLAYER_ACTOR car
           0A97: 1@ = get_car_struct 0@
           000A: 1@ += 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 1@ size 4 value 5000 virtual_protect 0  // hydra thrusts vertical now
       break
           end
       end
end

You could change the buttons as you like.
PM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Pages: (2) [1] 2 

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG