Quantcast

Jump to content

» «
Photo

[SA] Codes to spawn texture from txd folder?

  • This topic is locked This topic is locked
21 replies to this topic
In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#1

Posted 06 January 2014 - 02:25 PM

I've search all tutorial about this, but I can't find it. I want to know some codes to spawn texture in-game, I already know this codes : 

:LOAD
0390: load_txd_dictionary 'weapon'
038F: load_texture "gun_dildo1" as 64 
038F: load_texture "gun_dildo2" as 65

But, what is the code to make them spawn in-game? The title maybe sound stupid, but I want to learn coding anyway.


Danikov
  • Danikov

    The Fake Russian

  • Members
  • Joined: 27 Aug 2009
  • Israel

#2

Posted 06 January 2014 - 02:33 PM Edited by Danikov, 06 January 2014 - 02:44 PM.

I've search all tutorial about this, but I can't find it. I want to know some codes to spawn texture in-game, I already know this codes : 

:LOAD
0390: load_txd_dictionary 'weapon'
038F: load_texture "gun_dildo1" as 64 
038F: load_texture "gun_dildo2" as 65

But, what is the code to make them spawn in-game? The title maybe sound stupid, but I want to learn coding anyway.

 

With Opcode 038D you do so,further details about this opcode and its usage can found in GTAG's page for that opcode : Click this  :)

 

+Edit : I want to add that the RGBs in the example are 128,you might want to have these 3 set to 255 if you want it to have the texture drawn as it is,because 128 in all three will grey up the texture.

  • In45do likes this

In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#3

Posted 09 January 2014 - 12:40 PM

Thank you very much! 
But sometimes it will buggy if I use another mods that need to use texture. For example ThirteenAG's revelation blood mod (blood on screen). Can you help me with that?


MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#4

Posted 13 January 2014 - 03:23 PM

in this case you have 2 ways:

Using Wesser's sddwg

Using texture functions in DK22Pac's newOpcode.cleo


In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#5

Posted 16 January 2014 - 10:23 PM

in this case you have 2 ways:

Using Wesser's sddwg

Using texture functions in DK22Pac's newOpcode.cleo

I already use Wesser's sddwg. It still buggy. But, I'm not test it with DK22Pac's newOpcode.cleo. So. I will test it with his newOpcode.cleo. :)

Btw, ThirteenAG said to change the ID of texture I'm using. (I've PM him about that buggy texture, that's was his solution)


ThirteenAG
  • ThirteenAG

    Soldier

  • Feroci
  • Joined: 29 Dec 2008
  • None

#6

Posted 17 January 2014 - 07:07 AM

Btw, ThirteenAG said to change the ID of texture I'm using. (I've PM him about that buggy texture, that's was his solution)

If you're using sddwg there's no point to do that.

In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#7

Posted 17 January 2014 - 08:14 AM

Now what I have to do? Remove sddwg?


ThirteenAG
  • ThirteenAG

    Soldier

  • Feroci
  • Joined: 29 Dec 2008
  • None

#8

Posted 17 January 2014 - 08:56 AM

No one can tell what's wrong witout a code.
  • MasterHK likes this

CharlesVercetti
  • CharlesVercetti

    Even Name and Signature changes.

  • Members
  • Joined: 08 Dec 2013
  • India

#9

Posted 17 January 2014 - 09:39 AM

Offtopic:How to do it for VC?


In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#10

Posted 19 January 2014 - 08:30 AM

No one can tell what's wrong witout a code.

I will tell you through PM, right now I don't have time to decompile the file.


aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#11

Posted 19 January 2014 - 08:44 AM

Decompile? Constant decompiling and compiling of the code can cause problems in a long run, and having source of the code available makes it also easier for you to understand the code.


ThirteenAG
  • ThirteenAG

    Soldier

  • Feroci
  • Joined: 29 Dec 2008
  • None

#12

Posted 19 January 2014 - 08:51 AM Edited by ThirteenAG, 19 January 2014 - 08:52 AM.

I will tell you through PM, right now I don't have time to decompile the file.

My PM isn't a better place than this topic to ask for help :) Besides, i don't like to read low level scm constructions.

In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#13

Posted 20 January 2014 - 10:27 AM

OK, these codes is correct or not?

{$CLEO}
:SlowMo
03A4: name_thread 'SlowMo'    

:LOAD
0390: load_txd_dictionary 'ability'
038F: load_texture "skill1" as 22 // Load dictionary with 0390 first          
wait 0 ms                   
if
0256:   player $PLAYER_CHAR defined 
jf @LOAD  
0AAC: 21@ = load_audiostream "CLEO\in45do\ability.mp3" //IF and SET

:AC  
wait 0 ms                   
if
0AB0:  key_pressed 0x58           
jf @AC     
0AAD: set_audiostream 21@ perform_action 1 
0ABC: set_audiostream 21@ volume 0.4
038D: draw_texture 22 position 320.0 224.0 size 640.0 448.0 RGBA 255 255 255 110   
wait 350 ms
015D: set_gamespeed 0.42  
wait 100 ms
jump @NO_AC  
 
:NO_AC  
wait 0 ms
if     
0AB0:  key_pressed 0x58                
jf @NO_AC  
0AAD: set_audiostream 21@ perform_action 1    
0ABC: set_audiostream 21@ volume 0.4 
wait 290 ms
015D: set_gamespeed 1.0
wait 100 ms      
0AAE: release_audiostream 21@
0391: release_textures    
jump @LOAD

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#14

Posted 20 January 2014 - 03:14 PM

Fixed: ;p

{$CLEO}
03A4: name_thread 'SlowMo'  
while true
    repeat
        wait 0
    until 0256:   player $PLAYER_CHAR defined
    repeat
        wait 0
    until 0AB0:  key_pressed 0x58
    0391: release_textures    
    0390: load_txd_dictionary 'ability'
    038F: load_texture "skill1" as 22 // Load dictionary with 0390 first          
    0AAC: 0@ = load_audiostream "CLEO\in45do\ability.mp3" //IF and SET    
    0AAD: set_audiostream 0@ perform_action 1 
    0ABC: set_audiostream 0@ volume 0.4
    03F0: enable_text_draw 1
    for 32@ = 0 to 350 step 0
        038D: draw_texture 22 position 320.0 224.0 size 640.0 448.0 RGBA 255 255 255 110
    end   
    015D: set_gamespeed 0.42  
    wait 100 ms     
    repeat
        wait 0
    until key_pressed 0x58                
    0AAD: set_audiostream 0@ perform_action 1    
    0ABC: set_audiostream 0@ volume 0.4 
    wait 290 ms
    015D: set_gamespeed 1.0
    wait 100 ms      
    0AAE: release_audiostream 0@
    0391: release_textures    
end
  • In45do likes this

In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#15

Posted 24 January 2014 - 04:06 PM

Look's complex for me. Can you explain few things from what you did here? I can't understand some commands/codes.  :whuh:

1. while true

2. repeat

3. 03F0: enable_text_draw 1

4. for 32@ = 0 to 350 step 0

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#16

Posted 24 January 2014 - 05:15 PM

1.

 

every codes between

while true

and

end

are repeated infinitely

 

 

2.

every codes between

repeat

and

until

are repeated as long as condition after 'until' be implemented.

3.

 

in the normal case ( when parameter of 03F0: is 0) textures are drawn automatically as long as 03F0: takes parameter 1
but when parameter of 03F0: is 1 we have to draw texture in any frame.

 

4.

 

every codes between

for counterVar = firstCounterValue to lastCounterValue step counterChangeAmount

and

end

are repeated until counterVar is less than lastCounterValue.

every time codes between them be executed; counterVar incrases to counterChangeAmount.

  • In45do likes this

In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#17

Posted 26 January 2014 - 12:58 PM

Thanks for all explanation! :^:

 

Off-Topic : What is the code to press "sneak" button? Seems like LALT is useless when using in the script, in fact all button using numbers like 16 for sprint. Any idea?


Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#18

Posted 26 January 2014 - 01:51 PM

Yeah, 00E1 can't handle Sneak button. It can be checked by manually reading fields in CPad though.
  • In45do likes this

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#19

Posted 26 January 2014 - 08:53 PM

A more reliable approach is hooking the CRunningScript::GetPadState (0x00485B10) function in such a way:
{$CLEO}

0000: NOP

0A8C: write_memory 0x00485B25 size 1 value 24 virtual_protect 1
{
    mov     ax, [eax+ecx*2]
    ret     8
}
0A8C: write_memory 0x00485B2C size 4 value 0x48048B66 virtual_protect 1
0A8C: write_memory 0x00485B30 size 4 value 0x900008C2 virtual_protect 1

while true
    wait 0
    if
    00E1:  player 0 pressed_key 21 // Sneak
    then
        
    end
end
  • Silent and In45do like this

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#20

Posted 26 January 2014 - 09:19 PM

Simple and effective. Great :^:

In45do
  • In45do

    Newbz

  • Members
  • Joined: 15 Jan 2012
  • Indonesia

#21

Posted 27 January 2014 - 02:19 PM

Thanks for helping me out! I'll test that script soon. :)


Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#22

Posted 27 January 2014 - 03:07 PM

I guess it can be locked then. If you still have problems with it, PM me and I'll open the topic again :^:




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users