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

 I want to add few objects; new cleo.cs

 Objects that are already in the game.
 
-BLITZ-  
Posted: Sunday, May 13 2012, 08:27
Quote Post


Typical behaviour for someone with your condition
Group Icon
Group: Members
Joined: Apr 4, 2008

ro.gif

XXXXX



I really don't know how explain because is my first time when I put my head into Coding. Actually I done something a lon time ago, maybe years now when I was a newbie in gta modding, but I manage to add few cars through main.scm on San Fierro garage although from what I remember the angles weren't how I wanted them to be.

I knew something about Object Create, their coordinates XYZ, the 167@(give an example) is the ID and it has to be a number that it isn't in the .scm but it still has to follow the last 166@ ID from main.scm in order to run the game, not to crash. This is all that I remember actually.

What I'm looking for is to add and use few objects that are already in the game using and making a cleo, but I don't have any idea how to start because I don't know anything about coding and I never been so briliant of understanding them. I looked today to find a simple tutorial how to add objects but I failed, no where to find or I missed them, and there are so many FAQ made by ZAZ and Dutchy would take me a lot of time to read and find only for such simple coding yet unknown by me.

So, is there any basic or standard coding, an example that is out here and is not made by nobody because I don't want to use someone else work, that follow some rules of coding and all I have to do is to add the objects and their coordinates.

I want to make a few test with some objects from the game.
Users WebsitePM
  Top
 

 
Deji  
Posted: Sunday, May 13 2012, 09:58
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



http://www.gtaforums.com/index.php?showtopic=480446

To be able to understand and do something sufficiently, you need to properly understand the basics of coding. Unfortunately it takes more patience than to just skim through a tutorial to find what you need (else I'd be doing a lot more in C++). Read all you can and more importantly, do lots of tests.
Users WebsitePM
  Top
 

 
ZAZ  
Posted: Sunday, May 13 2012, 11:28
Quote Post


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

eu.gif

Member Award




ok, step by step
Basicly is it very easy to spawn an object
just copy'n paste the script below into sannybuilder, save it, then compile and copy it into game cleo folder
then load savegame or start new game and go to Grovestreet to find the placed fire_hydrant
CODE
{$CLEO .cs}
:OBJECTS
03A4: name_thread 'OBJS'
wait 1000
//(this is a comment) dynamic.ide: 1211, fire_hydrant

029B: 1@ = init_object 1211 at 2491.7866 -1672.1202 13.3359
0A93: end_custom_thread

1@ is a variable to define the object in the script and eventually to can handle it furthermore
1211 is id number of fire_hydrant
Cleoscripts requires to insert id numbers to spawn objects
unless you wanna spawn an object of veh_mods.ide
then you can use the model name with hash infront
CODE
029B: 1@ = init_object #spl_a_f_r at 2491.7866 -1672.1202 13.3359

for models of default.ide, vehicles.ide, peds.ide, veh_mods.ide can be used either id number or model name
for the others only id number

please read
Data Type Meaning
Spawn a 3D model

how to get coordinates for position?
read about Editor


Now some important informations:
You placed now fire_hydrant in Grovestreet and if you make then a savegame,
it will be stored in the savefiles of GTA San Andreas User Files
you can't remove it then unless with savgame editor maybe.

If you load now that savegame and the script runs again,
then the object will be placed twice

This fact belongs also to pickups, parked_car_genarators, icon markers,

To avoid that the script runs again when loading savegame which was done with the script,
we have this opcode:

CODE
0A95: enable_thread_saving

cleo save this then in CLEO\CLEO_SAVES folder

Use the opcode in this way:
CODE
{$CLEO .cs}
:OBJECTS
03A4: name_thread 'OBJS'
wait 1000
0A95: enable_thread_saving
//(this is a comment) dynamic.ide: 1211, fire_hydrant

029B: 1@ = init_object 1211 at 2491.7866 -1672.1202 13.3359
0A93: end_custom_thread



If you wanna provide a script for the user to place objects, you should do everything to remove the objects if they're not used anymore, before user makes a savegame
Or tell the user about the problem

The script below spawns 3 unused objects infront of CJ by keypress Backspace
Press again Backspace to remove the objects
CODE

{$CLEO .cs}
:3_OBJECTS
{
1639, od_vbnet      red
1318, arrow         blue
1614, nt_alarm1_01  yellow
}
03A4: name_thread '3_OBJS'
0001: wait 1000 ms
00C0: set_current_time_hours_to 23 minutes_to 50

:3_OBJS_22
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @3_OBJS_22
00D6: if
0AB0:   key_pressed 8//------------------key Backspace
004D: jump_if_false @3_OBJS_22
00BA: show_text_styled GXT 'FEM_ON' time 1000 style 4  // ON
wait 500
0247: load_model 1639
0247: load_model 1318
0247: load_model 1614
038B: load_requested_models
04C4: store_coords_to 21@ 22@ 23@ from_actor $PLAYER_ACTOR with_offset -2.0 2.5 0.0
0107: 1@ = create_object 1318 at 21@ 22@ 23@
04C4: store_coords_to 21@ 22@ 23@ from_actor $PLAYER_ACTOR with_offset 0.0 2.5 0.0
0107: 2@ = create_object 1614 at 21@ 22@ 23@
04C4: store_coords_to 21@ 22@ 23@ from_actor $PLAYER_ACTOR with_offset 2.0 2.5 0.0
0107: 3@ = create_object 1639 at 21@ 22@ 23@
0001: wait 0 ms  
0249: release_model 1639
0249: release_model 1246
0249: release_model 1614
00BA: show_text_styled GXT 'FEM_OK' time 1000 style 4  // OK
0001: wait 1000 ms

:3_OBJS_276
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @3_OBJS_313
00D6: if
0AB0:   key_pressed 8//------------------key Backspace
004D: jump_if_false @3_OBJS_276

:3_OBJS_313
00BA: show_text_styled GXT 'FEM_OFF' time 1000 style 4  // OFF
0108: destroy_object 1@
0108: destroy_object 2@
0108: destroy_object 3@
0001: wait 1000 ms
0002: jump @3_OBJS_22



The variables 1@, 2@, 3@, are used as handle for the objects and can be used then to remove the objects
But this is only possible while same savegame session

It is not possible to spawn the objects, make savegame, load this savegame and remove the objects.
Users WebsitePM
  Top
 

 
-BLITZ-  
Posted: Monday, May 14 2012, 09:00
Quote Post


Typical behaviour for someone with your condition
Group Icon
Group: Members
Joined: Apr 4, 2008

ro.gif

XXXXX



Thanks ZAZ, I will try to see how far I can go with coding based on what you wrote. I hope to succeed in what I'm tring to test.
Users WebsitePM
  Top
 

 
-BLITZ-  
Posted: Tuesday, Jul 24 2012, 19:40
Quote Post


Typical behaviour for someone with your condition
Group Icon
Group: Members
Joined: Apr 4, 2008

ro.gif

XXXXX



Back on this topic because I don't want to spend my time for something after I will find out that was unecessary.

Is simple. It seems that adding too many lines/objects into .IPL at some point you hit the limit game even if I use LimitAdjuster to increase the number. If you are at the top of some skyscraper and look down, all the textures will flick and after few seconds the game crashes, even so driving or flying around Glen Park Hospital the game crashes.

I want to know if adding like 200 objects (don't mind the time spend) through CLEO .cs will not inflict with these game errors, like going above the limit, fixing this problem or I will get the same result because it doesn't matter what kind of tool I'm using, I still going to end with these errors.

Like I said, I'm not bright in coding.
Users WebsitePM
  Top
 

 
ZAZ  
Posted: Wednesday, Jul 25 2012, 17:23
Quote Post


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

eu.gif

Member Award




QUOTE (-BLITZ- @ Tuesday, Jul 24 2012, 20:40)
Back on this topic because I don't want to spend my time for something after I will find out that was unecessary.

Is simple. It seems that adding too many lines/objects into .IPL at some point you hit the limit game even if I use LimitAdjuster to increase the number. If you are at the top of some skyscraper and look down, all the textures will flick and after few seconds the game crashes, even so driving or flying around Glen Park Hospital the game crashes.

I want to know if adding like 200 objects (don't mind the time spend) through CLEO .cs will not inflict with these game errors, like going above the limit, fixing this problem or I will get the same result because it doesn't matter what kind of tool I'm using, I still going to end with these errors.

Like I said, I'm not bright in coding.

With script is it the same but spawning by script have the disadvantage that a destroyable object won't be rebuild when you leave the spawnarea and come back.
Try it yourself with the script below
change model id in this line:
CODE
L_Model_ID_var = 1371

press backspace to spawn 50 objects around of CJ
do it again to add 50 objects and so on

Did you tried to add ipl's inside of stream ipl? would need an extra new stream ipl

CODE
{$CLEO .cs}
:200obj_1
03A4: name_thread '200obj'

//1280, parkbench1
//1371, CJ_HIPPO_BIN

const
L_Model_ID_var = 9@
end

L_Model_ID_var = 1371

4@ = 0.0
7@ = 4.0


while true
wait 0
   if
       0256:   player $PLAYER_CHAR defined
   then

       if
           0AB0:   key_pressed 8//------Backspace  
       then

           0247: request_model L_Model_ID_var

           while 8248: not  model L_Model_ID_var available
               wait 0
           end
           
           for 0@ = 0 to 50

               02F6: 5@ = cosine 4@  // sinus swapped with cosine
               0013: 5@ *= 7@  // floating-point values (never used in VC or GTA 3)
               02F7: 6@ = sinus 4@ // cosine swapped with sinus
               0013: 6@ *= 7@  // floating-point values (never used in VC or GTA 3)
               04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 5@ 6@ 0.2
               029B: 10@ = init_object L_Model_ID_var at 1@ 2@ 3@
               01C7: remove_object_from_mission_cleanup_list 10@
               000B: 4@ += 25.0
               000B: 7@ += 0.1
               if
                   0021:   4@ >  354.0  // floating-point values  
               then
                   0007: 4@ = 0.0
               end
           end
           0007: 7@ = 4.0
           wait 3000
       end
   end
end
Users WebsitePM
  Top
 

 
-BLITZ-  
Posted: Thursday, Jul 26 2012, 07:13
Quote Post


Typical behaviour for someone with your condition
Group Icon
Group: Members
Joined: Apr 4, 2008

ro.gif

XXXXX



Ouh, you made a script test for me. Thank you smile.gif

So far it seems when I want to have 50 trees for the second time the game crashes. Coult the script conflict with something.

The decision I took to enter a the little world of coding is because I manage to bring near to 70% of SA trees as working lod objects and R* have no idea what they have just lost on this point as the game looks 2x more fantastic, although it seems so far that adding to many /IPL lines to bring these trees; somewhere the game rejects (about what I wrote 2 days ago). Only 10% of the entire trees can be found in map/.IPL as the rest 90% are set in gta3.img/STREAM.IPL in order to make them solid objects and working as far distance objects I have to copy them in .IPL as well.

I think is inevitable. Oh well, at least I tried all the options I had.

Oh you R* why you took such decesion. Now the game is so old, that having trees as lod for supercomputer is like a no difference at all for any masive lag.
Users WebsitePM
  Top
 

 

1 User(s) are reading this topic (1 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