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)


Pages: (2) [1] 2   ( Go to first unread post ) Reply to this topicStart new topicStart Poll

 CLEO | Creating a car park

 Crash at startup
 
Mister X  
Posted: Tuesday, Jul 24 2012, 10:38
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



Hello everyone. biggrin.gif

I'm real rusty with coding,but I want to try it anyway....

Now: i've downloaded CLEO for Vice City and I tried to make a parked car spawn,a bribe pickup ad a weapon spawn....

so,my cleo is like that:

CODE
// This file was decompiled using VICESCM.INI published by GtaForums.com on 27.7.07

{$VERSION 2.2.0000}
{$CLEO .cs}

//-------------MAIN---------------
0213: $1266 = create_pickup 375 type 15 at -338.918 -522.806 12.781
0213: $1267 = create_pickup 375 type 15 at -335.918 -522.806 12.781
0213: $1267 = create_pickup 375 type 15 at -332.918 -522.806 12.781
0213: $1267 = create_pickup 375 type 15 at -329.918 -522.806 12.781
0213: $1267 = create_pickup 375 type 15 at -326.918 -522.806 12.781
014B: $87 = init_parked_car_generator #DELUXO -1 -1 1 alarm 0 door_lock 0 0 10000 at -1022.6 -868.6 12.2 angle 175.0
014C: set_parked_car_generator $87 cars_to_generate_to 0


The problem is: after compiled,and after i make a new game (either load a game) the game crash at the end of loading bar....

I know it's a silly problem,but I'm very rusty at compiling,and I only want to make a stupid bribe pickup and a car park...what's wrong?
PM
  Top
 

 
Mister X  
Posted: Tuesday, Jul 24 2012, 10:51
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



Ok: i'm an idiot....

05DC: end_custom_thread

or,better:
05DC: end_stupid_thread

So it's safe to do this kind of CLEO?

The game engine would re-create the car park when I load game every time?
PM
  Top
 

 
JACK JONES  
Posted: Tuesday, Jul 24 2012, 10:55
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



First error:
Avoid using global variables ($1266, $1267, $87 or some other such as $1, $2...) inside a CLEO scrypt, use local variables (there are 15 of them in Vice City and 2 more for time checking). Local variables are:
0@, 1@, 2@...15@
Second error:
You're using the same variable ($1267) for diferent things
Third error:
You need to end the CLEO scrypt with this:
CODE
05DC: end_custom_thread

Oh wait you saw that. And don't double post, use EDIT!
EDIT: Put 101 in the opcode 014C because with 0 a car will not spawn:
0 - Car will never spawn.
1-100 - Car will spawn xx number of times.
101 - Car will always spawn.

This post has been edited by JACK JONES on Tuesday, Jul 24 2012, 11:00
PM
  Top
 

 
Mister X  
Posted: Tuesday, Jul 24 2012, 11:01
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



QUOTE (JACK JONES @ Tuesday, Jul 24 2012, 10:55)
First error:
Avoid using global variables ($1266, $1267, $87 or some other such as $1, $2...) inside a CLEO scrypt, use local variables (there are 15 of them in Vice City and 2 more for time checking). Local variables are:
0@, 1@, 2@...15@
Second error:
You're using the same variable ($1267) for diferent things
Third error:
You need to end the CLEO scrypt with this:
CODE
05DC: end_custom_thread

Oh wait you saw that. And don't double post, use EDIT!

Thanks a lot.

I've been good with scripting...but after years I forgot almost everything...


Thanks for the advice...

Another thing: can I modify an existing car spawn?

For example:

CODE
014B: $1839 = init_parked_car_generator #SECURICA -1 -1 0 alarm 0 door_lock 70 0 10000 at -870.2545 -353.9059 10.0475 angle 357.8359
014C: set_parked_car_generator $1839 cars_to_generate_to 101


This is into original main.scm.

Can I do something inside script that modify the car and,obliviously,the coordinates?
PM
  Top
 

 
JACK JONES  
Posted: Tuesday, Jul 24 2012, 11:07
Quote Post


Booom!!!
Group Icon
Group: Members
Joined: Dec 6, 2011

sr.gif

XXXXX



Yes you can and inside the main.scm you can also use the global variables but better don't use an existing number of them. And read my EDIT in my previous reply! O and read this:
http://gtag.gtagaming.com/opcode-database.php?opcode=014B

This post has been edited by JACK JONES on Tuesday, Jul 24 2012, 11:18
PM
  Top
 

 
Mister X  
Posted: Tuesday, Jul 24 2012, 11:34
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



I readed it,don't worry colgate.gif

I've always been curious about what they meant those 101 and 0 sly.gif

I want,also,to modify already existing car spawn,but (because I can lol.gif ) I will add my vehicle near existing one.

Hope that I will not exaggerate with number of spawn rolleyes.gif

THANKS a lot colgate.gif
PM
  Top
 

 
SilentPL  
Posted: Tuesday, Jul 24 2012, 11:39
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




Car generators inside a CLEO script are evil though. One of the best ways to f*ck up your save.
Users WebsitePMMSNXbox Live
  Top
 

 
Mister X  
Posted: Tuesday, Jul 24 2012, 11:42
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



QUOTE (SilentPL @ Tuesday, Jul 24 2012, 11:39)
Car generators inside a CLEO script are evil though. One of the best ways to f*ck up your save.

This isn't good suicidal.gif

I do this work because I'm actually converting my modded main.scm into a series of CLEO script,because (off course) do new game isn't cool at all...
PM
  Top
 

 
Deji  
Posted: Tuesday, Jul 24 2012, 11:45
Quote Post


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

ja.gif

XXXXX



You'd be better off just creating your own generator, by testing how close the player is and spawning the vehicles manually.
Users WebsitePM
  Top
 

 
Mister X  
Posted: Tuesday, Jul 24 2012, 11:51
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



QUOTE (Deji @ Tuesday, Jul 24 2012, 11:45)
You'd be better off just creating your own generator, by testing how close the player is and spawning the vehicles manually.

This require a extra coding.
And now I don't remember the exactly opcode to use...


If I go near the spawn,the car will spawn...But if the car spawn and I ignore that,and after I go,again,near the car.....the car spawner will do a double-spawn?
I'm no good like old times...
I know that it's simple,so please can you post a sample script?



Also,I've to spawn ever some weapon pickup,some bribe with aspirine and life...so: even this kind of spawn makes problem?

EDIT: Other problem: how I get Angle rotation of a vehicle? (To spawn it into right direction,now facing the damned streetlight). I remember that,previously,I used a good tool,but I can't remember it's name...


EDIT2:: now I've understand the problem....I can't want to spawn bribe or weapon pickup,neither usual car spawn ; because if I insert it into a .cs files

CODE
0213: 6@ = create_pickup 375 type 15 at -326.918 -522.806 12.781


Then EVERY time I load game the script run,so after 3 time I load the game in the same place I can find 3 bribes....and this is shìt...I can use enable_thread_saving....but for Vice and GTA III this opcode doesn't exist....so HOW I can do that? Damw,this is very annoying....

This post has been edited by Mister X on Wednesday, Jul 25 2012, 08:12
PM
  Top
 

 
MW_29  
Posted: Sunday, Jul 29 2012, 15:22
Quote Post


i came to play
Group Icon
Group: Members
Joined: Jan 19, 2008

jolly-roger.gif

XXXXX



QUOTE (SilentPL @ Tuesday, Jul 24 2012, 11:39)
Car generators inside a CLEO script are evil though. One of the best ways to f*ck up your save.

Confirmed. Everytime you save with such CLEO script which has cargens inside, to your savefile there are added the same cargens entries as a result of using CLEO file with them inside, you save 5x times, you got 5x THE SAME cargen entries added , so .sf file is really f*cked up then tounge.gif I use emulated cargens instead, and yes as Deji said this can be done via some extra lines with checks if player around some coords tounge.gif It's not difficult to do
Users WebsitePM
  Top
 

 
Link2012  
Posted: Sunday, Jul 29 2012, 15:36
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



QUOTE (MW_29 @ Sunday, Jul 29 2012, 12:22)
QUOTE (SilentPL @ Tuesday, Jul 24 2012, 11:39)
Car generators inside a CLEO script are evil though. One of the best ways to f*ck up your save.

Confirmed. Everytime you save with such CLEO script which has cargens inside, to your savefile there are added the same cargens entries as a result of using CLEO file with them inside, you save 5x times, you got 5x THE SAME cargen entries added , so .sf file is really f*cked up then tounge.gif I use emulated cargens instead, and yes as Deji said this can be done via some extra lines with checks if player around some coords tounge.gif It's not difficult to do

This can be solved with a enable_thread_saving.
But if you remove the script the generator will still there, will need some save hacking to remove them, a manual generator still better.
PMMSN
  Top
 

 
Mister X  
Posted: Monday, Jul 30 2012, 12:34
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



QUOTE (Link2012 @ Sunday, Jul 29 2012, 15:36)
QUOTE (MW_29 @ Sunday, Jul 29 2012, 12:22)
QUOTE (SilentPL @ Tuesday, Jul 24 2012, 11:39)
Car generators inside a CLEO script are evil though. One of the best ways to f*ck up your save.

Confirmed. Everytime you save with such CLEO script which has cargens inside, to your savefile there are added the same cargens entries as a result of using CLEO file with them inside, you save 5x times, you got 5x THE SAME cargen entries added , so .sf file is really f*cked up then tounge.gif I use emulated cargens instead, and yes as Deji said this can be done via some extra lines with checks if player around some coords tounge.gif It's not difficult to do

This can be solved with a enable_thread_saving.
But if you remove the script the generator will still there, will need some save hacking to remove them, a manual generator still better.

Yup. But enable_thread_saving isn't included in the Vice's/III opcode list...exist only on SA,strange...ok then,I've also understand that generator is SH*T biggrin.gif

But I'm a little "rusty" with coding. Can someone write the code for me? I know is easy (sort of kind: if player is in radius load model and spawn it). Someone can do this BIG pleasure to me? At least the part of code that check "if player is near that coordinates then...".

You would do a VERY BIG favor to me,because now I'm working on mapping and I want to release SOON my mods. If someone help me,I will be happy to quote it onto credits happy.gif
PM
  Top
 

 
SilentPL  
Posted: Monday, Jul 30 2012, 13:06
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




fireguy109 has posted that sort of code recently, and I've updated it here:
http://www.gtaforums.com/index.php?showtop...st&p=1061459883

Code is for GTA III, but VC one should be pretty much the same.
Users WebsitePMMSNXbox Live
  Top
 

 
Bad.boy!  
Posted: Monday, Jul 30 2012, 13:57
Quote Post


SA modder
Group Icon
Group: Members
Joined: Jun 20, 2010

nl.gif

XXXXX



You can also built your own generator which randomly chooses if it'll spawn or not:
CODE
{$CLEO .cs}

thread 'CARSPAWN'

1@ = x
2@ = y
3@ = z
4@ = angle
5@ = #CARID
6@ = 0

:LOOP
wait 250
if
   00EC:   actor $PLAYER_ACTOR 0 near_point 1@ 2@ radius 80.0 80.0
then
   gosub @TO_CREATE_OR_NOT_TO_CREATE
   
   while true
       wait 250
       if
           80EC:   not actor $PLAYER_ACTOR 0 near_point 1@ 2@ radius 80.0 80.0
       then
           01C3: remove_references_to_car 0@
           jump @LOOP
       end
   end
end

jump @LOOP
   

:TO_CREATE_OR_NOT_TO_CREATE
if
   6@ == 0
then
   6@ += 1
   jump @CREATE
else
   0209: 6@ = random_int_in_ranges 0 7
   0871: init_jump_table 6@ total_jumps 7 default_jump 0 @CREATE jumps 0 @CREATE 1 @CREATE 2 @CREATE 3 @TROLL 4 @NOTHING 5 @CREATE 6 @CREATE 7 @TROLL
end
   

:CREATE
0247: load_model 5@
038B: load_requested_models
00A5: 0@ = create_car 5@ at 1@ 2@ 3@
0175: set_car 0@ angle 4@
0249: release_model 5@
return

:TROLL // Locks the car
gosub @CREATE
0A97: 7@ = car 6@ struct
7@ += 1272
0A8C: write_memory 7@ size 4 value 2 virtual_protect 0
return

:NOTHING
return
PM
  Top
 

 
Mister X  
Posted: Monday, Jul 30 2012, 15:19
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



Thanks for the answer tounge2.gif

Very useful,but I've a silly problem,now: Double spawn : obliviously,if I spawn the car,I go far and I return to spawn I found 2 car.

OK,there's 01C3: remove_references_to_car @0 (I know how to use it) but there's a problem: if I use it while I'm in the car (like should be use: if I goes far from spawn point,remove references to the car,ready to be spawned again) the spawned car that I'm using is deleted from "interesting vehicles list".

I mean: THEN,If i exit the car and I go (on foot) little far from my car it disappear,like stupid traffic vehicle. That doesn't happen when I do the same story on stolen vehicle and garage vehicle,because they are...."important" for the game engine ;

It's a REALLLLLLLLY stupid thing,and ever if I can't resolve it well: who cares. But exist a way to prevent double spawn and doesn't use 01C3 opcode?

I tried to use clear_vehicle_from_cube (It should work,because if I goes far,when I return the engine would clean the spawn point and then spawn vehicle) but it doesn't work,ever if i code a big area.

@Bad.boy!: Useful,but I can't use your code. I'm using Vice City,and most opcode you used doesn't work on CLEO 4 VC.


EDIT: Really satisfied rolleyes.gif
Little big genious moment:

CODE
:LABELBLOOD1
0001: wait 100 ms
00D6: if
00E3:   player $PLAYER_CHAR 0 -958.488 -855.367 radius 100.0 100.0
004D: jump_if_false @LABELBLOODFIN
00D6: if
0039:   2@ == 0 // Se NON spawnato
004D: jump_if_false @LABELBLOOD1
0247: request_model #BLOODRA

:LABELBLOOD2
8248:   not model #BLOODRA available
004D: jump_if_false @LABELBLOOD3
0001: wait 0 ms
0002: jump @LABELBLOOD2

:LABELBLOOD3
00A5: 0@ = create_car #BLOODRA at -958.488 -855.367 12.183
0175: set_car 0@ z_angle_to 180.0
0249: release_model #BLOODRA
0006: 2@ = 1 // SPAWNATO!
0002: jump @LABELBLOOD1

:LABELBLOODFIN
00D6: if
0039:   2@ == 1 // Se Spawnato
004D: jump_if_false @LABELBLOOD1

00D6: if
01FC:   player $PLAYER_CHAR near_car 0@ radius 70.0 70.0 0
then
0002: jump @LABELBLOOD1

else
01C3: remove_references_to_car 0@
0006: 2@ = 0 // integer values
end

0002: jump @LABELBLOOD1


NOW work like a charm: if the car spawn and I go far from and return near it,the car is deleted and replaced by a new car. If I TAKE the car,I goes far and then I return to spawn point,no new car spawn happen. Also the car remain "in memory" if I go on foot (Obliviously within certain limit ; 70,to be precise whatsthat.gif ).

Visually old style coding and high level coding together look very poor,but hey: it work monocle.gif .

NOW,THE PROBLEM: how I can do the same with weapon pickup? thanks god for vehicle exist the 01FC opcode,but for other kind of things? Because I looked that IF i SAVE with a creating_pickup item (bribe or weapon) then I screwed: every time I load the game another one born...so I must find a way to spawn a weapon pickup "only-for-once". Anyone has an idea?

EDIT2: THIS suffer a big problem: if I save near a destroyed (spawned) vehicle it CORRUPT the savegame. Yep: the fuc*ing wreck REMAIN onto the map even on game exit and reloading and doesn't wanna leave. I've already tried every "clean" opcode,but the wreck remain here. What can also I try?

This post has been edited by Mister X on Monday, Jul 30 2012, 18:32
PM
  Top
 

 
SilentPL  
Posted: Monday, Jul 30 2012, 18:33
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




Use my code then. It shouldn't corrupt the savegame.
Users WebsitePMMSNXbox Live
  Top
 

 
Mister X  
Posted: Monday, Jul 30 2012, 18:56
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Dec 25, 2007

XXXXX



QUOTE (SilentPL @ Monday, Jul 30 2012, 18:33)
Use my code then. It shouldn't corrupt the savegame.

Ok,here's the deal: in my code I made a complex way to NOT remove_references when I near the vehicle: very effective,but bugged for f*cking savegame.

Lot of work wasted. Great.

Ok then: how can I make a weapon spawn? I can't do create_weapon_pickup because,if I save without picking it up,It will "remain" in the savegame and every time I load it will respawn. How can I do it?
PM
  Top
 

 
SilentPL  
Posted: Monday, Jul 30 2012, 19:10
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




Why would you want to NOT remove references?
Users WebsitePMMSNXbox Live
  Top
 

 
fireguy109  
Posted: Monday, Jul 30 2012, 19:13
Quote Post


Chronic post editor.
Group Icon
Group: Leone Family Mafia
Joined: Aug 30, 2010

us.gif

XXXXX



QUOTE (SilentPL @ Monday, Jul 30 2012, 14:10)
Why would you want to NOT remove references?

Apparently the cars are disappearing once he parks and hops out or something like that. whatsthat.gif

You could always just run one of those car saver scripts alongside your carpark script, all they do is assign a variable to your car so the game doesn't discard it until after you've driven, like, 10 other cars. I might have an example script somewhere, but I dunno. Pretty easy to program from scratch though.
Users WebsitePMPlayStation Network
  Top
 

 

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

0 Members:

Pages: (2) [1] 2 

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG