Jump to content

Engine ON


MatiSk8

Recommended Posts

I have a problem. I making a turn off and turn on engine script. I have a code, when player press key "I" engine is off, but I can't find turn on engine opcode. If it's exist?

Link to comment
Share on other sites

It's the same opcode. Use 1 to turn it on , 0 to turn it off.

 

That might be reversed; can't remember off the top of my head.

Link to comment
Share on other sites

Maybe yes, but my code doesn't work.

 

 

{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------0000: NOP:ENGINEthread 'ENGINE':petla1wait 10if 0449:   actor $PLAYER_ACTOR in_a_car jf @petla1 03C0: $CAR_ENGINE = actor $PLAYER_ACTOR car:petla2wait 10if 0AB0: key_pressed 0x49jf @petla2081D: set_car $CAR_ENGINE engine_operation 1wait 1000:petla3wait 10if 0AB0: key_pressed 0x49jf @petla3081D: set_car $CAR_ENGINE engine_operation 0 wait 1000jump @petla10A93: end_custom_thread

 

 

When player actor in car and press "I", engine is turn off, but when I want turn on and press "I" engine isn't turn on.

 

PS: Sorry for my bad english.

Link to comment
Share on other sites

Because you need a way to tell the game if the player pressed a key AND the engine is on.

 

I would add a switch to check if the engine was turned on (or off), then do the opposite.

 

Something like

 

Check:

if key pressed blah and Engine == 1

set engine off

set var Engine = 0

 

Check2:

if key press blah and Engine == 0

set engine on

set var Engine = 1

 

etc.

 

Have a look at the main code for examples on using a variable set to 0 or 1 to control actions in a script.

Link to comment
Share on other sites

You must exit and enter again the vihicle to make engine on

 

switch engine on

remove player from car

wait a half second

put player in car

Edited by ZAZ
Link to comment
Share on other sites

You must exit and enter again the vihicle to make engine on

 

switch engine on

remove player from car

wait a half second

put player in car

Not true, you do NOT have to remove the player/actor from a vehicle to turn the engine back on.

Link to comment
Share on other sites

 

You must exit and enter again the vihicle to make engine on

 

switch engine on

remove player from car

wait a half second

put player in car

Not true, you do NOT have to remove the player/actor from a vehicle to turn the engine back on.

No? Other way?

But you confirm that the car wont start the engine on simple way after turn off ?

Link to comment
Share on other sites

That's what the 'if key press blah and Engine == 0' check is for. It will detect the engine state and then read on to see what to do with it.

 

I know there's an engine on/off mod already that works without exiting the car. Unfortunately it freezes all controls and the driven wheels as soon as you switch the engine off.

Link to comment
Share on other sites

 

That's what the 'if key press blah and Engine == 0' check is for.  It will detect the engine state and then read on to see what to do with it.

 

I know there's an engine on/off mod already that works without exiting the car.  Unfortunately it freezes all controls and the driven wheels as soon as you switch the engine off.

However

I made a little test cleoscript which display the engine operation

if I turn off and then turn on the engine again there is no smoke at the exhaust and car wont drive

if I exit then and enter again the car its possible to drive and smoke appears

 

 

{$CLEO .cs}:Engine0003A4: name_thread 'HVY'0006: 1@ =  0  // integer values03F0: text_draw_toggle  10001: wait  50 ms03F0: text_draw_toggle  00001: wait  50 ms045A: text_draw_1number  450.0  20.0 'NUMBER' 1@    // value0001: wait 1000 ms:Engine10001: wait 0 ms 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @Engine1 if  and00DF:  actor $PLAYER_ACTOR driving0AB0:   key_pressed 34//--------------------------Page down  004D: jump_if_false @Engine10006: 1@ =  1  // integer values03C0: 0@ = actor $PLAYER_ACTOR car081D: set_car 0@ engine_operation 1@ 03F0: text_draw_toggle  10001: wait  50 ms03F0: text_draw_toggle  00001: wait  50 ms045A: text_draw_1number  450.0  20.0 'NUMBER' 1@    // value0001: wait 1000 ms0002: jump @Engine2:Engine20001: wait 0 ms 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @Engine5 00D6: if  18119:   NOT   car 0@ wrecked 00DF:  actor $PLAYER_ACTOR driving  004D: jump_if_false @Engine5if0AB0:   key_pressed 34//--------------------------Page down  004D: jump_if_false @Engine30006: 1@ =  1  // integer values081D: set_car 0@ engine_operation 1@ 0002: jump @Engine4:Engine3if0AB0:   key_pressed 33//--------------------------Page up  004D: jump_if_false @Engine20006: 1@ =  0  // integer values081D: set_car 0@ engine_operation 1@:Engine403F0: text_draw_toggle  10001: wait  50 ms03F0: text_draw_toggle  00001: wait  50 ms045A: text_draw_1number  450.0  20.0 'NUMBER' 1@    // value0001: wait 1000 ms0002: jump @Engine2:Engine501C3: remove_references_to_car 0@  // Like turning a car into any random car03F0: text_draw_toggle  10001: wait  50 ms03F0: text_draw_toggle  00001: wait  50 ms045A: text_draw_1number  450.0  20.0 'NUMBER' 1@    // value0001: wait 1000 ms0002: jump @Engine1

 

Link to comment
Share on other sites

I don't know what you guys are doing, but as I said, it works as advertised. Wheels turn fine too. This IS with my hook, but these are straight opcodes, no memory hacking.

 

 

Link to comment
Share on other sites

 

I don't know what you guys are doing, but as I said, it works as advertised. Wheels turn fine too. This IS with my hook, but these are straight opcodes, no memory hacking.

 

lol, turning wheels is possible. Ok I can also see smoke from your exhaust.

And I dont know why you dont have the same phenomenon as we.

Maybe in main or Cleo it wont work like with hook.

Its really a fact that to turn the engine back on dont work.

If I let the car drive after turn one the smoke appears and engine sound is available but then it is also not possible to drive

 

0407: create_coordinate 4@ 2@ 3@ from_car 0@ offset 0.0 0.1 0.0

02C2: car 0@ drive_to_point 4@ 2@ 3@

00AD: set_car 0@ max_speed_to 50.0

Link to comment
Share on other sites

 

If I let the car drive after turn one the smoke appears and engine sound is available but then it is also not possible to drive

 

0407: create_coordinate 4@ 2@ 3@ from_car 0@ offset  0.0  0.1  0.0

02C2: car 0@ drive_to_point 4@ 2@ 3@

00AD: set_car 0@ max_speed_to  50.0

No, that's always been like that; if you set the car to drive somewhere with the player in it, you will not be able to control it. Same with VC; you have to leave the car (enter/exit) to regain player control of the vehicle. But turning the engine on/off should have nothing to do with that.

 

I'll see if I can whip up a short main later today and test it out.

Link to comment
Share on other sites

 

If I let the car drive after turn one the smoke appears and engine sound is available but then it is also not possible to drive

 

0407: create_coordinate 4@ 2@ 3@ from_car 0@ offset  0.0  0.1  0.0

02C2: car 0@ drive_to_point 4@ 2@ 3@

00AD: set_car 0@ max_speed_to  50.0

No, that's always been like that; if you set the car to drive somewhere with the player in it, you will not be able to control it. Same with VC; you have to leave the car (enter/exit) to regain player control of the vehicle.

Yes, thats what I mean with "it is also not possible to drive"

 

But turning the engine on/off should have nothing to do with that.

I know, I wanted to describe that in this case the engine sound and smoke will be available

 

I'll see if I can whip up a short main later today and test it out.

Yeh, do it.

Link to comment
Share on other sites

I don't know what you guys are doing, but as I said, it works as advertised. Wheels turn fine too. This IS with my hook, but these are straight opcodes, no memory hacking.

 

 

and i must have some hook installed to it work ??

 

but i try with this checks in the cleo who you said but i can't compile it;)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.