GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
Sun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Thu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Thu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Thu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Sat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Fri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Fri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Mon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))

Log in

I forgot my password



December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar


You are not connected. Please login or register

San Andreas Array's

View previous topic View next topic Go down  Message [Page 1 of 1]

1 San Andreas Array's on Wed Feb 18, 2009 9:45 am

Description


Arrays is made out of variables. The game sums array number and index.
The array index is much like a counter. You need to add 1 to the array index, after each, to can handle the next.

i is for a integer value, f for a floating point value, s for a short string, and v for a long string.

Code:

i: integer 4 bytes
f: float, 4 bytes
s: shortstring, 8 bytes
v: longstring, 16 bytes

Arrays needs advanced knowledge in scripting.

Code:

0050: gosub @SL_path
//....................................................


:SL_path
0006: 133@ = 0

:Path_3D_Math_Coords
00D6: if
001B:  7 > 133@
004D: jump_if_false @SLTC
00D6: if
06B3:  searchlight 36@(133@,7i) active 
004D: jump_if_false @133add1 
06B4: set_searchlight 36@(133@,7i) path_between 71@(133@,7f) 78@(133@,7f) 85@(133@,7f) and 92@(133@,7f) 99@(133@,7f) 106@(133@,7f) speed 0.32

:133add1
000A: 133@ += 1 
0002: jump @Path_3D_Math_Coords

:SLTC
0051: return

Say if 133@ is 1, then 36@(133@,7i) is equal to 37@
if 133@ is 2, then 36@(133@,7i) is equal to 38@


Here is a example script, look into the script, and use your brain:

Code:

{$CLEO}
0000:
0007: 25@ = 4.0 // floating point for Y offset
0006: 8@ = 0    // array pointer

const
interior = 31@
end

:Script_01
0001: wait  250 ms
00D6: if 
0256:  player $PLAYER_CHAR defined
004D: jump_if_false @Script_01
00D6: if 
00E1:  player 0 pressed_key 10 // NO key
004D: jump_if_false @Script_01
077E: get_active_interior_to interior
00D6: if 
0039:  interior ==  0 
004D: jump_if_false @Script_01
0247: load_model #ARMY
038B: load_requested_models

:Script_02
0001: wait  0 ms
00D6: if
0248:  model #ARMY available
004D: jump_if_false @Script_02

:Script_03
0001: wait  250 ms
00D6: if
0256:  player $PLAYER_CHAR defined
004D: jump_if_false @Script_03
00D6: if
001B:    8 > 8@ 
004D: jump_if_false @Script_04
04C4: create_coordinate 28@ 29@ 30@ from_actor $PLAYER_ACTOR offset 0.0  25@  0.3
009A: 0@(8@,8i) = create_actor_pedtype 4 model #ARMY  at 28@ 29@ 30@
0223: set_actor 0@(8@,8i) health_to 4000
000B: 25@ +=  4.0 
000A: 8@ +=  1 
0002: jump @Script_03


:Script_04
0249: release_model #ARMY 
0001: wait 3000 ms
0006: 8@ =  0 

:Script_05
00D6: if
001B:    8 > 8@ 
004D: jump_if_false @Script_06
01C2: remove_references_to_actor 0@(8@,8i) // Like turning an actor into a random pedestrian
000A: 8@ +=  1
0002: jump @Script_05

:Script_06
0006: 8@ = 0 
0001: wait 2000 ms
0002: jump @Script_01

In a array you can actually check if one actor in-particular is dead, like this:

Code:

0006: 8@ = 3
00d6: if
8118:  NOT  actor 1@(8@,8i) dead
004d: jump_if_false @label

So for example, that will check if actor 3 is dead.


Another useful way to use arrays, is just to use them for a dead check, so for example like the following:

Code:

009A: 0@ = create_actor_pedtype 4 model #ARMY at 258.3329 1810.9137 22.9922
0638: AS_actor 0@ stay_put 1
02A9: set_actor 0@ immune_to_nonplayer 1
01B2: give_actor 0@ weapon 31 ammo 0xFFFFFFF // Load the weapon model before using this
060F: set_actor 0@ melee_accuracy_to 150.0
0588: unknown_actor 0@ flag 0
0187: 3@ = create_marker_above_actor 0@
07BF: unknown_marker 3@ flag 1
018B: set_marker 3@ radar_mode 2

009A: 1@ = create_actor_pedtype 4 model #ARMY at  264.6791 1892.3807 27.8437
0638: AS_actor 1@ stay_put 1
02A9: set_actor 1@ immune_to_nonplayer 1
01B2: give_actor 1@ weapon 31 ammo 0xFFFFFFF // Load the weapon model before using this
060F: set_actor 1@ melee_accuracy_to 150.0
0588: unknown_actor 1@ flag 0
0187: 4@ = create_marker_above_actor 1@
07BF: unknown_marker 4@ flag 1
018B: set_marker 4@ radar_mode 2

009A: 2@ = create_actor_pedtype 4 model #ARMY at 230.7536 1932.0538 27.8437
0638: AS_actor 2@ stay_put 1
02A9: set_actor 2@ immune_to_nonplayer 1
01B2: give_actor 2@ weapon 31 ammo 0xFFFFFFF // Load the weapon model before using this
060F: set_actor 2@ melee_accuracy_to 150.0
0588: unknown_actor 2@ flag 0
0187: 5@ = create_marker_above_actor 2@
07BF: unknown_marker 5@ flag 1
018B: set_marker 5@ radar_mode 2


:eAX01
0006: 6@ = 0             

:eAX02                 
00D6: if
001B:  3 > 6@
004D: jump_if_false @eAX04
00D6: if
0118:  actor 0@(6@,3i) dead
004D: jump_if_false @eAX03
00D6: if
075C:  marker 3@(6@,3i) enabled
004D: jump_if_false @eAX03
0164: disable_marker 3@(6@,3i)
01C2: remove_references_to_actor 0@(6@,3i) // Like turning an actor into a random pedestrian

:eAX03
000A: 6@ += 1
0002: jump @eAX02

:eAX04
//.............................................


That is useful, if your creating a lot of actors, you can check if any of them are dead this way, if one is then it will add 1 each time one dies, it adds 1 then it repeats that until, all are dead.

View user profile http://gtamodding.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum