Jump to content

[SA] ~ CLEO Script Tutorial ~


ZAZ

Recommended Posts

 

stevendabuffman said:
Hi Zaz, I'm impressed on how you're helping everyone biggrin.gif lol

I have CLEO 4 and would like to know how to assign a certain music track when every they spawn that would loop, I'm making some missions and it's for a fight.

Any help would be appreciated smile.gif

i assume that you mean mp3

but assign to what? and when every what spawn?

 

@stevendabuffman

 

Edited by ZAZ
Link to comment
Share on other sites

stevendabuffman

Yes, I have some music that I want to use and I'm trying to make it so when my character (Sweet) spawns the music will automatically come on (it will loop) then when he despawns or dies it will stop, is that possible ? Thank you for replying smile.gif

For what I'm making there are several characters that have their own music, It's a DYOM project, I can code but I'm having trouble doing this, lol.

Link to comment
Share on other sites

@Michael-Knight1: please don't spam

 

 

 

Yes, I have some music that I want to use and I'm trying to make it so when my character (Sweet) spawns the music will automatically come on (it will loop) then when he despawns or dies it will stop, is that possible ? Thank you for replying smile.gif

For what I'm making there are several characters that have their own music, It's a DYOM project, I can code but I'm having trouble doing this, lol.

 

//your conditions and actor spawn codesif0AAB:   file_exists "CLEO\mymusic.mp3"else_jump @Exit:Loop_1wait 00AAC: 0@ = load_mp3 "CLEO\mymusic.mp3"if8039:   not   0@ ==  -1else_jump @Loop_10AAD: set_mp3 0@ perform_action 1:Loop_2wait 00AB9: get_mp3 0@ state_to 1@if0038:   1@ == -1else_jump @Loop_20AAD: set_audiostream 0@ perform_action 0 0AAE: release_mp3 0@:Exitjump @to_scriptbeginn

 

Link to comment
Share on other sites

stevendabuffman

Thanks biggrin.gif

So do I just paste this in to sannybuilder ?, I've edited but I've never made my own.

Is there a tutorial somewhere, because all I want is when he spawns, whenever and however he spawns the music will start and loop until he's gone.

Thanks again smile.gif

Link to comment
Share on other sites

QUOTE (stevendabuffman @ Thursday, Aug 16 2012, 18:36)



So do I just paste this in to sannybuilder ?, I've edited but I've never made my own.
Is there a tutorial somewhere, because all I want is when he spawns, whenever and however he spawns the music will start and loop until he's gone.




is that a joke? notify.gif








[table]

CLEO Script Tutorial
english language
CLEO Script Tutorial deutschsprachig

 

INDEX

 


The first 6 chapters are written in this first post, below of the index

 

[/table]
[table]Chapterlesson
First Steps in Cleo scripting with Sannybuilder- Start for newbiesThe Editor- The main functions
- Option: different view of the decompiled code
- Classes and Keywords

Data types- locals @, globals $, "strings 'and hash # to enter modelname
Scripting/Writing a Thread

coding in praxis,
a must-read for newbies
- Using conditional checks
- The IF - Variation
- Script structure simple
- Script structure extended
- Script exemble: Slowmotion
- Spawn a 3D model
- Placing cars by using parked_car_generator

Special Particularities in Cleo- enable_thread_saving
- special cleo global var
- Script Exemble by using Special Global Cleo Variable/ Store a car at any place
- Template for Cleo Mission Script

gosub ... to read a subscript- basic knowledge to understand mission scripts
[/table] Edited by ZAZ
Link to comment
Share on other sites

 

No, why ?

because this is the tutorial but you have to start at the first post und study the lessons

Link to comment
Share on other sites

Hello Zaz, i have just started modding and i would like to know if there any way to make an actor stand without moving on my coords and when i come near him he talk to me like drug dylers you can reply Y or N but if i press Y he give me beer and i can drink it. Is it possible? confused.gif

 

Sorry for bad english (if it's bad. )

Link to comment
Share on other sites

Hello Zaz, i have just started modding and i would like to know if there any way to make an actor stand without moving on my coords and when i come near him he talk to me like drug dylers you can reply Y or N but if i press Y he give me beer and i can drink it. Is it possible? confused.gif

 

Sorry for bad english (if it's bad. )

yes

Link to comment
Share on other sites

Hello Zaz, i have just started modding and i would like to know if there any way to make an actor stand without moving on my coords and when i come near him he talk to me like drug dylers you can reply Y or N but if i press Y he give me beer and i can drink it. Is it possible? confused.gif

 

Sorry for bad english (if it's bad. )

yes

How I do it ? sarcasm.gifwhatsthat.gif

Link to comment
Share on other sites

 

Hello Zaz, i have just started modding and i would like to know if there any way to make an actor stand without moving on my coords and when i come near him he talk to me like drug dylers you can reply Y or N but if i press Y he give me beer and i can drink it. Is it possible? confused.gif

 

Sorry for bad english (if it's bad. )

yes

How I do it ? sarcasm.gifwhatsthat.gif

learn scripting, start at the first post und study the lessons

write a script to spawn actor, then come back and post your script

Link to comment
Share on other sites

 

{$CLEO .cs}:Actor03A4: name_thread "ACTOR"0001: wait  1000 ms0A95: enable_thread_saving0247: request_model #VBFYCRPrepeat   wait 0   if       0248:   model #VBFYCRP available   then       break   enduntil false009A: 0@ = create_actor 4 #VBFYCRP at -2347.7383 639.5254 42.0732 angle  180.00A93: end_custom_thread

 

 

Thats my script.

 

P.S. Angle doesnt work confused.gif

Link to comment
Share on other sites

009A has no angle parameter. You have to set it using 0173.

Link to comment
Share on other sites

You use it wrong then.

Link to comment
Share on other sites

 

009A: 0@ = create_actor  4 #VBFYCRP at  -2347.7383 639.5254 42.070173: set_actor 0@ Z_angle_to 180.0

 

 

and remove 0A95: enable_thread_saving, you don't need it in this case

Link to comment
Share on other sites

and add

 

0249: release_model #VBFYCRP

 

above 0A93, it will free up the model.

Link to comment
Share on other sites

Thanks ZAZ but now i need to make him give me beer when i press Y OR better spawn an gui [menue] and i can choose drink or smoke.

 

 

Silent , i don't need it to move.

Edited by kalonkas
Link to comment
Share on other sites

 

Thanks ZAZ but now i need to make him give me beer when i press Y OR better spawn an gui [menue] and i can choose drink or smoke.

 

 

Silent , i don't need it to move.

are you impatient? biggrin.gif

you'll need one more loop

 

but please improve first your current script

start the script with a default loop which checks if $PLAYER_CHAR is defined, opcode 0256:

as well a condition which must be passed to spawn your actor

a keypress check or if player is near the spawn location

 

Consider that the map isn't solid everywhere

collisions models a working only in the players range of 300 units

actors are falling down to nirwana if the player is far away

 

opcode 0256: should prevent crashes if the player dies or gets arrested

 

furthermore does your script need a cleanup part

Release the defined actor from script when the script has done its work with opcode 01C2: or 009B: or 034F:

after that can you let the code jump back to beginning so that the whole script runs in a loop instead end_thread

 

Link to comment
Share on other sites

Yes, i'm a bit impatient biggrin.gif

 

 

Now my script looks better?

 

 

{$CLEO .cs}:Actor03A4: name_thread "ACTOR":Actor_10001: wait  1000 ms0256:   player $PLAYER_CHAR defined004D: jump_if_false @Actor_1if00FE:   actor $PLAYER_ACTOR  0 (in-sphere)near_point -2347.7383 639.5254 42.07 radius  80.5  80.5  80.5004D: jump_if_false @Actor_10247: request_model #VBFYCRPrepeat   wait 0   if       0248:   model #VBFYCRP available   then       break   enduntil false009A: 0@ = create_actor  4 #VBFYCRP at  -2347.7383 639.5254 42.070173: set_actor 0@ Z_angle_to 180.00249: release_model #VBFYCRP0A93: end_custom_thread

 

Edited by kalonkas
Link to comment
Share on other sites

 

Now my script looks better?

yes, a little bit

wait 1000 is to much, wait 0 is enough

also the code to remove reference is missing

 

maybe you wanna keep the high level lang, have look to the script below

test it, kill the actor and see what happens

 

{$CLEO .cs}:Actor_103A4: name_thread 'Actor'while truewait 0   if       0256:   player $PLAYER_CHAR defined   then       if           00FE:   actor $PLAYER_ACTOR  0 (in-sphere)near_point -2347.7383 639.5254 42.07 radius  80.5  80.5  80.5       then           0247: request_model #VBFYCRP           repeat           wait 0               if                   0248:   model #VBFYCRP available               then                   break               end           until false           009A: 0@ = create_actor  4 #VBFYCRP at  -2347.7383 639.5254 42.07           0173: set_actor 0@ Z_angle_to 180.0           0249: release_model #VBFYCRP           while   0256:   player $PLAYER_CHAR defined           wait 0               if                   8118: not  actor 0@ dead                then                   // dealer script               else                   break               end           end           01C2: remove_references_to_actor 0@       end   endend

 

Link to comment
Share on other sites

Cool, now it respawns when i kill him.

 

And another thing, i've put " bar_ufo " with MEd , as the rest of my base, but near that bar always spawns random actors, any way to dont make em spawn there?

Link to comment
Share on other sites

 

Cool, now it respawns when i kill him.

yes, but that should not happen

you have to add a loop after 01C2: remove_references_to_actor 0@ which checks if player_actor is not near_point -2347.7383 639.5254 42.07

 

 

And another thing, i've put " bar_ufo " with MEd , as the rest of my base, but near that bar always spawns random actors, any way to dont make em spawn there?

maybe it's an object which have an extention to spawn actors

Link to comment
Share on other sites

Which loop should i use?

 

 

00FE:   actor $PLAYER_ACTOR  0 [b]not[/b] (in-sphere)near_point -2347.7383 639.5254 42.07 radius  80.5  80.5  80.5

 

 

biggrin.gif?

 

 

 

80EC:   not actor $PLAYER_ACTOR 0 near_point 1812.369 -1929.922 radius 500.0 500.0 

 

 

I've found this, is it good?

 

 

 009A: 0@ = create_actor  4 #VBFYCRP at  -2347.7383 639.5254 42.07          0173: set_actor 0@ Z_angle_to 180.0          0249: release_model #VBFYCRP          while   0256:   player $PLAYER_CHAR defined          wait 0                  8118: not  actor 0@ dead                   if                  80EC:   not actor $PLAYER_ACTOR 0 near_point -2347.7383 639.5254 42.07 radius 80.5 80.5                                 then                  // dealer script

 

 

 

not working, actor stays in air confused.gif

 

 

 

 

 

while   0256:   player $PLAYER_CHAR defined          wait 0          if                  8118: not  actor 0@ dead                                                            then                  // dealer script              else                  break              end          end                     if                  80EC:   not actor $PLAYER_ACTOR 0 near_point -2347.7383 639.5254 42.07 radius 80.5 80.5                  then          01C2: remove_references_to_actor 0@      end  endend

 

 

GTA sa crashes when i load savegame.

Edited by kalonkas
Link to comment
Share on other sites

a loop, not only a check

like this

 

            while  00EC:   actor $PLAYER_ACTOR 0 near_point -2347.7383 639.5254 42.07 radius 85.5 85.5           wait 0           end

 

 

or this

 

            repeat           wait 0           until 80EC: not  actor $PLAYER_ACTOR 0 near_point -2347.7383 639.5254 42.07 radius 85.5 85.5

 

Link to comment
Share on other sites

 

{$CLEO .cs}:Actor_103A4: name_thread 'Actor'while truewait 0  if      0256:   player $PLAYER_CHAR defined  then      if          00FE:   actor $PLAYER_ACTOR  0 (in-sphere)near_point -2347.7383 639.5254 42.07 radius  80.5  80.5  80.5      then          0247: request_model #VBFYCRP          repeat          wait 0              if                  0248:   model #VBFYCRP available              then                  break              end          until false          009A: 0@ = create_actor  4 #VBFYCRP at  -2347.7383 639.5254 42.07          0173: set_actor 0@ Z_angle_to 180.0          0249: release_model #VBFYCRP          while   0256:   player $PLAYER_CHAR defined          wait 0                     if                  8118: not  actor 0@ dead               then                  // dealer script              else                  break              end          end          01C2: remove_references_to_actor 0@           repeat          wait 0          until 80EC: not  actor $PLAYER_ACTOR 0 near_point -2347.7383 639.5254 42.07 radius 85.5 85.5      end  endend

 

 

Now actor dies.

 

Need more cleans or i can script dealer script [ with reply Y or N] biggrin.gif? And how do i start, with which op code or loop?

Link to comment
Share on other sites

looks good, just one thing: there should also be a check if player_actor is near_point -2347.7383 639.5254 42.07 together with the check if actor dead

because in the case, that the player comes to that area and the actor spawns but the player leaves then the location, should the actors reference be removed and the script should run in the default loop

to spare performance

 

 

            while   0256:   player $PLAYER_CHAR defined           wait 0               if  and                   8118: not  actor 0@ dead                   00FE:   actor $PLAYER_ACTOR  0 (in-sphere)near_point -2347.7383 639.5254 42.07 radius  85.5  85.5  85.5                then                   // dealer script               else                   break               end                       end

 

if there are more than one conditions in a check, it needs to determine if it means OR or AND

 

 

 

And how do i start, with which op code or loop?

you can use this script and expand it

at that position where i wrote "// dealer script" will we add the action

it needs to build sequences:

check if player stand close to the actor to show a message

check if key pressed to give the bottle

 

it needs also to spawn a bottle first

do you know the modelname or id number of a bottle?

 

should there be used specified deal animations?

it needs also to load animations first

read about Animations

 

should there be a special camera view during the deal?

Link to comment
Share on other sites

Thanks blush.gif

 

So bottle id is : ? I don't know, going to search now.

Animation should be of CJ drinking like gang members and if drink too much he gets drunk (camera start moving) http://www.gtagarage.com/mods/show.php?id=201 like in this mod. I havent tried this mod, just saw it. I want animation like on gta samp on roleplay servers , when get drunk camera start shaking, moving and even when u go in a car its alot harder to drive.

Edited by kalonkas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.