GTAMP.com

Grand Theft Auto Media Press
It is currently Wed Oct 18, 2017 2:04 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sat Dec 12, 2015 2:29 am 
Offline
Car Jacker

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 30
I have a number of questions:
Ask and Answer a question here of scripting in GTA 2.

    1. Is it possible create a NEW -> set -> show dynamic display a long text (as in http://gtamp.com/images/gta2pedhealth.jpg)?
    2. Is it possible declare a variable and store text (in string) into memory and write others varible?
    Code:
    // Pseudo code:
    STRING string = "text 1"
    SET string = "text 2"

    3. Can I show/hide ID http://gtamp.com/images/gta2pedhealth.jpg only one player, not all?
    4. Can I show/hide the DISPLAY_BRIEF(ID) only one player, not all?
    Code:
    // Pseudo code:
    ShowDialog(player1, ID)
    HideDialog(player1, ID)

    5. Is it possible to extend the limit of OBJECTS/CARS/CHARREMAPS/WEAPONS have asked in this topic viewtopic.php?f=4&t=814#p9568
    6. How to get the square root?
    Code:
    // Pseudo code:
    value = sqroot(9)

    7. How other methods (viewtopic.php?f=4&t=804) of a random number?
    Code:
    // Pseudo code:
    value = random(MIN, MAX)

    8. How get CAR/CHAR/OBJECT ID from area x, y, z?
    Code:
    // Pseudo code:
    carid = GetCarID(x, y, z)
    charid = GetCharID(x, y, z)
    objid = GetObjectID(x, y, z)

    9. How get start time my server in milliseconds (through memory)?
    10. Is it possible (through memory) read/write get rotation/position of tank turret?
    11. Is it possible (through memory) attached objects: object1 to object2 or object1 to car?
    12. Arrays that possible? As can be this through memory?
    13. Can be compile the script *.MIS to *.SCR in command line?
    This example compiles in "C:\" files appear: mission.SCR, mission.TXT, mission.TMP, but mission.SCR does not work, and always weighs 48kb
    compile.bat:
    Code:
    @echo off
    C:\miss2.exe C:\mission.mis
    pause

    14. What command/arguments knows the compiler GTA2script Compiler V9.6\miss2.exe -help -input "..." -i "..." -output "..."?

NOTE:
The topic will be expanded.
The most suitable answers will be given in the references.
If you know the answer to these questions are answered, do not hesitate.
Any help would be appreciated.

_________________
[GTA2 Map] F-Industry-Live
[GTA2 FAQ] Help for scripters


Last edited by Logofero on Sat Dec 12, 2015 8:06 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Dec 12, 2015 4:44 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1283
Location: GTAMP.com
1. Is it possible create a NEW -> set -> show dynamic display a long text (as in http://gtamp.com/images/gta2pedhealth.jpg)?
gta2script doesn't have string support, so string manipulation would require a lot of counters and script commands and would only be able to work on one byte at a time. I don't know the memory addresses for all strings but this might help: https://github.com/Bytewerk/gta2-hacker ... ngame-text

2. Is it possible declare a variable and store text (in string) into memory and write others varible?
Same answer as 1.

3. Can I show/hide ID http://gtamp.com/images/gta2pedhealth.jpg only one player, not all?
Yes but I don't know the memory addresses. You can enable do_show_ids by changing a byte at 0x5EADA1 (this way you could tick show IDs using gta2script even if the player forgot to tick it).

4. Can I show/hide the DISPLAY_BRIEF(ID) only one player, not all?
This code will let you DISPLAY_BRIEF to a specific player: viewtopic.php?p=9364#p9364

5. Is it possible to add new OBJECTS/CARS/CHARREMAPS/WEAPONS instead of replacing them?
No. It would require major changes to exe/memory. There are some unused graphics that you could replace with your own, so that it won't overwrite used graphics but you can't add unlimited new stuff.

6. How to get the square root?
SIN and COS were added by vike, so maybe he can add sqrt in the next exe version.

7. How other methods (viewtopic.php?f=4&t=804) of a random number?
I added some comments to the pseudo random number script to show how you can set min and max viewtopic.php?f=4&t=804

8. How get CAR/CHAR/OBJECT ID from area x, y, z?
Memory addresses topic has code for reading/writing ped/vehicle/object x,y,z viewtopic.php?f=4&t=700

10. Is it possible (through memory) read/write get rotation/position of tank turret?
Yes, I have found that in cheat engine before but didn't write it down. I will find it again.

11. Is it possible (through memory) attached objects: object1 to object2 or object1 to car?
Yes but I don't know the memory locations.

12. Arrays that possible? As can be this through memory?
Not in gta2script. A better language will be needed.


Top
 Profile  
 
PostPosted: Sat Dec 12, 2015 7:37 am 
Offline
Car Jacker

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 30
Sektor, thanks for the reply.

Anyone who knows the answers to the questions - write here.
All this is useful to other Old scooler scripters and attract more people to GTA2

    15. Is it possible to declare (through memory) to create and delete OBJECTS/CHARS/CARS?
    16. There was more epic question: Is it possible to create an external engine (for multiplayer) that will use their scripts and work through the memory game (server -> client-side)?

    So you can create your function more flexible and simple syntax + add mathematical expressions such as obtaining the square root, random, without compiling *.SCR.
    17. Can I hide the arrow on ALL player's head in multiplayer?
    18. What are the MAX limits of created OBJECTS/CARS/WEAPONS/PEDS?

_________________
[GTA2 Map] F-Industry-Live
[GTA2 FAQ] Help for scripters


Top
 Profile  
 
PostPosted: Sat Dec 12, 2015 8:30 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1283
Location: GTAMP.com
Some great questions. They show the limitations of gta2script. Nearly anything can be done with the memory writing commands, if you can find the memory addresses but even when you have them, the code is messy and hard to read. Adding support for a better scripting language seems like the best long term solution. The hard part is finding someone to do it.

I added some answers to previous list.


Top
 Profile  
 
PostPosted: Sun Dec 13, 2015 8:05 am 
Offline
Car Jacker

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 30
Sektor wrote:
> 6. How to get the square root?
SIN and COS were added by vike, so maybe he can add sqrt in the next exe version.

Also add directly to obtain the distance between two points
Code:
// Pseudo code:
// 2D Area
distance = GetDistance2DPoints(x1, y1, x2, y2)

// And 3D Area
distance = GetDistance3DPoints(x1, y1, z1, x2, y2, z2)

Thanks for replies Sektor.
Continuing to add interesting questions. :idea:

    19. Is it possible to repaint Object as a Car (through memory)?
    Example: If you create new Tank for can be painted (color 0-35), tower tank Do not paint.

    20. Creating a multi-language version. Upload font from NEW *.sty by GM is it possible?
    Into: The GTA first series is 1st problem always seemed fonts/language. All languages have their own special character, but when you consider the difference that you can fix it.
    Now in GTA2 to replace the fonts need to find them in will.sty, bill.sty, ste.sty and replace each character. What if you take and make your font file fstyle.sty as GTA1 it will be much easier

_________________
[GTA2 Map] F-Industry-Live
[GTA2 FAQ] Help for scripters


Top
 Profile  
 
PostPosted: Mon Dec 14, 2015 2:39 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:00 pm
Posts: 948
Location: F21B3EED
Logofero wrote:
6. How to get the square root?

Most of the time square root can be taken out from calculations as long as you make every other calculation in second power.

For example if you want to check if a distance from point A to point B is less than 37:
Code:
if( (A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y) < 37*37){
    // do something
}

Or if you want to use square root:
Code:
if( sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y)) < 37){
    // do something
}

_________________
My GTA2 related projects:


Top
 Profile  
 
PostPosted: Wed Dec 16, 2015 11:07 am 
Offline
Car Jacker

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 30
Thanks T.M.
Continue again 8-)

    21. Load/Save the text file is that possible? It would be good to create statistics on the server.

_________________
[GTA2 Map] F-Industry-Live
[GTA2 FAQ] Help for scripters


Top
 Profile  
 
PostPosted: Thu Dec 17, 2015 4:27 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1283
Location: GTAMP.com
Logofero wrote:
    21. Load/Save the text file is that possible? It would be good to create statistics on the server.

According to the manual, there's a limit of 300 SAVED_COUNTERs, so enough for some statistics but not enough for an epic in game level editor. I've never tested the limit.

If you SAVE_GAME () then all the values in SAVED_COUNTER variables are saved. You will need to specify the filename of an existing save game in the debug gta2 manager tab or in the registry. If it's not in gta2\player then you will have to give a relative path, like ..\data\test.svg. I really should add mmp filename based save game support to Game Hunter.

edit: I just tested loading a save in multiplayer with 2 players but unfortunately it makes both players start in the exact same location and causes crashes. This will need an exe fix unless there's something that can be patched in the actual save game. I tried to work around it with GTA2 scripting by changing each player coordinate in memory but the saved position overrides and still crashes the game.


Top
 Profile  
 
PostPosted: Fri Jun 16, 2017 12:52 pm 
Offline
User avatar

Joined: Sat Dec 26, 2009 11:53 pm
Posts: 1061
Logofero wrote:
17. Can I hide the arrow on ALL player's head in multiplayer?

you can remove the arrows in the sty file. its been done here http://gtamp.com/mapscript/maplist/list ... noarrow.7z

_________________
yur sa'nok ngeyƤ


Top
 Profile  
 
PostPosted: Sat Jun 17, 2017 4:26 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1283
Location: GTAMP.com
elypter wrote:
Logofero wrote:
17. Can I hide the arrow on ALL player's head in multiplayer?

you can remove the arrows in the sty file. its been done here http://gtamp.com/mapscript/maplist/list ... noarrow.7z

That was before I knew about the power of the SET command.

Here's how to remove player arrows in GTA2 script. It creates a scripted arrow and then subtracts 124 from it to find a player arrow.

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
//This script removes the player arrows
PLAYER_PED p1 = (117.0,133.5,255.0) 10 270 // Red
PLAYER_PED p2 = (118.0,133.5,255.0) 09 090 // Orange
PLAYER_PED p3 = (117.5,132.5,255.0) 07 180 // Yellow
PLAYER_PED p4 = (117.5,134.5,255.0) 11 000 // Green
PLAYER_PED p5 = (117.0,132.5,255.0) 13 225 // Blue
PLAYER_PED p6 = (118.0,134.5,255.0) 08 045 // Black

COUNTER loop = 1
COUNTER playerarrow = 0
COUNTER arrowoffset = 0

ARROW_DATA arrow

LEVELSTART

POINT_ARROW_AT (arrow, p1)
REMOVE_ARROW (arrow)

SET arrowoffset=-124
SET playerarrow=(arrow+arrowoffset)
REMOVE_ARROW (playerarrow)
SET arrowoffset=-248
SET playerarrow=(arrow+arrowoffset)
REMOVE_ARROW (playerarrow)
SET arrowoffset=-372
SET playerarrow=(arrow+arrowoffset)
REMOVE_ARROW (playerarrow)
SET arrowoffset=-496
SET playerarrow=(arrow+arrowoffset)
REMOVE_ARROW (playerarrow)
SET arrowoffset=-620
SET playerarrow=(arrow+arrowoffset)
REMOVE_ARROW (playerarrow)

WHILE_EXEC (loop = 1)

DO_NOWT

ENDWHILE

LEVELEND

 
Parsed in 0.010 seconds, using GeSHi 1.0.8.10


Top
 Profile  
 
PostPosted: Sun Jun 18, 2017 1:34 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1283
Location: GTAMP.com
You can add the player arrows back again by writing 6 to byte 64 of the arrow address

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting

COUNTER arrowon=6
COUNTER arrowonaddress


IF (CHECK_CHAR_CURR_WEAPON(p1,PISTOL))
  SET arrowoffset=-124
  SET playerarrow=(arrow+arrowoffset)
  SET arrowonaddress=(playerarrow+64)
  CHANGE_GANG_CHAR_RESPECT (arrowonaddress,arrowon,111)
  SET arrowoffset=-248
  SET playerarrow=(arrow+arrowoffset)
  SET arrowonaddress=(playerarrow+64)
  CHANGE_GANG_CHAR_RESPECT (arrowonaddress,arrowon,111)
  SET arrowoffset=-372
  SET playerarrow=(arrow+arrowoffset)
  SET arrowonaddress=(playerarrow+64)
  CHANGE_GANG_CHAR_RESPECT (arrowonaddress,arrowon,111)
  SET arrowoffset=-496
  SET playerarrow=(arrow+arrowoffset)
  SET arrowonaddress=(playerarrow+64)
  CHANGE_GANG_CHAR_RESPECT (arrowonaddress,arrowon,111)
  SET arrowoffset=-620
  SET playerarrow=(arrow+arrowoffset)
  SET arrowonaddress=(playerarrow+64)
  CHANGE_GANG_CHAR_RESPECT (arrowonaddress,arrowon,111)
ENDIF
 
Parsed in 0.009 seconds, using GeSHi 1.0.8.10


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group