Jump to content

Cleo Chidori Eisou help


Briangangsta

Recommended Posts

Briangangsta

I am a really nooby coder. I was wondering if anyone could help me correct a mod that i made.

 

So bascially i want the mod so that if u press "H", then it will give u a katana. But i want the katana model to be inviisible and with the particle electricar around it. Here is my progress so far:

 

 

 

 

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

 

{$VERSION 3.1.0027}

{$CLEO .cs}

 

//-------------MAIN---------------

03A4: name_thread 'Eisou'

 

:Eisou_11

0001: wait 0 ms

00D6: if

0247: load_model #KATANA

038B: load_requested_models

004D: jump_if_false @Eisou_12

 

:Eisou_12

0001: wait 0 ms

00D6: if

0248: model #KATANA available

0AB0: key_pressed 72

004D: jump_if_false @Eisou_11

01B2: give_actor $PLAYER_ACTOR weapon 8 ammo 1 // Load the weapon model before using this

04C4: store_coords_to 24@ 25@ 26@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0

0107: 0@ = create_object #KATANA at 24@ 25@ 26@

070A: AS_actor $PLAYER_ACTOR attach_to_object 0@ offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1

0750: set_object 0@ visibility 0

066E: create_particle "ELECTRICNAR" attached_to_object 0@ with_offset 0.1 0.0 31@ rotation 90.0 0.0 90.0 flag 1 handle_as 1@(30@,1i)

064C: make_particle 1@(30@,1i) visible

 

 

 

 

 

However this keeps on crashing

 

can u help me fix this please??

thanks

Link to comment
Share on other sites

If you're a noobie then read this tutorial:

http://www.gtaforums.com/index.php?showtopic=403790

It's the most simpliest explaination of scm coding basics - that helped me a lot when I started with scrypting.

By the way if you work with key_pressed numbers check out the Sanny Builder help (scm documentation-GTA SA-Keypress numbers).

Edited by JACK JONES
Link to comment
Share on other sites

MichaelKnight1

No. You can Use code 07FE to put actor Method of fighting , this is Bat & Shovel .

 

07FE: set_actor $PLAYER_ACTOR fighting_style_to 8 6 

 

Link to comment
Share on other sites

Briangangsta
No. You can Use code 07FE to put actor Method of fighting , this is Bat & Shovel .

 

07FE: set_actor $PLAYER_ACTOR fighting_style_to 8 6 

 

but does it work with katana? and where do i need to put the fightstyle code

Link to comment
Share on other sites

MichaelKnight1
No. You can Use code 07FE to put actor Method of fighting , this is Bat & Shovel .

 

07FE: set_actor $PLAYER_ACTOR fighting_style_to 8 6 

 

SI I SUGGEST YOU LEARN CODING

Link to comment
Share on other sites

I have no idea if this will work, Rarely do object based coding nevertheless I attempted to produce what I hope is the correct code:

 

 

{$CLEO .cs}0000::10247: load_model #KATANA038B: load_requested_models :Eisou_12wait 0if and0248: model #KATANA available
0AB0:  key_pressed 0x48jf @101B2: give_actor $PLAYER_ACTOR weapon 8 ammo 1 // Load the weapon model before using this04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.00107: $KAT = create_object #KATANA at $1 $2 $30609A0: actor $PLAYER_ACTOR attach_object $KAT with_offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1  0750: set_object $KAT visibility 0066E: create_particle "ELECTRICNAR" attached_to_object $KAT with_offset 0.1 0.0 0.0 rotation 90.0 0.0 90.0 flag 1 handle_as 1@(30@,1i)064C: make_particle 1@(30@,1i) visibleend_thread

 

 

P.S - Yes i know I used global variables, Don't need another 'Coding wannabe' explaining to me how I shouldn't use them.

That is in no way an offense to the people who actually understand coding!

 

 

SI I SUGGEST YOU LEARN CODING

 

Dude, You don't even know coding, You cannot go around telling people to 'Learn coding' when you yourself needs to learn it plus you didn't even provide any links to tutorials and such

 

Tutorials:

Go here for a bunch of coding tutorials

 

Edited by The_Sorrow
Link to comment
Share on other sites

Ashwin.Star

Ahh Sorrow!

 

0609A0:

 

------

his suggested script is Right,

just edit this

 

:10247: load_model #KATANA038B: load_requested_models :Eisou_12wait 0if and0248: model #KATANA available
0AB0:  key_pressed 0x48jf @1  //<--- make it jump to :Eisou_12,

 

because when you loop requesting a Model, the game Becomes too Slow

Edited by Ashwin the new boy
Link to comment
Share on other sites

Forgive me if I'm wrong guys but it's a CLEO thread - doesn't he need

 

0A93: end_custom_thread

 

instead of

 

end_thread

 

Link to comment
Share on other sites

Ashwin.Star

@JACK JONES

You are right icon14.gif

Thread opcodes can make the game Crash if used in Cleo

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

i forgot that everyone is not using my Keyword.txt tounge.gif

Link to comment
Share on other sites

@Sorrow

@OP

When you use 038B: load_requested_models you haven't to check if model is available, sure that it's available, in the case the checking if model is available is useless.

Edited by Link2012
Link to comment
Share on other sites

@Sorrow

When you use 038B: load_requested_models you haven't to check if model is available, sure that it's available, in the case the checking if model is available is useless.

I get you, but i quickly scripted this

Link to comment
Share on other sites

P.S - Yes i know I used global variables, Don't need another 'Coding wannabe' explaining to me how I shouldn't use them.

That is in no way an offense to the people who actually understand coding!

Well, not only did you use global variables, but you used $1 and $2. Now global variables are bad enough, but without using new ones properly defined in the CustomVariables.ini file, you're asking for trouble. Also, you used end_thread (004E) in a CLEO Script, which is also baaaad. And why use globals when you've plenty of locals?

 

Actually, I guess even I used to make these crappy mistakes and even ignored several people advising me against them. I'd soon discover all my mods were buggy and generally failed in a lot of areas. I coulda listened to the people who had already made the discoveries, but perhaps jumping off a cliff into a sea of sharks is a learning step... So keep going!

 

Also, '0609A0' is not an opcode tounge2.gif I'll assume you meant 09A0. And you probably don't know this, but that was probably a wise choice over 070A. They're nearly identical, except that 070A seems to set a task that affects the characters behaviour. I recall many bugs I had with my old, badly coded scripts which would've probably been solved by knowing this. So by blabbering on, I'll maybe help one or two people.

 

Anyway, your code, made parsable and then decompiled:

 

0000: NOP :Noname_20247: load_model #KATANA 038B: load_requested_models 0001: wait 0 ms 00D6: if 0AB0:   key_pressed 72 004D: jump_if_false @Noname_2 01B2: give_actor $PLAYER_ACTOR weapon 8 ammo 1 // Load the weapon model before using this 04C4: store_coords_to $1557 $PLAYER_CHAR $PLAYER_ACTOR from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 0107: $1558 = create_object #KATANA at $1557 $PLAYER_CHAR $PLAYER_ACTOR 070A: AS_actor $PLAYER_ACTOR attach_to_object 0@ offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1 09A0: actor $PLAYER_ACTOR attach_object 26@ with_offset 0.0 0.0 0.0 on_bone 5 16 perform_animation "NULL" IFP_file "NULL" time -1 0750: set_object $1558 visibility 0 066E: "ELECTRICNAR" = create_particle $1558 attached_to_object 0.1 with_offset 0.0 0.0 90.0 rotation 0.0 90.0 1 flag 1@(30@,1i) 064C: make_particle 1@(30@,1i) visible 004E: end_thread

 

 

And look, some of the bad results of using global variables are clear:

 

04C4: store_coords_to $1557 $PLAYER_CHAR $PLAYER_ACTOR from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 

 

 

$1 was compiled at $1557, which Sanny must've chosen based on my CustomVariables.ini as the next appropriate place for a global variable (which is fine, if we're basing it on the main.scm, but no, we're in CLEO). $2 is always $PLAYER_CHAR and $3 is always $PLAYER_ACTOR. So yeah, global variables... bad.

 

This may seem like a lot of effort on my part to simply change your opinion, but unlike with certain people round here *cough* (who probably won't catch on), I consider it possible to actually teach you something.

 

 

Another long post, lecture and a fun fact of the day by Deji. I apologise. I don't like messing with others' scripts (nowadays I only mess with v2 source codes, lol), but I hope the OP gets a working version of the script.

Link to comment
Share on other sites

But what if someone who makes a CLEO scrypt for VC (where we have 15 locals+timers) suddenly needs more than 15 variables (for actors, cars, markers...) but he can't use globals because it's a CLEO scrypt? Is there some alternative CLEO solution for those cases?

Edited by JACK JONES
Link to comment
Share on other sites

Ashwin.Star

You should re-use them again!

For example:

 

00A5: 0@ = create_car 6005 at 1566.0 3620.0 60.0////// if you think there is not any other use of this car ////////0107: 0@ = create_object #COLT45 at 1654.0 2685.0 90.0

 

Link to comment
Share on other sites

Briangangsta

Deji,

 

That code didn't work, it crashes when i press H

Edited by Briangangsta
Link to comment
Share on other sites

 

But what if someone who makes a CLEO scrypt for VC (where we have 15 locals+timers) suddenly needs more than 15 variables (for actors, cars, markers...) but he can't use globals because it's a CLEO scrypt? Is there some alternative CLEO solution for those cases?

VC, not sure. Can't recall if it supported proper arrays.

 

If so, then this may interest you. There is even a way to use named global variables as pointers to memory locations here. Perhaps there's a similar method that can be applied with VC.

 

Otherwise, there's always file or memory writing and reading and other smart uses of variables that can make variable limits a thing of the past.

 

 

Deji,

 

That code didn't work, it crashes when i press H

I never said it would. I did explain why I wasn't posting a modified version of the code at the end of the post, but I guess my long posts get skipped.

Edited by Deji
Link to comment
Share on other sites

@Briangangsta - Deji meant this:

Don't use sign $ (in CLEO) except for $PLAYER_CHAR, $PLAYER_ACTOR, $ONMISSION. Use sign @ (local variable). For example instead of $0 write 0@ (or 1@, 2@ ... 30@ - from 0@ up to 31@ is max, 32@ and 33@ are timers).

@Constance83 - nice try but you just copied and pasted from my reply.

 

:Constance0001: wait 0 ms 00D6: if Constance83 is trying to confuse JACK JONES004D: jump_if_false @ConstanceJACK JONES can't stop laughing

 

And Constance - don't say "wut" lol.gif

Edited by JACK JONES
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.