|
 |
|
|
|
|
|
GTA Modification Forums
Include more than 10 characters in group
 |
|
 |
| |
subramanian  |
Posted: Saturday, Feb 11 2012, 11:36
|
krishnaryan

Group: Members
Joined: May 24, 2010


|
| QUOTE (ZAZ @ Tuesday, Jan 31 2012, 22:36) | max 7 members are working for a group but you can create player_group with two leaders and each leader have 6 members of 2 subgroups then 14 gangmembers will fight with the player, alltogether 3 groups try Paratroopers mod |
Mr. ZAZ, I'm using these codes to create a group. I've narrowed it down to this lines. Please help me here. 18@ is an actor I'm creating. The line I'm using for that is: 18@ = create_actor_pedtype 7 model #BALLAS1 in_car 27@ passenger_seat 1 I face an issue sometimes here. May I know what this pedtype stands for? Pls.. The game crashes after this point. Please check this part. 07AF: 30@ = player $PLAYER_ACTOR group 0630: put_actor $PLAYER_ACTOR in_group 30@ as_leader 062F: 31@ = create_group_type 0 0630: put_actor 18@ in_group 31@ as_leader 0631: put_actor 18@ in_group 30@ 07CB: set_actor 18@ supporting_fire 0 This post has been edited by subramanian on Saturday, Feb 11 2012, 11:48
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deji  |
|
Coding like a Rockstar!

Group: Members
Joined: Dec 24, 2007


|
| CODE | 004D: jump_if_false @HOMIES_11 0001: wait 0 ms 00D6: if 0AB0: key_pressed 90 004D: jump_if_false @HOMIES_11 |
Remove that wait to increase script performance. ------------------------------------------------------ Changing this: | CODE | 00D6: if and 0248: model #HUNTLEY available 0248: model #SAVANNA available 0248: model #TRIADA available 0248: model #DESERT_EAGLE available 0248: model #ROCKETLA available 0248: model #BALLAS1 available 0248: model #MINIGUN available 0248: model #FAM1 available 0248: model #MOONBEAM available 004D: jump_if_false @HOMIES_11 |
To this: | CODE | :HOMIES_ModelChecks1 00D6: if and 0248: model #HUNTLEY available 0248: model #SAVANNA available 0248: model #TRIADA available 0248: model #DESERT_EAGLE available 004D: jump_if_false @HOMIES_ModelChecks if and 0248: model #ROCKETLA available 0248: model #BALLAS1 available 0248: model #MINIGUN available 0248: model #FAM1 available 0248: model #MOONBEAM available else_jump @HOMIES_ModelChecks |
Again, will improve performance and possibly stability (number of conditions is known to get buggy above 7). ------------------------------------------------------ Note that this: | CODE | | 03CC: enable_car 4@ stuck_check_distance_to 2.0 time_to 2000 |
Reportedly only works in the main.scm, although from a view of the memory I can see no reason why it shouldn't, so use with caution. ------------------------------------------------------ Now, I didn't see any reason for a crash in particular, but overall your script is has no amount of protection from crashing. It's best to use high constructs and make scripts, especially missions, in a constant loop where you perfom checks to make sure needed cars and characters exist and are ready to use on each run. Your variable usage is also questionable. Setting up constants could help prevent problems there.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deji  |
|
Coding like a Rockstar!

Group: Members
Joined: Dec 24, 2007


|
Nah, high constructed code allows you to look at your code more clearly and logically: Low-Construct Code:| CODE | 0247: load_model #BIKERA 0247: load_model #BIKERB
:ModelLoadLoop if or 8248: not model #BIKERA available 8248: not model #BIKERB available else_jump @ModelLoadBreak wait 0 jump @ModelLoadLoop
:ModelLoadBreak | High Construct Code:| CODE | 0247: load_model #BIKERA 0247: load_model #BIKERB
while true if or 8248: not model #BIKERA available 8248: not model #BIKERB available jf break // will break the 'while true' loop and continue with the rest of the code wait 0 end |
The codes are identical when compiled. Code between while true and end will keep running in a constant circle, until a break is encountered. continue is another keyword which causes the code to jump back to the start of the loop, similarly to writing jump @LABEL. High construct code helps a lot when indention is properly used: https://pastebin.com/u5YdsaR8This is the same code when compiled and decompiled (low construct): https://pastebin.com/fnm5V9ZyNow, with the first code, I can easily scroll through it and understand what it does. With the second, I have to look much deeper and follow the labels. This gets even harder when a lot of loops are used in code, etc. The script also demonstrates other good coding practises. Notice how it always checks whether the vehicle exists before using it, it doesn't use 01C3 at all (because it's not needed at all), it uses stages to minimise code while keeping things organised and easy to follow, proper descriptions on opcode lines used show a higher understanding of them and only 1 damn wait is used!  Since your last post gave me the impression you have an understanding of C++, I think you'll particularly appreciate how much better it is to code like this. This is code R* would approve of, because it follows their standard of coding. What's more, I've not even tested it and can predict it will work as I expect. I leave very little room for error by checking handles and ensuring the code is properly split up into stages. It only took about 15 minutes to write (would have been much shorter if I didn't overuse comments and didn't have to use opcodes for others to understand). So this is also a reason not to recompile scripts, which it looks like you do. Labels with offset names are very ugly (btw, you can use labels in high constructed code when needed - just like you can with C++). Open the original .txt file that you wrote instead of decompiling the .cs or .scm file (or whatever you guys do to end up with decompiled code - I really don't get it to be honest).
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|