Quantcast

Jump to content

» «
Photo

Cleo Chidori Eisou help

18 replies to this topic
Briangangsta
  • Briangangsta

    Player Hater

  • Members
  • Joined: 02 Dec 2011

#1

Posted 16 April 2012 - 02:24 AM

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

Jack...
  • Jack...

    Firearms and adrenaline!!!

  • Members
  • Joined: 06 Dec 2011
  • None

#2

Posted 16 April 2012 - 06:30 AM Edited by JACK JONES, 16 April 2012 - 06:33 AM.

If you're a noobie then read this tutorial:
http://www.gtaforums...howtopic=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).

MichaelKnight1
  • MichaelKnight1

    Snitch

  • BUSTED!
  • Joined: 24 Mar 2012

#3

Posted 16 April 2012 - 08:34 AM

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

07FE: set_actor $PLAYER_ACTOR fighting_style_to 8 6

Briangangsta
  • Briangangsta

    Player Hater

  • Members
  • Joined: 02 Dec 2011

#4

Posted 16 April 2012 - 08:46 AM

QUOTE (MichaelKnight1 @ Monday, Apr 16 2012, 08:34)
No. You can Use code 07FE to put actor Method of fighting , this is Bat & Shovel .
CODE

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

MichaelKnight1
  • MichaelKnight1

    Snitch

  • BUSTED!
  • Joined: 24 Mar 2012

#5

Posted 16 April 2012 - 08:51 AM

QUOTE (MichaelKnight1 @ Monday, Apr 16 2012, 08:34)
No. You can Use code 07FE to put actor Method of fighting , this is Bat & Shovel .
CODE

07FE: set_actor $PLAYER_ACTOR fighting_style_to 8 6

SI I SUGGEST YOU LEARN CODING

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#6

Posted 16 April 2012 - 08:52 AM Edited by The_Sorrow, 16 April 2012 - 08:59 AM.

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:

CODE
{$CLEO .cs}
0000:

:1
0247: load_model #KATANA
038B: load_requested_models

:Eisou_12
wait 0
if and
0248: model #KATANA available[/QUOTE]
0AB0:  key_pressed 0x48
jf @1
01B2: give_actor $PLAYER_ACTOR weapon 8 ammo 1 // Load the weapon model before using this
04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0
0107: $KAT = create_object #KATANA at $1 $2 $3
0609A0: 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 0
066E: 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) visible
end_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!

QUOTE
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

Ashwin the new boy
  • Ashwin the new boy

    Back again...

  • Members
  • Joined: 14 Nov 2010
  • India

#7

Posted 16 April 2012 - 09:06 AM Edited by Ashwin the new boy, 16 April 2012 - 09:15 AM.

Ahh Sorrow!
CODE
0609A0:

------
his suggested script is Right,
just edit this
CODE

:1
0247: load_model #KATANA
038B: load_requested_models

:Eisou_12
wait 0
if and
0248: model #KATANA available[/QUOTE]
0AB0:  key_pressed 0x48
jf @1  //<--- make it jump to :Eisou_12,

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

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#8

Posted 16 April 2012 - 09:19 AM

Cheers for correcting me Ashwin icon14.gif

Jack...
  • Jack...

    Firearms and adrenaline!!!

  • Members
  • Joined: 06 Dec 2011
  • None

#9

Posted 16 April 2012 - 09:21 AM

Forgive me if I'm wrong guys but it's a CLEO thread - doesn't he need
CODE
0A93: end_custom_thread

instead of
CODE
end_thread

Ashwin the new boy
  • Ashwin the new boy

    Back again...

  • Members
  • Joined: 14 Nov 2010
  • India

#10

Posted 16 April 2012 - 10:50 AM

@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/2012
  • LINK/2012

    ...wasn't the year...

  • Members
  • Joined: 30 Jan 2011
  • Brazil

#11

Posted 16 April 2012 - 01:14 PM Edited by Link2012, 16 April 2012 - 01:35 PM.

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

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#12

Posted 16 April 2012 - 01:19 PM

QUOTE (Link2012 @ Monday, Apr 16 2012, 13:14)
@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

Deji
  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007

#13

Posted 16 April 2012 - 06:51 PM

QUOTE (The_Sorrow @ Monday, Apr 16 2012, 08:52)
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:
CODE
0000: NOP

:Noname_2
0247: 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:
CODE
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.

Jack...
  • Jack...

    Firearms and adrenaline!!!

  • Members
  • Joined: 06 Dec 2011
  • None

#14

Posted 17 April 2012 - 05:44 AM Edited by JACK JONES, 17 April 2012 - 06:56 AM.

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?

Ashwin the new boy
  • Ashwin the new boy

    Back again...

  • Members
  • Joined: 14 Nov 2010
  • India

#15

Posted 17 April 2012 - 08:12 AM

You should re-use them again!
For example:
CODE

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

Briangangsta
  • Briangangsta

    Player Hater

  • Members
  • Joined: 02 Dec 2011

#16

Posted 17 April 2012 - 08:57 AM Edited by Briangangsta, 17 April 2012 - 09:01 AM.

Deji,

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

Deji
  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007

#17

Posted 17 April 2012 - 10:02 PM Edited by Deji, 17 April 2012 - 10:08 PM.

QUOTE (JACK JONES @ Tuesday, Apr 17 2012, 05:44)
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.

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

Constance83
  • Constance83

    Player Hater

  • BUSTED!
  • Joined: 03 Apr 2012

#18

Posted 18 April 2012 - 06:56 AM

user posted imageThis post has been edited by JACK JONES on Monday, Apr 16 2012, 06:33

Jack...
  • Jack...

    Firearms and adrenaline!!!

  • Members
  • Joined: 06 Dec 2011
  • None

#19

Posted 18 April 2012 - 11:34 AM Edited by JACK JONES, 18 April 2012 - 11:45 AM.

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

:Constance
0001: wait 0 ms
00D6: if
Constance83 is trying to confuse JACK JONES
004D: jump_if_false @Constance
JACK JONES can't stop laughing

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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users