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)


  Reply to this topicStart new topicStart Poll

 Magnet Crane

 
jemahuk1  
Posted: Sunday, Jul 29 2012, 13:35
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2009

XXXXX



I would like to experiment with magnet codes but there are some things I don't understand


CODE
:1
wait 0
if and
   Player.Defined($PLAYER_CHAR)
   00E1:   player 0 pressed_key 6            
jf @1
04C4: store_coords_to 4@ 5@ 6@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 4.0
1@ = Car.Create(#HUNTER, 4@, 5@, 6@)
099A: set_car 1@ collision_detection 0
0338: set_car 1@ visibility 0
02AC: set_car 1@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
0788: enable_heli 1@ magnet 1
33@ = 0.0

:2
wait 0
0224: set_car 1@ health_to 1000
if and
   00E1:   player 0 pressed_key 16            
   03CA:   object $CRANE_MAGNET exists
jf @3
0796: get_crane_magnet $CRANE_MAGNET magnet_lane_length_to 33@ // float
000B: 33@ += 0.1
0797: set_crane_magnet $CRANE_MAGNET magnet_lane_length_to 33@ // float
jump @2


:3
wait 0
0224: set_car 1@ health_to 1000
if and
   00E1:   player 0 pressed_key 14            
   03CA:   object $CRANE_MAGNET exists
jf @2
0796: get_crane_magnet $CRANE_MAGNET magnet_lane_length_to 33@ // float
000F: 33@ -= 0.1
0797: set_crane_magnet $CRANE_MAGNET magnet_lane_length_to 33@ // float
jump @3


This is my try, I wanna make a magnet that hangs in the air, then I would like to attach the player on the magnet, also can control the rope's length by pressing space and shift.
PM
  Top
 

 
jemahuk1  
Posted: Monday, Jul 30 2012, 14:07
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2009

XXXXX



Well, exactly I really want to know how to control the length of the magnet's rope that's all. dontgetit.gif
Please give me solution. smile.gif
PM
  Top
 

 
jemahuk1  
Posted: Saturday, Aug 4 2012, 12:20
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2009

XXXXX



Anyone? dontgetit.gif
PM
  Top
 

 
ZAZ  
Posted: Saturday, Aug 4 2012, 15:27
Quote Post


Kernlochbohrer
Group Icon
Group: Members
Joined: Jan 10, 2005

eu.gif

Member Award




QUOTE (jemahuk1 @ Saturday, Aug 4 2012, 13:20)
Anyone? dontgetit.gif

don't use 33@ for magnet_lane_length
33@ and 32@ are internal timer and overwrite permanent these loacal vars with timer values in millisecond
use locals from 0@ till 31@
Users WebsitePM
  Top
 

 
jemahuk1  
Posted: Sunday, Aug 5 2012, 04:10
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2009

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---------------
03A4: name_thread ''

:NONAME1_11
0001: wait 0 ms
02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 1 MP 0
0247: load_model #HUNTER
0247: load_model 3065
0247: load_model 1224
00D6: if and
0248:   model #HUNTER available
0248:   model 3065 available
0248:   model 1224 available
004D: jump_if_false @NONAME1_11

:NONAME1_71
0001: wait 0 ms
00D6: if and
0256:   player $PLAYER_CHAR defined
00E1:   player 0 pressed_key 6
004D: jump_if_false @NONAME1_71
04C4: store_coords_to 4@ 5@ 6@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 2.0
04C4: store_coords_to 14@ 15@ 16@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.7
00A5: 1@ = create_car #HUNTER at 4@ 5@ 6@
099A: set_car 1@ collision_detection 0
0574: set_car 1@ keep_position 1
0338: set_car 1@ visibility 1
02AC: set_car 1@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
0788: enable_heli 1@ magnet 1
0007: 33@ = 0.0

:NONAME1_225
0001: wait 0 ms
0224: set_car 1@ health_to 1000
00D6: if and
00E1:   player 0 pressed_key 16
03CA:   object $CRANE_MAGNET exists
004D: jump_if_false @NONAME1_284
000B: 0@ += 0.1
0797: set_crane_magnet $CRANE_MAGNET magnet_lane_length_to 0@ // float
0002: jump @NONAME1_225

:NONAME1_284
0001: wait 0 ms
0224: set_car 1@ health_to 1000
00D6: if and
00E1:   player 0 pressed_key 14
03CA:   object $CRANE_MAGNET exists
004D: jump_if_false @NONAME1_225
000F: 0@ -= 0.1
0797: set_crane_magnet $CRANE_MAGNET magnet_lane_length_to 0@ // float
0002: jump @NONAME1_284
[CODE]

Still don't work... dontgetit.gif
Maybe the $CRANE_MAGNET isn't the name for the magnet object. Is there a way to get the magnet local var? smile.gif
PM
  Top
 

 
ZAZ  
Posted: Sunday, Aug 5 2012, 08:44
Quote Post


Kernlochbohrer
Group Icon
Group: Members
Joined: Jan 10, 2005

eu.gif

Member Award




It's not recommanded to manipulate globals of main.scm via cleoscript
Works only with original main and in some cases can it happens that cleo don't allocate the global correct, especially while active mission mode
If you want to do it anyway, so do some checks to make shure that the global will be allocated to the object
At first a check for the loacation, then if the global object exist and then if the object is the correct model
Have a look to the first script

You can also spawn the MagnoCrane_03 by new
Use then 0A95: enable_thread_saving
Have a look to the second script
It spawns the MagnoCrane_03 at Sa Fierro/Esplanade East and allows to rotate the object and move the rope up/down

the local 1@ (multiplicated with 10) displays the rope lengh on screen

CODE
{$CLEO .cs}
:MagnoCrane_03
03A4: name_thread 'MAGCRAN'
0001: wait  1000 ms
//1382, MagnoCrane_03, Cranes_DYN2_CJ, 150, 4
       
:MAGCRAN_1
wait 0
00D6: if  0
0256:   player $PLAYER_CHAR defined
jf @MAGCRAN_1
if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -1563.3109 83.1891 26.9332 radius 75.0 75.0 25.0  
jf @MAGCRAN_1
wait 50
if
03CA:   object $CRANE_MAGNET exists
jf @MAGCRAN_1
00BA: text_styled 'FEM_OK'  1000 ms  4
0001: wait  1000 ms
if
09CC:   object $CRANE_MAGNET model_is 1382
jf @MAGCRAN_1
008B: 5@ = $CRANE_MAGNET
00BA: text_styled 'FEM_On'  1000 ms  4

:MAGCRAN_3
wait 0
00D6: if  0
0256:   player $PLAYER_CHAR defined
jf @MAGCRAN_1
if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -1563.3109 83.1891 26.9332 radius 75.0 75.0 25.0  
jf @MAGCRAN_1
0796: get_crane_magnet 5@ magnet_lane_length_to 0@
0087: 1@ = 0@ // (float)
1@ *= 10.0
0092: 1@ = float_to_integer 1@
03F0: enable_text_draw 1
045A: text_draw_1number  50.0  100.0 'NUMBER' 1@    // value
if
0AB0:   key_pressed 57//--------------------------------- key 9
jf @MAGCRAN_3
0797: set_crane_magnet 5@ magnet_lane_length_to 0.7 // float
jump @MAGCRAN_3



CODE
{$CLEO .cs}
:MagnoCrane_03
03A4: name_thread 'MAGCRAN'
0001: wait  1000 ms
//1382, MagnoCrane_03, Cranes_DYN2_CJ, 150, 4
0A95: enable_thread_saving
029B: 5@ = init_object 1382 at -1574.4401 1209.9697 57.1919
       


:MAGCRAN_3
wait 0
00D6: if  0
0256:   player $PLAYER_CHAR defined
jf @MAGCRAN_3
if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -1574.4401 1209.9697 27.1919 radius 75.0 75.0 75.0  
jf @MAGCRAN_3
0796: get_crane_magnet 5@ magnet_lane_length_to 0@
0087: 1@ = 0@ // (float)
1@ *= 10.0
0092: 1@ = float_to_integer 1@
03F0: enable_text_draw 1
045A: text_draw_1number  50.0  100.0 'NUMBER' 1@    // value
if  and
1.0 > 0@
0AB0:   key_pressed 104//  numeric keypad 8 key
jf @MAGCRAN_5
0@ += 0.01
0797: set_crane_magnet 5@ magnet_lane_length_to 0@ // float
jump @MAGCRAN_3

:MAGCRAN_5
if  and
0@ > -1.0
0AB0:   key_pressed 98//  numeric keypad 2 key
jf @MAGCRAN_7
0@ -= 0.01
0797: set_crane_magnet 5@ magnet_lane_length_to 0@ // float
jump @MAGCRAN_3

:MAGCRAN_7
if
0AB0:   key_pressed 100//  numeric keypad 4 key
jf @MAGCRAN_9
0176: 2@ = object 5@ Z_angle
2@ += 0.3
0177: set_object 5@ Z_angle_to 2@
jump @MAGCRAN_3

:MAGCRAN_9
if
0AB0:   key_pressed 102//  numeric keypad 6 key
jf @MAGCRAN_3
0176: 2@ = object 5@ Z_angle
2@ -= 0.3
0177: set_object 5@ Z_angle_to 2@
jump @MAGCRAN_3
Users WebsitePM
  Top
 

 
jemahuk1  
Posted: Monday, Aug 6 2012, 13:51
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2009

XXXXX



Thanks, man! Now it real works! icon14.gif icon14.gif
But one more thing, attaching the player on the magnet... smile.gif
Actually, I've tried some many ways to realize it, using
CODE
0916: set_object 30@ attractive_to_magnet 1

So, I create an object, make it attractive to magnet and attach the object onto player's head but it didn't attracted to this magnet.
Any ideas? smile.gif


PM
  Top
 

 
ZAZ  
Posted: Tuesday, Aug 7 2012, 19:39
Quote Post


Kernlochbohrer
Group Icon
Group: Members
Joined: Jan 10, 2005

eu.gif

Member Award




QUOTE (jemahuk1 @ Monday, Aug 6 2012, 14:51)
Thanks, man! Now it real works! icon14.gif  icon14.gif
But one more thing, attaching the player on the magnet... smile.gif
Actually, I've tried some many ways to realize it, using 
CODE
0916: set_object 30@ attractive_to_magnet 1

So, I create an object, make it attractive to magnet and attach the object onto player's head but it didn't attracted to this magnet.
Any ideas? smile.gif

do you mean that the object didn't attracted to the magnet?
i also didn't got the desired effect with that code
it's written at 2 lines in main.scm , Quarry mission and should attract the object dead_tied_cop (don't make sense)
ok, i played Quarry mission and could pickup dyn_quarryrock03 with Quarry crane

As next i spawned 16329, quarry_cranearm in my cleo testscript and could also pickup the dyn_quarryrock03, worked autom.
Other objects wasn't possible to make attractive_to_magnet, opcode 0916: still had no effect, also not with dyn_quarryrock03

Picking up objects with magnet seems to be hardcoded and work only with 16329, quarry_cranearm and 1303, dyn_quarryrock03

With that was it possible to attach player to object, hanging on crane magnet
test the script below
CODE
{$CLEO .cs}
:MagnoCrane_03
03A4: name_thread 'MAGCRAN'
0001: wait  1000 ms
//16329, quarry_cranearm, des_quarrycrane, 150, 2097156
//1303, dyn_quarryrock03, dynquarryrock, 100, 128
//1608, shark, shark, 40, 128
//3092, dead_tied_cop, deadcopX, 100, 0
//3054, DYN_WREKING_BALL, BREAK_ballX, 100, 0
//3065, BBALL_col, bballX, 30, 0

0A95: enable_thread_saving
029B: 5@ = init_object 16329 at -1574.4401 1209.9697 57.1919
029B: 6@ = init_object 1303 at -1597.6106 1264.3789 11.1781        
0453: set_object 5@ XY_rotation 0.0 90.0 angle 0.0


:MAGCRAN_3
wait 0
00D6: if  0
0256:   player $PLAYER_CHAR defined
jf @MAGCRAN_3
if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -1574.4401 1209.9697 27.1919 radius 75.0 75.0 75.0  
jf @MAGCRAN_3
0796: get_crane_magnet 5@ magnet_lane_length_to 0@
0087: 1@ = 0@ // (float)
1@ *= 10.0
0092: 1@ = float_to_integer 1@
03F0: enable_text_draw 1
045A: text_draw_1number  50.0  100.0 'NUMBER' 1@    // value
if  and
1.0 > 0@
0AB0:   key_pressed 104//  numeric keypad 8 key
jf @MAGCRAN_5
0@ += 0.01
0797: set_crane_magnet 5@ magnet_lane_length_to 0@ // float
jump @MAGCRAN_3

:MAGCRAN_5
if  and
0@ > -1.0
0AB0:   key_pressed 98//  numeric keypad 2 key
jf @MAGCRAN_7
0@ -= 0.01
0797: set_crane_magnet 5@ magnet_lane_length_to 0@ // float
jump @MAGCRAN_3

:MAGCRAN_7
if
0AB0:   key_pressed 100//  numeric keypad 4 key
jf @MAGCRAN_9
0176: 2@ = object 5@ Z_angle
2@ += 0.3
//0177: set_object 5@ Z_angle_to 2@
0453: set_object 5@ XY_rotation 0.0 90.0 angle 2@
jump @MAGCRAN_3

:MAGCRAN_9
if
0AB0:   key_pressed 102//  numeric keypad 6 key
jf @MAGCRAN_11
0176: 2@ = object 5@ Z_angle
2@ -= 0.3
0453: set_object 5@ XY_rotation 0.0 90.0 angle 2@
jump @MAGCRAN_3


:MAGCRAN_11
if
0AB0:   key_pressed 48//   0 key
jf @MAGCRAN_13
04F4: put_actor $PLAYER_ACTOR into_turret_on_object 6@ offset_from_object_origin 0.0 0.0 -1.5 orientation 0 both_side_angle_limit 360.0 lock_weapon 0  
0001: wait 100 ms
01B4: set_player $PLAYER_CHAR can_move 0
0001: wait 100 ms
01B4: set_player $PLAYER_CHAR can_move 1
wait 1000
jump @MAGCRAN_3

:MAGCRAN_13
if
0AB0:   key_pressed 8//   backspace key
jf @MAGCRAN_3
0465: remove_actor $PLAYER_ACTOR from_turret_mode  
0799: set_crane_magnet 5@ release_stuff_from_magnet
wait 1000
jump @MAGCRAN_3
Users WebsitePM
  Top
 

 
jemahuk1  
Posted: Thursday, Aug 9 2012, 13:09
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2009

XXXXX



It's well made script, ZAZ. Thank you! biggrin.gif
PM
  Top
 

 

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

0 Members:

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



 
IMG IMG