Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

midou35000

Need Help With A Script

Recommended Posts

midou35000

ok there you go ZAZ thanks for all that effort posting this:

 

 {$CLEO .cs} 03A4: name thread 'TEST ZAZ' :TZAZ_01wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_01if0AB0: key_pressed 50004D: jump_if_false @TZAZ_01 :TZAZ_000001: wait 0 ms00D6: if823D:   not special_actor 1 loaded004D: jump_if_false @TZAZ_02023C: load_special_actor 'TENPEN' as 10002: jump @TZAZ_00 :TZAZ_02wait 0 ms077E: get_active_interior_to [email protected]: load_special_actor 'TENPEN' as 1 :TZAZ_03wait 0 ms04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 24 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 5000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 1 :TZAZ_04wait 0 msif0118: not actor [email protected] dead004D: jump_if_false @TZAZ_04jump @TZAZ_04 :TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrianjump @TZAZ_01
But there is one problem it doesnt respawn him when i kill him do yu know why? Edited by midou35000

Share this post


Link to post
Share on other sites
midou35000

Haha i fixed it:

 

{$CLEO .cs} 03A4: name thread 'TEST ZAZ' :TZAZ_01wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_01if0AB0: key_pressed 50004D: jump_if_false @TZAZ_01 :TZAZ_000001: wait 0 ms00D6: if823D:   not special_actor 1 loaded004D: jump_if_false @TZAZ_02023C: load_special_actor 'TENPEN' as 10002: jump @TZAZ_00 :TZAZ_02wait 0 ms077E: get_active_interior_to [email protected]: load_special_actor 'TENPEN' as 1 :TZAZ_03wait 0 ms04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 24 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 5000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 1 :TZAZ_04wait 0 msif0118: not actor [email protected] dead004D: jump_if_false @TZAZ_01 :TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrianjump @TZAZ_01

Share this post


Link to post
Share on other sites
ZAZ

But there is one problem it doesnt respawn him when i kill him do yu know why?

yes, because the code runs in an endless loop at script end

:TZAZ_04wait 0 msif0118: not actor [email protected] dead004D: jump_if_false @TZAZ_04 <-------- here it must jump to TZAZ_05jump @TZAZ_04

this tiny loop above is the "loop after the action"

it checks if the actor is still alive or not

such check should prevent bugs or crash in future, because some actor related codes cause a crash if the actor is already dead

 

in this case is this check just a condition to bring the script to the end

 

IMPORTANT is, that we remove the references of the actor, it means, it makes the game memory free from the instance of the actor, it's like say goodby

the actor will be transfered to the main game engine and is still available in game but nevermore available for our script

 

we have to do that with all that stuff that we create e.g. objects, cars ect.

we call it cleanup

 

there are also other codes like 009B: destroy_actor [email protected], it have the same result but the actor disappears immediately

 

after the cleanup can the code jump back to scriptbeginn and you can spawn the actor again

 

----------------------

 

 

In addition does it need to add one more basic check to the "loop after the action"

it's

0256:   player $PLAYER_CHAR defined

it checks if the Player dies or gets arrested (wasted or busted)

it should always be the first check of a loop and the else_jump should also go to the cleanup

this check should also prevent bugs or crash in future, because some Player related codes cause a crash if the Player is wasted or busted

 

in this case should this check do following job:

imagine that the actor was spawned and then Player will be killed

then the Player maybe respawn far away and it isn't possible to kill the actor, not possible to bring the script to the end

or maybe the actor falls down because the map gets unsolid if the player is far away

 

 

 

 

 

Haha i fixed it:

you made it wrong

read my previous post, read it carefull

Share this post


Link to post
Share on other sites
midou35000

Thank you very much ZAZ but am still far from making that script i dreamed of :(

edit: oh yeah am sorry it can cause crash or bugs so it should be like this:

 

:TZAZ_04wait 0 msif0118: not actor [email protected] dead004D: jump_if_false @TZAZ_04jump @TZAZ_01
Edited by midou35000

Share this post


Link to post
Share on other sites
ZAZ

 


:TZAZ_04
wait 0 ms
if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
if
0118: not actor [email protected] dead
004D: jump_if_false @TZAZ_05
jump @TZAZ_04

:TZAZ_05
01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian
jump @TZAZ_01

 

Share this post


Link to post
Share on other sites
midou35000

Aha so you mean i should check the if theplayer is not dead or busted again? ok.

 

{$CLEO .cs} 03A4: name thread 'TEST ZAZ' :TZAZ_01wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_01if0AB0: key_pressed 50004D: jump_if_false @TZAZ_01 :TZAZ_000001: wait 0 ms00D6: if823D:   not special_actor 1 loaded004D: jump_if_false @TZAZ_02023C: load_special_actor 'TENPEN' as 10002: jump @TZAZ_00 :TZAZ_02wait 0 ms077E: get_active_interior_to [email protected]: load_special_actor 'TENPEN' as 1 :TZAZ_03wait 0 ms04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 24 model #SPECIAL01 at [email protected] [email protected] [email protected]23: set_actor [email protected] health_to 5000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 1 :TZAZ_04wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_05if0118: not actor [email protected] dead004D: jump_if_false @TZAZ_05jump @TZAZ_04 :TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrianjump @TZAZ_01

Share this post


Link to post
Share on other sites
ZAZ

Aha so you mean i should check the if theplayer is not dead or busted again? ok.

Yes and remember what i wrote about cleanup

 

there's still a little mistake, i didn't saw it

when you test the script, you should have noticed that the actor goes away

it's because the cleanup will be read immediately

because the check if actor is dead isn't correct

 

if0118: not actor [email protected] dead   <---- this needs a correction004D: jump_if_false @TZAZ_05
should be

 

if8118: not actor [email protected] dead004D: jump_if_false @TZAZ_05
The most question codes can be changed into the opposite question

by changing the zero of the opcode into 8 and insert "not" into the code line

 

example:

 

if

00E1: key_pressed 0 10

 

the opposite:

 

if

80E1: NOT key_pressed 0 11

Share this post


Link to post
Share on other sites
midou35000

Aha yeah i was wondering about that 8 that replaces the zero when you use "not" in scripts thank you very much ZAZ i really appreciate it, but am still far from making the script that i wanted right?

Edited by midou35000

Share this post


Link to post
Share on other sites
fastman92

Aha yeah i was wondering about that 8 that replaces the zero when you use "not" in scripts, but am still far from making that script right?

 

struct tCompiledCommandID{			unsigned short int ID : 15;			unsigned short int notFlag : 1;};
Command ID + not flag is stored as 16 bit value (2 bytes) in compiled SCM code, where

 

15 bits used for command ID. (0x0 to 0x7FFF)

1 bit to tell if condition is negated.

 

There exist conditional commands, they may also be negated (NOT), but it must be an ID with notFlag enabled.

 

For example, command ID 0184: is_char_health_greater [email protected] than 119

 

 

0x0184 in hex

 

000000110000100 (15 bits of command ID)

 

Full command ID:

0x0184 in hex

 

0000000110000100 (16 bits, not flag disabled, the most significiant bit)

 

----------------

 

0x0184 in hex

1000000110000100 (16 bits, not flag enabled, the most significiant bit)

 

-----------------------

The most significiant bit makes a value 0x2^15.

 

0x2^15 =

0x8000

 

As a result since Sanny Builder expects a full command ID, you need to add 0x8000 to basic command ID if you want the command condition to be negated.

Edited by fastman92

Share this post


Link to post
Share on other sites
midou35000

 

Aha yeah i was wondering about that 8 that replaces the zero when you use "not" in scripts, but am still far from making that script right?

 

struct tCompiledCommandID{			unsigned short int ID : 15;			unsigned short int notFlag : 1;}
Command ID + not flag is stored as 16 bit value (2 bytes) in compiled SCM code, where

 

15 bits used for command ID. (0x0 to 0x7FFF)

1 bit to tell if condition is negated.

 

There exist conditional commands, they may also be negated (NOT), but it must be an ID with notFlag enabled.

 

For example, command ID 0184: is_char_health_greater [email protected] than 119

 

 

0x0184 in hex

 

000000110000100 (15 bits of command ID)

 

Full command ID:

0x0184 in hex

 

0000000110000100 (16 bits, not flag disabled, the most significiant bit)

 

----------------

 

0x0184 in hex

1000000110000100 (16 bits, not flag enabled, the most significiant bit)

 

-----------------------

The most significiant bit makes a value 0x2^15.

 

0x2^15 =

0x8000

 

As a result since Sanny Builder expects a full command ID, you need to add 0x8000 to basic command ID if you want the command condition to be negated.

 

Thank you fastman92 for those informations.

Share this post


Link to post
Share on other sites
ZAZ

Ok, now the final correction

 

you made the thread name line wrong

 

03A4: name thread 'TEST ZAZ'
it's a worst mix of syntax and too much charackter

 

either write it with opcode:

 

03A4: name_thread 'TESTZAZ'
or with keyword and without opcode

 

thread 'midou'
but not mixing

 

here: 03A4: name thread , is missing the underscore and the compiler can understand it wrong

this code haven't an important effect but in some cases does it plays a role and wrong is wrong

 

also are maximum 7 charackter allowed or valid as thread name

yes, ok, it have only 7 letters but the space is the 8th charackter

 

'TEST ZAZ' // not valid'midou35000' // too much'TESTZAZ' // valid'midou'// valid

Correct your script and post it

 

Then let's go to next step: Spawn 3 different actors !

Share this post


Link to post
Share on other sites
midou35000

Ok.

 

{$CLEO .cs} thread 'TZAZ' :TZAZ_01wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_01if0AB0: key_pressed 50004D: jump_if_false @TZAZ_01 :TZAZ_000001: wait 0 ms00D6: if823D:   not special_actor 1 loaded004D: jump_if_false @TZAZ_02023C: load_special_actor 'TENPEN' as 10002: jump @TZAZ_00 :TZAZ_02wait 0 ms077E: get_active_interior_to [email protected]: load_special_actor 'TENPEN' as 1 :TZAZ_03wait 0 ms04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 24 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 5000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 1 :TZAZ_04wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_05if8118: not actor [email protected] dead004D: jump_if_false @TZAZ_05jump @TZAZ_04 :TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrianjump @TZAZ_01
Edited by midou35000

Share this post


Link to post
Share on other sites
ZAZ

ups, i forgot 2 useless codes

{$CLEO .cs} thread 'TZAZ' :TZAZ_01wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_01if0AB0: key_pressed 50004D: jump_if_false @TZAZ_01 :TZAZ_000001: wait 0 ms00D6: if823D:   not special_actor 1 loaded004D: jump_if_false @TZAZ_02023C: load_special_actor 'TENPEN' as 10002: jump @TZAZ_00 :TZAZ_02//wait 0 ms     <--- useless077E: get_active_interior_to [email protected]//023C: load_special_actor 'TENPEN' as 1     <--- useless :TZAZ_03wait 0 ms04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 24 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 5000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 1 :TZAZ_04wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_05if8118: not actor [email protected] dead004D: jump_if_false @TZAZ_05jump @TZAZ_04 :TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrianjump @TZAZ_01

remove the useless codes, then expand the script to spawn 3 different actors

Share this post


Link to post
Share on other sites
midou35000

{$CLEO .cs}

 

thread 'TZAZ'

 

:TZAZ_01

wait 0 ms

if

0256: player $PLAYER_CHAR defined

004D: jump_if_false @TZAZ_01

if

0AB0: key_pressed 50

004D: jump_if_false @TZAZ_01

 

:TZAZ_00

0001: wait 0 ms

00D6: if

823D: not special_actor 1 loaded

004D: jump_if_false @TZAZ_02

023C: load_special_actor 'TENPEN' as 1

0002: jump @TZAZ_00

 

:TZAZ_02

077E: get_active_interior_to [email protected]

 

:TZAZ_03

wait 0 ms

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2

009A: [email protected] = create_actor_pedtype 24 model #SPECIAL01 at [email protected] [email protected] [email protected]

0223: set_actor [email protected] health_to 500

0860: link_actor [email protected] to_interior [email protected]

0296: unload_special_actor 1

 

:TZAZ_04

wait 0 ms

if

0256: player $PLAYER_CHAR defined

004D: jump_if_false @TZAZ_05

if

8118: not actor [email protected] dead

004D: jump_if_false @TZAZ_05

jump @TZAZ_04

 

:TZAZ_05

01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian

jump @TZAZ_01

Share this post


Link to post
Share on other sites
ZAZ

ok, what's up with the next step?

Share this post


Link to post
Share on other sites
midou35000

Ok i was working on it the whole night and finally i got this but it crashes when ever i press number 3 and i searched again and again but i couldnt find where is the error please ZAZ help me there you go:

 

{$CLEO .cs}:TZAZ_00thread 'TESTZAZ':TZAZ_010001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0100D6: if0AB0:   key_pressed 51//.....Key 3004D: jump_if_false @TZAZ_01077E: get_active_interior_to [email protected]: load_special_actor 'SMOKE' as 1 023C: load_special_actor 'OGLOC' as 2 023C: load_special_actor 'SWEET' as 3 :TZAZ_020001: wait 0 msif 0256: player $PLAYER_CHAR defined00D6: if or023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02:TZAZ_0304C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL02 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL03 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 10296: unload_special_actor 20296: unload_special_actor 3:TZAZ_040001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0500D6: if and8118:   not actor [email protected] dead8118:   not actor [email protected] dead8118:   not actor [email protected] dead004D: jump_if_false @TZAZ_050002: jump @TZAZ_04:TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian0002: jump @TZAZ_01
Edited by midou35000

Share this post


Link to post
Share on other sites
ZAZ

this is wrong

00D6: if or <--------------------wrong023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02

do you know why?

 

Share this post


Link to post
Share on other sites
midou35000

this is wrong

00D6: if or <--------------------wrong023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02
do you know why?

 

Hi ZAZ,

Oh i didnt notice that thats a failure in conditional checks.it should be if and:

 

{$CLEO .cs}:TZAZ_00thread 'TESTZAZ':TZAZ_010001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0100D6: if0AB0:   key_pressed 51//.....Key 3004D: jump_if_false @TZAZ_01077E: get_active_interior_to [email protected]: load_special_actor 'SMOKE' as 1 023C: load_special_actor 'OGLOC' as 2 023C: load_special_actor 'SWEET' as 3 :TZAZ_020001: wait 0 msif 0256: player $PLAYER_CHAR defined00D6: if and023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02:TZAZ_0304C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL02 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL03 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 10296: unload_special_actor 20296: unload_special_actor 3:TZAZ_040001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0500D6: if and8118:   not actor [email protected] dead8118:   not actor [email protected] dead8118:   not actor [email protected] dead004D: jump_if_false @TZAZ_050002: jump @TZAZ_04:TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian0002: jump @TZAZ_01

Share this post


Link to post
Share on other sites
Sayak96

@midou35000, any solutions? my phone camera model is ready, I already gave you the SNAP ifp.

Edited by Sayak96

Share this post


Link to post
Share on other sites
midou35000

@midou35000, any solutions? my phone camera model is ready, I already gave you the SNAP ifp.

Cant you see am still getting ZAZ's help?

Share this post


Link to post
Share on other sites
ZAZ

Oh i didnt notice that thats a failure in conditional checks.it should be if and:

yes, if and is right

 

what's this?

 

 

:TZAZ_020001: wait 0 msif 0256: player $PLAYER_CHAR defined
0256: player $PLAYER_CHAR defined is a condition and should be part of a conditional check

but the else_jump is missing, so the condition doesn't make any sense

 

if statement

condition

else_jump to label

 

anyway, you don't need the check for $PLAYER_CHAR defined in a model load check loop

 

a model load loop is mostly passed in one second, sometimes in 3 seconds and doesn't contain player related codes

 

:TZAZ_020001: wait 0 ms00D6: if and023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02
and then this

 

:TZAZ_040001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0500D6: if and <---------------- should be if or8118:   not actor [email protected] dead8118:   not actor [email protected] dead8118:   not actor [email protected] dead004D: jump_if_false @TZAZ_050002: jump @TZAZ_04
should be if or instead if and

it's hard to undstand now for you why it needs if or, especially because "not" -conditions are used

i have also problems in such cases and find the right if-statement by simple testing

 

the plan is: if all actors are dead, then the code should jump to the cleanup, but not if only one actor is dead

if you have tested the script, you should have noticed that two actors go away if you have killed one of the actors

they go away because their referencend have been removed

 

depending to the case, if "not" -conditions are used or normal conditions, does it require different if-statements and to decide which code should lead to the cleanup

 

i change the label name for better understanding

the current variant:

 

:Loop0001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @cleanup00D6: if or8118:   not actor [email protected] dead8118:   not actor [email protected] dead8118:   not actor [email protected] dead004D: jump_if_false @cleanup0002: jump @Loop
another valid variant:

 

:Loop0001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @cleanup00D6: if and0118:    actor [email protected] dead0118:    actor [email protected] dead0118:    actor [email protected] dead004D: jump_if_false @Loop0002: jump @cleanup
this would also be wrong:

 

:Loop0001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @cleanup00D6: if or0118:    actor [email protected] dead0118:    actor [email protected] dead0118:    actor [email protected] dead004D: jump_if_false @Loop0002: jump @cleanup
and this would be wrong:

 

:Loop0001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @cleanup00D6: if and0118:    actor [email protected] dead0118:    actor [email protected] dead0118:    actor [email protected] dead004D: jump_if_false @cleanup0002: jump @Loop
-----------

 

ok enough, correct your script, then post it

and then the next step: give each actor a weapon

Edited by ZAZ

Share this post


Link to post
Share on other sites
midou35000

Goood morning ZAZ,

there you go:

 

{$CLEO .cs}:TZAZ_00thread 'TESTZAZ':TZAZ_010001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0100D6: if0AB0:   key_pressed 51//.....Key 3004D: jump_if_false @TZAZ_01077E: get_active_interior_to [email protected]: load_special_actor 'SMOKE' as 1 023C: load_special_actor 'OGLOC' as 2 023C: load_special_actor 'SWEET' as 3 :TZAZ_020001: wait 0 msif 0256: player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0200D6: if or023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02:TZAZ_0304C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL01 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL02 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model #SPECIAL03 at [email protected] [email protected] [email protected]: set_actor [email protected] health_to 50000860: link_actor [email protected] to_interior [email protected]: unload_special_actor 10296: unload_special_actor 20296: unload_special_actor 3:TZAZ_040001: wait 0 ms00D6: if0256:   player $PLAYER_CHAR defined004D: jump_if_false @TZAZ_0500D6: if or8118:   not actor [email protected] dead8118:   not actor [email protected] dead8118:   not actor [email protected] dead004D: jump_if_false @TZAZ_050002: jump @TZAZ_04:TZAZ_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian0002: jump @TZAZ_01

Share this post


Link to post
Share on other sites
ZAZ

again wrong

 

00D6: if or023D: special_actor 1 loaded023D: special_actor 2 loaded023D: special_actor 3 loaded004D: jump_if_false @TZAZ_02
it seems that you didn't understand what a conditional check should do and how it works

don't worry, that's normal for newbies, but it's import to understand

 

example

 

ifyou-wanna-write-cleo-scripts(condition)else_jump @neverlearn_scripting(result)ifI-can-help-you(condition)else_jump @neverI_teach_you(result)
we can merge the checks:

 

if  andyou-wanna-write-cleo-scripts(condition)I-can-help-you(condition)else_jump @neverlearn_scripting(result)I_teach_you(result)

---------------

maybe it's easier for you to work and understand high level methods

please read this topic: cleo-advanced-script-tutorial/

-----------------

Edited by ZAZ

Share this post


Link to post
Share on other sites
midou35000

Aha i get itnow thank you ZAZ

Share this post


Link to post
Share on other sites
midou35000

Zaz can you help me a little bit with giving each actor a weapon.

Thanks.

Share this post


Link to post
Share on other sites
ZAZ

find a template in the tutorial

Spawn a 3D model

there are 3 scripts, the last one to spawn actor with weapon

Share this post


Link to post
Share on other sites
midou35000

Hi,

Sorry i wasnt active, here you go:

 

{$CLEO .cs}:ACTOR_0103A4: name_thread 'Actor':ACTOR_020001: wait  0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @ACTOR_02if0AB0: key_pressed 78004D: jump_if_false @ACTOR_020247: request_model 1200247: request_model #AK47:ACTOR_030001: wait  0 ms00D6: if  and0248:   model 120 available0248:   model #AK47 available004D: jump_if_false @ACTOR_0304C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2009A: [email protected] = create_actor_pedtype 4 model 120 at [email protected] [email protected] [email protected]: set_actor [email protected] z_angle_to  90.001B2: give_actor [email protected] weapon  30 ammo  1500  // Load the weapon model before using this02E2: set_actor [email protected] weapon_accuracy_to  1000223: set_actor [email protected] health_to  100005E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR0249: release_model 120:ACTOR_040001: wait  0 msif8118: NOT   actor [email protected] dead004D: jump_if_false @ACTOR_05if0104: actor $PLAYER_ACTOR near_actor [email protected] radius  100.0  100.0  20.0 sphere  0004D: jump_if_false @ACTOR_050002: jump @ACTOR_04:ACTOR_0501C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian0002: jump @ACTOR_02

Share this post


Link to post
Share on other sites
ZAZ

you just copied a template of my tut, ok, why not.... the script spawns the Triad Boss, now change the actor model to spawn the Mafia Boss

Share this post


Link to post
Share on other sites
midou35000

No zaz not exactly your script i did it by myself i swear to god i just couldnt find what to spawn then i went to ur script :p can you help me i cant find mafia boss model.

Share this post


Link to post
Share on other sites
ZAZ

look in GTASA\data\peds.ide

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.