Mod Showroom

 Reply to this postStart new topic

Weapon pickups with lighting

DK22
post Jan 7 2011, 01:35 PM
Post #1


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Hello 2 all. I've made a script to create a proection of light under the pickup of weapon. But need to ask you about the code. Does there any mistakes or no. It works at this time, so I posted it in mod showroom.
Screen:

Code
mmm... How to make the code visible only for registered users?

This post has been edited by DK22: Jan 7 2011, 01:37 PM
Go to the top of the page
 
+Quote Post
Deji
post Jan 7 2011, 01:45 PM
Post #2


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Nice smile.gif

If it works the way you want it to, I can't imagine there would be any mistakes... You don't have to use "remove_references" for the pickup object, though, because you got that via memory and not an opcode which adds the references.


Here was my code for landing pickups, which never worked out tongue.gif
SANNY
0AA7: call_function 0x404570 num_params 0 pop 0 8@
0A8D: 0@ = read_memory 0x4571A1 size 4 virtual_protect 1
000A: 0@ += 0x4

while true
    003D:
    for 1@ = 0x0 to 0x26C
        0A90: 2@ = 1@ * 0x20
        005A: 2@ += 0@
        0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
        if
            8039:   not 2@ == 0
        then
            0AA8: call_function_method 0x465070 struct 8@ num_params 1 pop 1 2@ 3@
            0984: 7@ = object 3@ model
            if and
                0029:   7@ >= #GUN_VIBE1
                002B:   #ARMOUR >= 7@
                8039:   not 7@ == #JETPACK
            then
                0A8E: 4@ = 2@ + 0x1C
                0A8D: 5@ = read_memory 4@ size 4 virtual_protect 0
                if
                    08B7:   test 5@ bit 21
                then
                    //08BD: set 5@ bit 0
                    //08C3: clear 5@ bit 3
                    08C3: clear 5@ bit 21 // turn off pickup rendering (stops object spinning)
                    0A8C: write_memory 4@ size 4 value 5@ virtual_protect 0
                    //02CE: 6@ = ground_z_at 4@ 5@ 6@
                    //01BC: put_object 3@ at 4@ 5@ 6@
                    //0453: set_object 3@ XY_rotation 90.0 90.0 angle 0
                    //0900: anchor_object 3@
                    0382: set_object 3@ collision_detection 1
                    0392: make_object 3@ moveable 1
                    0381: throw_object 3@ velocity_in_direction 0 0 0.1
                end
            end
        end
    end
end


As I discovered, pickup objects can't be forced to have physics. A lot of failed code here tongue.gif


EDIT

There's no way to hide stuff from Guests now.. maybe I'll implement that with v2.


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Jan 7 2011, 07:17 PM
Post #3


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



SANNY
Wanted this code? GTFO


This post has been edited by DK22: Dec 23 2011, 12:54 AM
Go to the top of the page
 
+Quote Post
Deji
post Jan 7 2011, 07:25 PM
Post #4


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



It does, if I remember correctly. So does setting the rotation.. But it looks messed up. Also, the bit I disabled to allow this stuff causes game crashes sometimes, so isn't a good solution.


--------------------
Go to the top of the page
 
+Quote Post
abc
post Jan 7 2011, 08:11 PM
Post #5


The New Guy!

Posts: 4
Joined: 8-December 10



So, if it's mod showroom, where is the mod? unsure.gif
Go to the top of the page
 
+Quote Post
DK22
post Jan 7 2011, 09:42 PM
Post #6


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Anyway, I dunno on 100% if it work with crashes or no...
SANNY
Wanted this code? GTFO

I also tried to make that
SANNY
Wanted this code? GTFO

but there is some problems with type 15... If player will go away, the model of pickup (the psevdo-model that I created) will destroy and wouldnt create again... But pickup is still there, but unvisible...
Just hoping for your help in that.
@Deji: I tested, game not crashes when I changed position with your code, but pos is not changed.

This post has been edited by DK22: Dec 23 2011, 12:55 AM
Go to the top of the page
 
+Quote Post
Deji
post Jan 7 2011, 10:16 PM
Post #7


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Hmm.. In my experience, picking up the pickup would crash the game.. Either straight away or after reloading the game. Also, make sure the object isn't being moved, then moved back (this seemed to happen a lot) a large enough wait between 2 put_object opcodes should fix it. 0900 turned out not to be anchor_object, can't remember if it actually helped keep it in place or not (I remember it doing).

You shouldn't ever have to load the model if the pickup exists.


What do you mean about the SCM Pickup thing?


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Jan 8 2011, 02:08 PM
Post #8


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



I can't get the right position of pickup...
SANNY
Wanted this code? GTFO

The proection is not created, or created somewhere else.
Here is example from japan cleo-wiki
SANNY
Wanted this code? GTFO


This post has been edited by DK22: Dec 23 2011, 12:55 AM
Go to the top of the page
 
+Quote Post
Deji
post Jan 8 2011, 02:36 PM
Post #9


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



You can simply use store_object position on the object handle converted from the struct. CLEO 4 can do it with opcode 0AEC. From my source, you can do it via a CLEO 3-friendly method:
SANNY
0AA8: call_function_method 0x465070 struct 8@ num_params 1 pop 1 4@ 3@   // convert object struct to SCM handle




SANNY
01BB: store_object 2@ position_to 3@ 4@ 5@
016F: particle 3 rot 0.0 size 1.0 255 RGB 255 71 16 at 3@ 4@ 5@


But I still don't see a good way to get the objects to lie down naturally using my method of stopping the pickups, because as I saw when I created a line of all pickups, not all objects look right rotated at 90.0.

Cop weapons, do, though:


SANNY
0AEC: 2@ = object_struct 1@ handle
01BB: store_object 2@ position_to 3@ 4@ 5@
01BC: put_object 2@ at 3@ 4@ -100.0
0453: set_object 2@ XY_rotation 90.0 0 angle 0


But for some reason, lying them down seems to make the light "blink" on and off.


--------------------
Go to the top of the page
 
+Quote Post
ThirteenAG
post Jan 8 2011, 06:46 PM
Post #10


Ameteur Member

Posts: 54
Joined: 8-January 11



Hi, i'm tested that script a bit, so here is a little report.
I'm using
SANNY

        //0AE3: 3@ = random_object_near_point 0@ 1@ 2@ in_radius 2000.0 find_next false
       0866: get_object_in_sphere 0@ 1@ 2@ radius 2000.0 handle_as 3@

and
SANNY
until 8866: get_object_in_sphere 0@ 1@ 2@ radius 2000.0 handle_as 3@

instead of cleo4 opcodes, so maybe for me that code contain more bugs than original one.
Anyway, i've got crash on mission Just Business:
CODE
********************************************
thread ivweapo
Local variables dump:
9932252 57376 32 -1 0 0 1155660800 -991873024 1081081856 0 353 57117 1151090688 0 0 0
1157820928 -990623744 1096024064 0 0 0 0 0 0 0 0 0 0 0 1108089368 1095294952
********************************************

00000538: 0002
  get numeric params: 1
    param 1 = -522 (&label: 8248)

00000522: 8248
  get numeric params: 1
    param 1 = 353

00000527: 004D (&IFresult = False)
  get numeric params: 1
    param 1 = -545 (&label: 0006)

00000545: 0006
  get numeric params: 1
    param 1 = 1

00000552: 00D6
  get numeric params: 1
    param 1 = 0

00000556: 0039
  get numeric params: 1
    param 1 = 1

00000563: 004D (&IFresult = True)
  get numeric params: 1
    param 1 = -582 (&label: 0107)

00000570: 0249
  get numeric params: 1
    param 1 = 353

00000575: 0006
  get numeric params: 1
    param 1 = 0

00000582: 0107
  get numeric params: 4
    param 1 = 353
    param 2 = 1157820928
    param 3 = -990623744
    param 4 = 1095294952

00000599: 0906
  get numeric params: 2
    param 1 = 59403
    param 2 = 1149026304

00000609: 01BB
  get numeric params: 1
    param 1 = 57376

*********************************
> Total opcodes: 79687136
> Logging finished: 21:30:18
  Powered by SCMLog v1.04
*********************************


CODE
Exception At Address: 0x0047D582

Registers:

EAX: 0x00000000    EBX: 0x00000001

ECX: 0x04C464B8    EDX: 0x0000E020

ESI: 0x02D9B820    EDI: 0x00000000

EBP: 0x0022FBD0    ESP: 0x0022FB48

Also, sometimes weapons in player arms becomes invisible for some reason.
And some pickups on the ground invisible too, only lighting shown.
I hope, it help to do that mod better smile.gif

This post has been edited by ThirteenAG: Jan 8 2011, 06:51 PM
Go to the top of the page
 
+Quote Post
Deji
post Jan 8 2011, 07:45 PM
Post #11


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



The crash is caused by 01BB because 0866 cannot be used as a condition (it will not change the result). You need to add a check to make sure the object is valid.

But this topic is already fairly focused on the original, unmodified code.


--------------------
Go to the top of the page
 
+Quote Post
ThirteenAG
post Jan 8 2011, 09:19 PM
Post #12


Ameteur Member

Posts: 54
Joined: 8-January 11



Ok, i'm tried to use original code with cleo4.
Game still crashes on mission.
Modified code(cleo3), without crash:
http://pastebin.com/LkyZWS7d
Works for me, at least.

This post has been edited by ThirteenAG: Jan 12 2011, 11:51 PM
Go to the top of the page
 
+Quote Post
DK22
post Jan 10 2011, 06:01 PM
Post #13


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Ok. I'll update it later. I have a new idea about this.

This post has been edited by DK22: Jan 10 2011, 06:18 PM
Go to the top of the page
 
+Quote Post
methodunderg
post Jan 16 2011, 04:57 AM
Post #14


Ameteur Member

Posts: 38
Joined: 16-January 11



QUOTE (ThirteenAG @ Jan 9 2011, 10:19 AM) *
Ok, i'm tried to use original code with cleo4.
Game still crashes on mission.
Modified code(cleo3), without crash:
http://pastebin.com/LkyZWS7d
Works for me, at least.


Just tried it out smile.gif And whilst the dropped weapons appeared with lighting underneath them, i couldn't pick them up for some reason ..

Could this be adapted to include the various weapon pickups around the place ? Like the gun on top of Sweet's house for example ? And maybe other pickups as well, like health and armor in the gang-wars, and as well as police stars smile.gif

Keep up the good work. I joined just to reply to this topic smile.gif
Go to the top of the page
 
+Quote Post
ThirteenAG
post Jan 16 2011, 06:57 PM
Post #15


Ameteur Member

Posts: 54
Joined: 8-January 11



QUOTE (methodunderg @ Jan 16 2011, 05:57 AM) *
Just tried it out smile.gif And whilst the dropped weapons appeared with lighting underneath them, i couldn't pick them up for some reason ..

Maybe that type of weapon you already have, have you tried to press "action" button to replace it?
If yes, then probably you should wait new version from DK22.
Go to the top of the page
 
+Quote Post
DK22
post Jan 29 2011, 08:43 PM
Post #16


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



I have a little problenm ^^
I can't remove the spinning from "Money" model.
UpDate:


This post has been edited by DK22: Jan 29 2011, 10:34 PM
Go to the top of the page
 
+Quote Post
ThirteenAG
post Jan 29 2011, 10:43 PM
Post #17


Ameteur Member

Posts: 54
Joined: 8-January 11



QUOTE (DK22 @ Jan 29 2011, 09:43 PM) *
UpDate:

Congratulations, can't wait the final version. happy.gif
Go to the top of the page
 
+Quote Post
Deji
post Jan 29 2011, 11:21 PM
Post #18


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Nice. That bit setting write memory opcode I posted should do it. Not sure whether it is as stable, though.


--------------------
Go to the top of the page
 
+Quote Post
Adler
post Jan 30 2011, 12:46 AM
Post #19


Devil's Advocate

Group Icon

Posts: 413
From: CA US
Joined: 26-July 09



Nice can't wait for this mod. By the way can you make your IV Target mod to be CLEO 3-compatible? smile.gif


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jan 30 2011, 02:20 AM
Post #20


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Fix your damn CLEO 4! tongue.gif


--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

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