Quantcast

Jump to content

» «
Photo

Need Help With A Script

84 replies to this topic
midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#31

Posted 16 July 2014 - 08:35 PM Edited by midou35000, 16 July 2014 - 08:36 PM.

ok there you go ZAZ thanks for all that effort posting this:
 {$CLEO .cs}
 
03A4: name thread 'TEST ZAZ'
 
: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
wait 0 ms
077E: get_active_interior_to 30@
023C: load_special_actor 'TENPEN' as 1
 
:TZAZ_03
wait 0 ms
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 24 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 1@ health_to 500
0860: link_actor 1@ to_interior 30@
0296: unload_special_actor 1
 
:TZAZ_04
wait 0 ms
if
0118: not actor 0@ dead
004D: jump_if_false @TZAZ_04
jump @TZAZ_04
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01
But there is one problem it doesnt respawn him when i kill him do yu know why?

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#32

Posted 16 July 2014 - 08:45 PM

Haha i fixed it:
{$CLEO .cs}
 
03A4: name thread 'TEST ZAZ'
 
: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
wait 0 ms
077E: get_active_interior_to 30@
023C: load_special_actor 'TENPEN' as 1
 
:TZAZ_03
wait 0 ms
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 24 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 1@ health_to 500
0860: link_actor 1@ to_interior 30@
0296: unload_special_actor 1
 
:TZAZ_04
wait 0 ms
if
0118: not actor 0@ dead
004D: jump_if_false @TZAZ_01
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#33

Posted 16 July 2014 - 09:22 PM

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_04
wait 0 ms
if
0118: not actor 0@ dead
004D: jump_if_false @TZAZ_04 <-------- here it must jump to TZAZ_05
jump @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 0@, 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

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#34

Posted 16 July 2014 - 09:23 PM Edited by midou35000, 16 July 2014 - 09:25 PM.

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_04
wait 0 ms
if
0118: not actor 0@ dead
004D: jump_if_false @TZAZ_04
jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#35

Posted 16 July 2014 - 10:22 PM

:TZAZ_04
wait 0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
if
0118: not actor 1@ dead
004D: jump_if_false @TZAZ_05
jump @TZAZ_04
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#36

Posted 16 July 2014 - 10:24 PM

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_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
wait 0 ms
077E: get_active_interior_to 30@
023C: load_special_actor 'TENPEN' as 1
 
:TZAZ_03
wait 0 ms
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 24 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 1@ health_to 500
0860: link_actor 1@ to_interior 30@
0296: unload_special_actor 1
 
:TZAZ_04
wait 0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
if
0118: not actor 1@ dead
004D: jump_if_false @TZAZ_05
jump @TZAZ_04
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#37

Posted 17 July 2014 - 06:08 PM

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
if
0118: not actor 1@ dead   <---- this needs a correction
004D: jump_if_false @TZAZ_05
should be
if
8118: not actor 1@ dead
004D: 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

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#38

Posted 17 July 2014 - 07:49 PM Edited by midou35000, 17 July 2014 - 07:51 PM.

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?


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None

#39

Posted 17 July 2014 - 08:02 PM Edited by fastman92, 17 July 2014 - 08:10 PM.

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 35@ 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.

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#40

Posted 17 July 2014 - 08:04 PM

 

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 35@ 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.


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#41

Posted 17 July 2014 - 09:27 PM

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 !

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#42

Posted 17 July 2014 - 09:33 PM Edited by midou35000, 17 July 2014 - 09:34 PM.

Ok.
{$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
wait 0 ms
077E: get_active_interior_to 30@
023C: load_special_actor 'TENPEN' as 1
 
:TZAZ_03
wait 0 ms
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 24 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 1@ health_to 500
0860: link_actor 1@ to_interior 30@
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 1@ dead
004D: jump_if_false @TZAZ_05
jump @TZAZ_04
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#43

Posted 17 July 2014 - 11:44 PM

ups, i forgot 2 useless codes

{$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
//wait 0 ms     <--- useless
077E: get_active_interior_to 30@
//023C: load_special_actor 'TENPEN' as 1     <--- useless
 
:TZAZ_03
wait 0 ms
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 24 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 1@ health_to 500
0860: link_actor 1@ to_interior 30@
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 1@ dead
004D: jump_if_false @TZAZ_05
jump @TZAZ_04
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01

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


midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#44

Posted 17 July 2014 - 11:55 PM

{$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 30@
 
:TZAZ_03
wait 0 ms
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 24 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 1@ health_to 500
0860: link_actor 1@ to_interior 30@
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 1@ dead
004D: jump_if_false @TZAZ_05
jump @TZAZ_04
 
:TZAZ_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#45

Posted 18 July 2014 - 01:34 PM

ok, what's up with the next step?

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#46

Posted 18 July 2014 - 01:53 PM Edited by midou35000, 18 July 2014 - 02:02 PM.

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_00
thread 'TESTZAZ'

:TZAZ_01
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_01
00D6: if
0AB0:   key_pressed 51//.....Key 3
004D: jump_if_false @TZAZ_01
077E: get_active_interior_to 29@
023C: load_special_actor 'SMOKE' as 1 
023C: load_special_actor 'OGLOC' as 2 
023C: load_special_actor 'SWEET' as 3 

:TZAZ_02
0001: wait 0 ms
if 
0256: player $PLAYER_CHAR defined
00D6: if or
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: jump_if_false @TZAZ_02

:TZAZ_03
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 0@ = create_actor_pedtype 4 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 0@ health_to 5000
0860: link_actor 0@ to_interior 29@
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.2
009A: 1@ = create_actor_pedtype 4 model #SPECIAL02 at 11@ 12@ 13@
0223: set_actor 1@ health_to 5000
0860: link_actor 1@ to_interior 29@
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.2
009A: 2@ = create_actor_pedtype 4 model #SPECIAL03 at 11@ 12@ 13@
0223: set_actor 2@ health_to 5000
0860: link_actor 2@ to_interior 29@
0296: unload_special_actor 1
0296: unload_special_actor 2
0296: unload_special_actor 3

:TZAZ_04
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
00D6: if and
8118:   not actor 0@ dead
8118:   not actor 1@ dead
8118:   not actor 2@ dead
004D: jump_if_false @TZAZ_05
0002: jump @TZAZ_04

:TZAZ_05
01C2: remove_references_to_actor 0@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
0002: jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#47

Posted 18 July 2014 - 03:37 PM

this is wrong

00D6: if or <--------------------wrong
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: jump_if_false @TZAZ_02

do you know why?

 


midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#48

Posted 18 July 2014 - 03:49 PM

this is wrong

00D6: if or <--------------------wrong
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: 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_00
thread 'TESTZAZ'

:TZAZ_01
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_01
00D6: if
0AB0:   key_pressed 51//.....Key 3
004D: jump_if_false @TZAZ_01
077E: get_active_interior_to 29@
023C: load_special_actor 'SMOKE' as 1 
023C: load_special_actor 'OGLOC' as 2 
023C: load_special_actor 'SWEET' as 3 

:TZAZ_02
0001: wait 0 ms
if 
0256: player $PLAYER_CHAR defined
00D6: if and
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: jump_if_false @TZAZ_02

:TZAZ_03
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 0@ = create_actor_pedtype 4 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 0@ health_to 5000
0860: link_actor 0@ to_interior 29@
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.2
009A: 1@ = create_actor_pedtype 4 model #SPECIAL02 at 11@ 12@ 13@
0223: set_actor 1@ health_to 5000
0860: link_actor 1@ to_interior 29@
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.2
009A: 2@ = create_actor_pedtype 4 model #SPECIAL03 at 11@ 12@ 13@
0223: set_actor 2@ health_to 5000
0860: link_actor 2@ to_interior 29@
0296: unload_special_actor 1
0296: unload_special_actor 2
0296: unload_special_actor 3

:TZAZ_04
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
00D6: if and
8118:   not actor 0@ dead
8118:   not actor 1@ dead
8118:   not actor 2@ dead
004D: jump_if_false @TZAZ_05
0002: jump @TZAZ_04

:TZAZ_05
01C2: remove_references_to_actor 0@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
0002: jump @TZAZ_01

Sayak96
  • Sayak96

    Sayak96

  • Members
  • Joined: 18 Mar 2013
  • India

#49

Posted 18 July 2014 - 03:54 PM Edited by Sayak96, 18 July 2014 - 03:55 PM.

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


midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#50

Posted 18 July 2014 - 03:56 PM

@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?

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#51

Posted 18 July 2014 - 10:20 PM Edited by ZAZ, 18 July 2014 - 10:25 PM.

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_02
0001: wait 0 ms
if 
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_02
0001: wait 0 ms
00D6: if and
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: jump_if_false @TZAZ_02
and then this
:TZAZ_04
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
00D6: if and <---------------- should be if or
8118:   not actor 0@ dead
8118:   not actor 1@ dead
8118:   not actor 2@ dead
004D: jump_if_false @TZAZ_05
0002: 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:
:Loop
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @cleanup
00D6: if or
8118:   not actor 0@ dead
8118:   not actor 1@ dead
8118:   not actor 2@ dead
004D: jump_if_false @cleanup
0002: jump @Loop
another valid variant:
:Loop
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @cleanup
00D6: if and
0118:    actor 0@ dead
0118:    actor 1@ dead
0118:    actor 2@ dead
004D: jump_if_false @Loop
0002: jump @cleanup
this would also be wrong:
:Loop
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @cleanup
00D6: if or
0118:    actor 0@ dead
0118:    actor 1@ dead
0118:    actor 2@ dead
004D: jump_if_false @Loop
0002: jump @cleanup
and this would be wrong:
:Loop
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @cleanup
00D6: if and
0118:    actor 0@ dead
0118:    actor 1@ dead
0118:    actor 2@ dead
004D: jump_if_false @cleanup
0002: jump @Loop
-----------

ok enough, correct your script, then post it
and then the next step: give each actor a weapon

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#52

Posted 19 July 2014 - 09:23 AM

Goood morning ZAZ,
there you go:
{$CLEO .cs}

:TZAZ_00
thread 'TESTZAZ'

:TZAZ_01
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_01
00D6: if
0AB0:   key_pressed 51//.....Key 3
004D: jump_if_false @TZAZ_01
077E: get_active_interior_to 29@
023C: load_special_actor 'SMOKE' as 1 
023C: load_special_actor 'OGLOC' as 2 
023C: load_special_actor 'SWEET' as 3 

:TZAZ_02
0001: wait 0 ms
if 
0256: player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_02
00D6: if or
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: jump_if_false @TZAZ_02

:TZAZ_03
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 0@ = create_actor_pedtype 4 model #SPECIAL01 at 11@ 12@ 13@
0223: set_actor 0@ health_to 5000
0860: link_actor 0@ to_interior 29@
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.2
009A: 1@ = create_actor_pedtype 4 model #SPECIAL02 at 11@ 12@ 13@
0223: set_actor 1@ health_to 5000
0860: link_actor 1@ to_interior 29@
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 2.0 2.0 0.2
009A: 2@ = create_actor_pedtype 4 model #SPECIAL03 at 11@ 12@ 13@
0223: set_actor 2@ health_to 5000
0860: link_actor 2@ to_interior 29@
0296: unload_special_actor 1
0296: unload_special_actor 2
0296: unload_special_actor 3

:TZAZ_04
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @TZAZ_05
00D6: if or
8118:   not actor 0@ dead
8118:   not actor 1@ dead
8118:   not actor 2@ dead
004D: jump_if_false @TZAZ_05
0002: jump @TZAZ_04

:TZAZ_05
01C2: remove_references_to_actor 0@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
0002: jump @TZAZ_01

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#53

Posted 19 July 2014 - 10:24 AM Edited by ZAZ, 19 July 2014 - 10:30 AM.

again wrong
00D6: if or
023D: special_actor 1 loaded
023D: special_actor 2 loaded
023D: special_actor 3 loaded
004D: 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 
if
you-wanna-write-cleo-scripts(condition)
else_jump @never
learn_scripting(result)

if
I-can-help-you(condition)
else_jump @never
I_teach_you(result)
we can merge the checks:
if  and
you-wanna-write-cleo-scripts(condition)
I-can-help-you(condition)
else_jump @never
learn_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/
-----------------

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#54

Posted 19 July 2014 - 10:39 AM

Aha i get itnow thank you ZAZ

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#55

Posted 21 July 2014 - 03:09 PM

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

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#56

Posted 21 July 2014 - 10:03 PM

find a template in the tutorial
Spawn a 3D model
there are 3 scripts, the last one to spawn actor with weapon

midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#57

Posted 25 July 2014 - 11:10 AM

Hi,
Sorry i wasnt active, here you go:
{$CLEO .cs}

:ACTOR_01
03A4: name_thread 'Actor'

:ACTOR_02
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ACTOR_02
if
0AB0: key_pressed 78
004D: jump_if_false @ACTOR_02
0247: request_model 120
0247: request_model #AK47

:ACTOR_03
0001: wait  0 ms
00D6: if  and
0248:   model 120 available
0248:   model #AK47 available
004D: jump_if_false @ACTOR_03
04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset -2.0 2.0 0.2
009A: 1@ = create_actor_pedtype 4 model 120 at 11@ 12@ 13@
0173: set_actor 1@ z_angle_to  90.0
01B2: give_actor 1@ weapon  30 ammo  1500  // Load the weapon model before using this
02E2: set_actor 1@ weapon_accuracy_to  100
0223: set_actor 1@ health_to  1000
05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
0249: release_model 120

:ACTOR_04
0001: wait  0 ms
if
8118: NOT   actor 1@ dead
004D: jump_if_false @ACTOR_05
if
0104: actor $PLAYER_ACTOR near_actor 1@ radius  100.0  100.0  20.0 sphere  0
004D: jump_if_false @ACTOR_05
0002: jump @ACTOR_04

:ACTOR_05
01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
0002: jump @ACTOR_02

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#58

Posted 25 July 2014 - 02:30 PM

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


midou35000
  • midou35000

    Crackhead

  • Members
  • Joined: 04 Jul 2014
  • United-States

#59

Posted 25 July 2014 - 04:14 PM

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.

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#60

Posted 26 July 2014 - 12:12 AM

look in GTASA\data\peds.ide




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users