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

 Creating Objects

 Title says it all
 
rhedge004  
Posted: Thursday, Apr 12 2012, 06:39
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 8, 2009

XXXXX



Hey guys can i ask how to create objects or spawn objects in front of CJ..
For example i want to spawn a box or tree in front of CJ whats the code??
Im new at coding so please help me.. biggrin.gif
PM
  Top
 

 
Deji  
Posted: Thursday, Apr 12 2012, 08:45
Quote Post


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

ja.gif

XXXXX



Users WebsitePM
  Top
 

 
ZAZ  
Posted: Thursday, Apr 12 2012, 08:48
Quote Post


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

eu.gif

Member Award




read tutorials, start at the pinned topic: III Coding Directory
Users WebsitePM
  Top
 

 
MichaelKnight1  
Posted: Thursday, Apr 12 2012, 09:36
Quote Post


Snitch
Group Icon
Group: BUSTED!
Joined: Mar 24, 2012

us.gif

XXXXX



QUOTE (rhedge004 @ Thursday, Apr 12 2012, 06:39)
Hey guys can i ask how to create objects or spawn objects in front of CJ..
For example i want to spawn a box or tree in front of CJ whats the code??
Im new at coding so please help me.. biggrin.gif

Not feasible, we will help you now and then after that ?? . you must Studying the application of The educational .
QUOTE

how to create objects or spawn objects in front of CJ

From your words mean to put Object in front of CJ ok so .
CODE

04C4: store_coords_to 3@ 4@ 5@ from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.0

These coordinates is not with SA Place Manager . . .
You can use 3ds Max or Zmodeler .
ok Then Create Object At 3@ - 4@ - 5@
CODE

0107: 6@ = create_object #AD_FLATDOOR at 3@ 4@ 5@

warning ; not using Global variables in cleo scripts, it can cause bugs or crashes!




PM
  Top
 

 
Deji  
Posted: Thursday, Apr 12 2012, 10:23
Quote Post


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

ja.gif

XXXXX



QUOTE (MichaelKnight1 @ Thursday, Apr 12 2012, 09:36)
Not feasible, we will help you now and then  after that ?? . you must Studying the application of The educational .

You should practise what you preach wink.gif

وهذا هو منتدى باللغة الإنجليزية فقط!
Users WebsitePM
  Top
 

 
The_Sorrow  
Posted: Thursday, Apr 12 2012, 10:26
Quote Post


Heaven, I'm in heaven(8)
Group Icon
Group: Members
Joined: May 31, 2010

en.gif

XXXXX



It's pretty simple, although I myself haven't done this before with trees and such, I'm going with common sense.

Firstly, Collect the ID of the model you want to spawn since I'm assuming there isn't a model name for 'tree' in sanny builder, A little research will find you your ID

To load the model (Using the ID you collected) use this code:

CODE
0247: load_model #WBDYG2


Replace #WBDYG2 with your model ID number

Now, You need to collect the coords (Coordinates) of CJ with an offset, The offset it used to collect coordinates infront, behind and to the side of him.

Use this code to collect the coords:

CODE
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0


$1 $2 and $3 are global variables, Although everybody advises not to use them I have always used them and had no problems

$PLAYER_ACTOR - Self explanatory really, This is CJ

1.0 3.0 1.0 - These are the offset coords, X, Y and Z

Using the 'Create' opcode below you can spawn your object using the coords you collected:

CODE
0107: $Myobject = create_object #AD_FLATDOOR at $1 $2 $3


Replace #AD_FLATDOOR with your model number and your code should now spawn your object infront of CJ

The full code? Oh yes:

CODE
0247: load_model #WBDYG2
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0
0107: $Myobject = create_object #AD_FLATDOOR at $1 $2 $3


Hope this helped and good luck, Obviously the code I gave you isn't fully completed, Research and use common sense, you'll be a coding pro in no time!
Users WebsitePMMSN
  Top
 

 
Deji  
Posted: Thursday, Apr 12 2012, 10:31
Quote Post


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

ja.gif

XXXXX



QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:26)
CODE
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0


$1 $2 and $3 are global variables, Although everybody advises not to use them I have always used them and had no problems

If someone tells you not to jump off a cliff into the sea because there are sharks at the bottom, will you still jump in just because they weren't there to tear you apart the first time? tounge2.gif
Users WebsitePM
  Top
 

 
The_Sorrow  
Posted: Thursday, Apr 12 2012, 10:32
Quote Post


Heaven, I'm in heaven(8)
Group Icon
Group: Members
Joined: May 31, 2010

en.gif

XXXXX



QUOTE (Deji @ Thursday, Apr 12 2012, 10:31)
QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:26)
CODE
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0


$1 $2 and $3 are global variables, Although everybody advises not to use them I have always used them and had no problems

If someone tells you not to jump off a cliff into the sea because there are sharks at the bottom, will you still jump in just because they weren't there to tear you apart the first time? tounge2.gif

Nah, but this is coding related, whats the worst that can happen? wink.gif
Users WebsitePMMSN
  Top
 

 
Deji  
Posted: Thursday, Apr 12 2012, 10:39
Quote Post


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

ja.gif

XXXXX



QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:32)
QUOTE (Deji @ Thursday, Apr 12 2012, 10:31)
QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:26)
CODE
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0


$1 $2 and $3 are global variables, Although everybody advises not to use them I have always used them and had no problems

If someone tells you not to jump off a cliff into the sea because there are sharks at the bottom, will you still jump in just because they weren't there to tear you apart the first time? tounge2.gif

Nah, but this is coding related, whats the worst that can happen? wink.gif

Crashes (for which there are many types), bugs, conflicts, computer explosions and inoperability.

I always check CLEO scripts I download for crappiness like bad use of global variables. If the mod is bad, I don't use it. So there's another scenario, people get sick of using scripts that cause bugs and crashes. You could loose the interest of impatient users and as a developer, you should always assume the end-user is dumb and ill-tempered.

And sure, you have the freedom to jump into the sea of sharks, I just beg you not to encourage others to do the same.
Users WebsitePM
  Top
 

 
The_Sorrow  
Posted: Thursday, Apr 12 2012, 10:50
Quote Post


Heaven, I'm in heaven(8)
Group Icon
Group: Members
Joined: May 31, 2010

en.gif

XXXXX



QUOTE (Deji @ Thursday, Apr 12 2012, 10:39)
QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:32)
QUOTE (Deji @ Thursday, Apr 12 2012, 10:31)
QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:26)
CODE
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0


$1 $2 and $3 are global variables, Although everybody advises not to use them I have always used them and had no problems

If someone tells you not to jump off a cliff into the sea because there are sharks at the bottom, will you still jump in just because they weren't there to tear you apart the first time? tounge2.gif

Nah, but this is coding related, whats the worst that can happen? wink.gif

Crashes (for which there are many types), bugs, conflicts, computer explosions and inoperability.

I always check CLEO scripts I download for crappiness like bad use of global variables. If the mod is bad, I don't use it. So there's another scenario, people get sick of using scripts that cause bugs and crashes. You could loose the interest of impatient users and as a developer, you should always assume the end-user is dumb and ill-tempered.

And sure, you have the freedom to jump into the sea of sharks, I just beg you not to encourage others to do the same.

Do sharks interest you?

OT: Scroll up for the solution to your problem!
Users WebsitePMMSN
  Top
 

 
MichaelKnight1  
Posted: Thursday, Apr 12 2012, 11:31
Quote Post


Snitch
Group Icon
Group: BUSTED!
Joined: Mar 24, 2012

us.gif

XXXXX



I advise you to hold Your Computer And Throw it on the ground ok , Why use the Arabic language and from & What do you mean to the

Use brotherly advice

Looooooooooooooooooooool xDD
PM
  Top
 

 
ZAZ  
Posted: Thursday, Apr 12 2012, 12:28
Quote Post


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

eu.gif

Member Award




QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:50)
QUOTE (Deji @ Thursday, Apr 12 2012, 10:39)
QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:32)
QUOTE (Deji @ Thursday, Apr 12 2012, 10:31)
QUOTE (The_Sorrow @ Thursday, Apr 12 2012, 10:26)
CODE
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0


$1 $2 and $3 are global variables, Although everybody advises not to use them I have always used them and had no problems

If someone tells you not to jump off a cliff into the sea because there are sharks at the bottom, will you still jump in just because they weren't there to tear you apart the first time? tounge2.gif

Nah, but this is coding related, whats the worst that can happen? wink.gif

Crashes (for which there are many types), bugs, conflicts, computer explosions and inoperability.

I always check CLEO scripts I download for crappiness like bad use of global variables. If the mod is bad, I don't use it. So there's another scenario, people get sick of using scripts that cause bugs and crashes. You could loose the interest of impatient users and as a developer, you should always assume the end-user is dumb and ill-tempered.

And sure, you have the freedom to jump into the sea of sharks, I just beg you not to encourage others to do the same.

Do sharks interest you?

OT: Scroll up for the solution to your problem!

I cofirm to Deji agian and again.
I often could experienced that gloabals of cleo corrupt globals of main.
As i converted the carmod externscript as cleo which have a lot of globals i got heavy bugs and sometimes crashes
So i converted all globals in locals and got a fine working script
this script is now a part of my Pimp My Car mod

Just a few globals in cleoscripts seems to don't have an effect unless while running a mission at same times which use a global

I also sceptical about the globals of Sanny Builder 3\data\sa\CustomVariables.ini
I tested one of these globals in a cleo mission to display a status bar
I went into ammunation while status bar was on and got a failure in the meue text

So please don't teach, use globals
For cleo we have extra opcodes
0AB3: and 0AB4:
The expression var together with a number, <var><space><number> is builing the Special Global Cleo Variable
CODE
0AB3: var 0 = 10

or
CODE
0006: 13@ =  10  // integer values
0AB3: var 0 = 13@

and
CODE
0AB4: 0@= var 0

to get then stored value into your script needs to submit into a local:
CODE
0AB4: 13@ = var 44
if
0039:   13@ ==  1  // integer values
004D: jump_if_false @nextlabel
Users WebsitePM
  Top
 

 
Bad.boy!  
Posted: Thursday, Apr 12 2012, 13:30
Quote Post


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

nl.gif

XXXXX



Don't forget to check the player angle, or the object can spawn behind, left and right from you.
IF you are using globals don't use $2 and $3 because:
CODE
$2 = $PLAYER_CHAR
$3 = $PLAYER_ACTOR
PM
  Top
 

 
Deji  
Posted: Thursday, Apr 12 2012, 14:58
Quote Post


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

ja.gif

XXXXX



QUOTE (MichaelKnight1 @ Thursday, Apr 12 2012, 11:31)
I advise you to hold Your Computer And Throw it on the ground ok , Why use the Arabic language and from & What do you mean to the

Use brotherly advice

Looooooooooooooooooooool xDD

Calm down, Ahmed. I don't want no trouble.
Users WebsitePM
  Top
 

 
BnB  
Posted: Thursday, Apr 12 2012, 16:02
Quote Post


sh*t Happens
Group Icon
Group: Members
Joined: Jun 28, 2010

gc.gif

Member Award




QUOTE (MichaelKnight1 @ Thursday, Apr 12 2012, 11:36)
QUOTE (rhedge004 @ Thursday, Apr 12 2012, 06:39)
Hey guys can i ask how to create objects or spawn objects in front of CJ..
For example i want to spawn a box or tree in front of CJ whats the code??
Im new at coding so please help me.. biggrin.gif

Not feasible, we will help you now and then after that ?? . you must Studying the application of The educational .
QUOTE

how to create objects or spawn objects in front of CJ

From your words mean to put Object in front of CJ ok so .
CODE

04C4: store_coords_to 3@ 4@ 5@ from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.0

These coordinates is not with SA Place Manager . . .
You can use 3ds Max or Zmodeler .
ok Then Create Object At 3@ - 4@ - 5@
CODE

0107: 6@ = create_object #AD_FLATDOOR at 3@ 4@ 5@

warning ; not using Global variables in cleo scripts, it can cause bugs or crashes!

I must say this post was no helpful at all, in fact it will confuse the OP. So, please stay out of this topic.
PM
  Top
 

 

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