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. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    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 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 Mods
    10. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA 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

Sign in to follow this  
jemahuk1

Questions!

Recommended Posts

trickstar34

 

Just made a simple script:

 

:EFFECTrepeatwait 100until 00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot08B2: enable_thermal_vision 1repeatwait 100until 80F2:   not actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0jump @EFFECT

 

Didn't test it, your job.

 

Lol, forgot to put a wait.

 

Fixed

 

:EFFECTwait 0repeatwait 100until 00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot08B2: enable_thermal_vision 1repeatwait 100until 80F2:   not actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0jump @EFFECT

 

 

 

I think this is a good example so I am going to quote it

 

OK, a sub script is basically the SCM equivalent of a high-level user defined function, I figured this out when I first noticed the return. When you call a sub script it does whatever you defined it as in its label. I'll give an example of a re-usable sub script.

 

Lets pretend this is my FXT

 

EXAMPLE The square root of ~1~ is ~1~

 

 

 

{$CLEO .cs}thread "EXAMPLE"// This is a mathematic operation// I am using [email protected] and [email protected] as [email protected] = 4gosub @SQRRT02FD: show_text_2numbers_lowpriority GXT 'EXAMPLE' numbers [email protected] [email protected] time 5000 flag 1jump @END:SQRRT01FB: [email protected] = square_root [email protected]:END0A93: end_custom_thread

 

 

The sub script computes the square root of [email protected], then returns the value in the variable [email protected] and then it displays the text "The square root of 4 is 2"

Edited by trickstar34

Share this post


Link to post
Share on other sites
PatrickW
Lol, forgot to put a wait.

 

Fixed

 

Nonsense, that wait isn't needed. The repeat-until below already contains the necessary wait.

There is one thing missing though, and that is the opcode to switch off thermal vision, when you leave the proximity of the actor.

Thus:

:EFFECTrepeatwait 100until 00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot08B2: enable_thermal_vision 1repeatwait 100until 80F2:   not actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 008B2: enable_thermal_vision 0jump @EFFECT

 

 

And why you should want to quote your own example, without further commenting on it, is a mystery to me.

 

Share this post


Link to post
Share on other sites
trickstar34

hmmm, didn't know that till now, thought it might crash since it's jumping back.

Share this post


Link to post
Share on other sites
Dutchy3010
hmmm, didn't know that till now, thought it might crash since it's jumping back.

No, it won't.

 

@ Patrick: indeed, I forgot to get the player out of the thermal mode. mercie_blink.gif

Share this post


Link to post
Share on other sites
jemahuk1

Hey, what's the difference between this :

 

 

actor.destroyinstantly

 

 

and

 

 

actor.destroywithfade

 

 

 

 

07A1: set_walk_speed 10

 

 

Is this code means that the actor will move fast? (Not only walking, but also running speed)

Share this post


Link to post
Share on other sites
Deji
Hey, what's the difference between this :

 

 

actor.destroyinstantly

 

 

and

 

 

actor.destroywithfade

 

 

 

 

07A1: set_walk_speed 10

 

 

Is this code means that the actor will move fast? (Not only walking, but also running speed)

The first one just makes the actor dissapear, instantly.

 

The second one he fades away like a ghost or something.

 

(By the way, could this be used to make ghost like-actors with memory access?)

 

The set_walk_speed, I don't know well. The few times I tried it, nothing happened. It's supposed to make you walk faster. I don't think it improves running speed though.

Share this post


Link to post
Share on other sites
jemahuk1

I still not understand about 'fade' (eventhought I already read mission coding for dummies). I see they usually written like this : fade 1 1000 or fade 0 1000

- What's the function?

- How to use that?

- What's the meaning of that 1 and 1000?

- Please give me a simple example for that fade.

 

Thank you! icon14.gificon14.gif

 

Share this post


Link to post
Share on other sites
Deji
I still not understand about 'fade' (eventhought I already read mission coding for dummies). I see they usually written like this : fade 1 1000 or fade 0 1000

- What's the function?

- How to use that?

- What's the meaning of that 1 and 1000?

- Please give me a simple example for that fade.

 

Thank you! icon14.gificon14.gif

You are getting 2 different opcodes completely mixed up. It'd probably help if you used opcode scripting instead of the function.function() way of doing things wink.gif

 

 

034F: destroy_actor_with_fade [email protected]

 

 

This does as I said, makes the character fade away and destroys him ready for releasing.

 

 

016A: fade 0 time 1000

 

 

This fades out the screen. Like when you start a mission and it fades black.

 

If you set:

 

 

fade 0

 

 

To:

 

 

fade 1

 

 

It would fade in instead of fading out to black. This is used after fade 0.

 

The next parameter specify's how long it should fade for.

 

 

time 1000

 

 

Here it would spend a second fading. This is usually set to 500 (half a second) for a quick, simple fade.

 

If you set it to:

 

 

time 0

 

 

The screen would just turn black, without fading for even a millesecond.

 

 

 

I would suggest reading these tutorials:

 

Coding Bible I

Coding Bible II

 

These are the tutorials I went through and they're very good smile.gif

Share this post


Link to post
Share on other sites
jemahuk1

Nice! icon14.gificon14.gif What an awesome tutorial! I think I'll read this for a few hours!

Thanks, man! icon14.gificon14.gificon14.gif

Share this post


Link to post
Share on other sites
james227uk

I can confirm the REPEAT-WAIT-UNTIL problems. I simply do not need them. Seriously, I had a correct structure, yet sanny refused to compile.

 

@Deji

 

That fade opcode has never worked for me. Ever.

Share this post


Link to post
Share on other sites
Deji
I can confirm the REPEAT-WAIT-UNTIL problems. I simply do not need them. Seriously, I had a correct structure, yet sanny refused to compile.

 

@Deji

 

That fade opcode has never worked for me. Ever.

Have you checked the Sanny settings?

 

I personally doint use the repeat, until and while functions. I just find that they complicate the matter. What's more, I only use if...then...else...end if I either can't be bothered making a new thread or there is alot of them that need doing. My Furniture mod has to browse through hundereds of items so I added alot of if's for each item, so for this I used if...then...end along with the Find and Replace to do it all easily.

 

Personally, I pefer to know that what I type, is what it will compile as.

 

I can't see why the fade of all things wouldn't work mercie_blink.gif

Share this post


Link to post
Share on other sites
james227uk

Me too. I find it quicker to type IF...JF than the repeat structure.

Share this post


Link to post
Share on other sites
jemahuk1

I have no idea how to code the actors to spawn repeatedly until 5000 ms then stop spawning! Can you help me with this? cryani.gif

Thanks! icon14.gif

Share this post


Link to post
Share on other sites
trickstar34

Show what you tried so I can get a better idea of what you want.

Share this post


Link to post
Share on other sites
jemahuk1

 

{$CLEO  .cs}thread 'H':LOADwait 0Model.Load(#WFYLG)Model.Load(#WFYJG)Model.Load(#M4)if and   MODEL.Available(#WFYLG)   Model.Available(#M4)   Model.Available(#WFYJG)jf @LOADActor.Health($PLAYER_ACTOR) = 500Actor.Armour($PLAYER_ACTOR) = 50001B2: give_actor $PLAYER_ACTOR weapon 31 ammo 890 // Load the weapon model before using this [email protected] = actor.Create(CivFemale, #WFYLG, 2488.7537, -1656.54, 13.3669)Actor.Angle([email protected]) = 180.0Actor.Health([email protected])= 5000Actor.Armour([email protected])= [email protected] = actor.Create(CivFemale, #WFYJG, 2481.0842, -1661.2748, 13.3437)actor.Angle([email protected]) = 240.1805actor.Health([email protected])= 5000actor.Armour([email protected])= 5000:ATTACK05E2: AS_actor [email protected] kill_actor $PLAYER_ACTORActor.WeaponAccuracy([email protected]) = 10000946: set_actor [email protected] actions_uninterupted_by_weapon_fire 107A1: set_walk_speed 1005E2: AS_actor [email protected] kill_actor $PLAYER_ACTORActor.WeaponAccuracy([email protected]) = 10000946: set_actor [email protected] actions_uninterupted_by_weapon_fire 107A1: set_walk_speed 10wait 2500jf @ATTACKjump @LOADwait 5000end_threadjump @DESTROY:DESTROYwait 0if   actor.Dead([email protected])   actor.Dead([email protected])jf @DESTROY2:DESTROY2    actor.DestroyInstantly([email protected])              actor.DestroyInstantly([email protected])jf @DESTROY      

 

 

Like this.

Share this post


Link to post
Share on other sites
trickstar34

What is the point of it? Just spawn two of them, if your trying to spawn them until 5 seconds is up then your going to get a crash for using a variable without Removing References or destroying it, and if you were to get this to not crash for that reason, the game would spawn an army of them by spawning one for evey milisecond, thus spawning 5000 targets would overflow the game big time, and CLEO scriptss can only handle 34 variables, 32 locals and two local timers

 

[email protected]@ = locals

[email protected] and [email protected] = timers

Share this post


Link to post
Share on other sites
Dutchy3010

There are a few basic faults in that script:

 

wait 2500jf @ATTACK

 

I couldn't find the if that belongs to the jf, and I couldn't find a condition for this.

 

 

jump @LOADwait 5000end_threadjump @DESTROY

 

Two things about this. First, it will never access the code after jump @LOAD, since it jumps to another part every time the code is there. Second, never use end_thread in a normal CLEO file. You are lucky that the code didn't access that part, else it would have been a crash for sure.

 

 

:DESTROYwait 0if  actor.Dead([email protected])  actor.Dead([email protected])jf @DESTROY2:DESTROY2    actor.DestroyInstantly([email protected])              actor.DestroyInstantly([email protected])jf @DESTROY

 

This structure is a bit strange. First, you check if the actors are dead. But it isn't important, because when de conditions aren't true it will go further with DESTROY2 (there isn't a condition which stops that) and when the actors are dead, he will jump to destroy2... So in this case, it doesn't work at all. You have to change the first jf @destroy2 into jf @destroy. Then the DESTROY2 label. That code isn't good too. There isn't a condition for the jf. Besides, you can only destroy the actors once. So it will probably crash when you want to destroy them again. Finally, you forgot the following opcode:

 

0A93: end_custom_thread

 

This is necessary when the code really ended.

 

I advise you to read some more tutorials, besides the tutorials Deji gave you. You can read mission coding for dummies, it will help you to make a mission step by step. You can also read the CLEO Script Tutorial (by ZAZ). Like I always say: you can better learn the structures first. Many people want to code a mission or such immediately, but almost nobody can do that. First learn the structures, then try to make a mission. It will prevent lots of problems. wink.gif Good luck!

Share this post


Link to post
Share on other sites
trickstar34

And don't be a literal dummy and try to do advanced things before you even learn the basics. wink.gif

Share this post


Link to post
Share on other sites
jemahuk1

How many actors can be spawned in Cleo script?

Share this post


Link to post
Share on other sites
Deji
How many actors can be spawned in Cleo script?

You can spawn as many actors, cars... Anything as you want. As long as you have enough variables to fit them all in... I don't believe there is a limit, but I think the game would get slow if you spawned alot (say... 100+?)

Share this post


Link to post
Share on other sites
Dutchy3010

It will crash when you create a lot of actors at the same time. Did it once as a test, and it crashed. Don't remember the exact amount, though.

Share this post


Link to post
Share on other sites
trickstar34

As long as you remove references you can get up to 50, but any higher will result in a crash. If you just want actors to still kill CJ, only 32.

Share this post


Link to post
Share on other sites
jemahuk1

What's the code to stop actor spawning repeatedly?

Share this post


Link to post
Share on other sites
Dutchy3010

You just have to make sure that the code doesn't read the opcode twice. For example:

 

:startwait 0...009A: [email protected] = create_actor_pedtype 4 model #MALE01 at 0.0 0.0 0.0 ...jump @start

 

If you would make a code like this, the actor would spawn more then once, because that opcode is in a loop. Then you should make it like this:

 

009A: [email protected] = create_actor_pedtype 4 model #MALE01 at 0.0 0.0 0.0 :startwait 0...jump @start

 

Bit difficult to explain without a real code, but if you have problems then you can post your own script and we will help. smile.gif

 

Share this post


Link to post
Share on other sites
12jango

Wow! Nice! icon14.gif

 

 

Share this post


Link to post
Share on other sites
jemahuk1

 

{$CLEO .cm}thread 'M'01F0: set_max_wanted_level_to 000C0: set_current_time_hours_to 23 minutes_to 0actor.PutAt($PLAYER_ACTOR, 1008.1371, -338.1638, 73.9922)actor.Angle($PLAYER_ACTOR) = 278.5325actor.Health($PLAYER_ACTOR) = 500gosub @MISSIONend_thread:MISSIONincrement_mission_attempts0180: set_on_mission_flag_to $ONMISSION // Note: your missions have to use the variable defined here $ONMISSION = 1 wait 2000:MODEL_LOADwait 0model.Load(#M4)model.Load(#WFYLG)model.Load(#WFYJG)model.Load(#WMYCON)if   model.Available(#M4)  model.Available(#WFYJG)else_jump @MODEL_SPAWNjf @MODEL_LOAD01B2: give_actor $PLAYER_ACTOR weapon 31 ammo 580:[email protected] = actor.Create(Special, #WFYLG, 1021.7327, -315.6614, 73.9922)actor.Angle([email protected])=138.1523actor.Health([email protected])= 5000actor.Armour([email protected])= 500005E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR0446: set_actor [email protected] immune_to_headshots 10946: set_actor [email protected] actions_uninterupted_by_weapon_fire 1marker.CreateAboveActor($Mark1, [email protected]):DEADif   actor.Dead([email protected])jump @ENEMY1wait 3000jump @STOP:STOPend_thread       

 

 

You see that STOP label. I'm thinking to put some code that will stop actor [email protected] from spawning repeatedly after 3000 ms, but I don't know what's that code. Please, help me with this. (Actually, I'm still learning, and do some experiments before making my own cm) Thank you very much! icon14.gif

Edited by jemahuk1

Share this post


Link to post
Share on other sites
Dutchy3010

Pretty easy sollution is changing:

 

:DEADif  actor.Dead([email protected])jump @ENEMY1

 

Into:

 

:DEADwait 100if  actor.Dead([email protected])jf @DEAD

 

 

Don't forget the wait. wink.gif

 

BTW, if-jump isn't a good structure itself...

Share this post


Link to post
Share on other sites
jemahuk1

Err...Dutchy, I meant I wanted actor [email protected] to spawn repeatedly then after 3000 ms, the loop is stopped, so there will be no spawning actor [email protected] anymore. (The actors that have spawned before 3000 ms still there) cryani.gif

Share this post


Link to post
Share on other sites
Dutchy3010

Then I would just make a completely different script, because when you create more than one actor with the same variable, you can only do things with the last one. So when you want to make 10 actors, I would just spawn them all 10. If you want to use time, you can also choose for the local timers, [email protected] and [email protected] Make them 0, and they will count. So you can make something like this:

 

if0019:   [email protected] > 3000 jf @...

 

Then you can do things while waiting. With a wait, you aren't able to do other things, the code just stops for 3 seconds.

Share this post


Link to post
Share on other sites
james227uk

What is wrong with IF--JF ? It's never caused me any problems.

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.

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.

Sign in to follow this  

  • 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.