bmb Posted August 8, 2010 Share Posted August 8, 2010 Hi everyone, I'm trying to make my first simple cleo. It works great but I want to be able to restore the clothing the player had when the button is pressed to disable it. Doing a op code search for "clothes" I found these: 0793: save_player_clothes 0794: restore_player_clothes but it didn't work. is there a way to use something like Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected]) to make this work? Link to comment Share on other sites More sharing options...
Deji Posted August 8, 2010 Share Posted August 8, 2010 Eh? I can't understand how getting the actors coords would seem useful.. What did you have in mind? It'd probably help to post your script Link to comment Share on other sites More sharing options...
bmb Posted August 8, 2010 Author Share Posted August 8, 2010 Eh? I can't understand how getting the actors coords would seem useful.. What did you have in mind? Just using that code as an example, wondered if there was a code that uses local-string-variable to store what the $PLAYER_ACTOR is wearing. So it could be restored when the script is disabled. Link to comment Share on other sites More sharing options...
ZAZ Posted August 8, 2010 Share Posted August 8, 2010 (edited) Hi everyone, I'm trying to make my first simple cleo. It works great but I want to be able to restore the clothing the player had when the button is pressed to disable it. Doing a op code search for "clothes" I found these: 0793: save_player_clothes 0794: restore_player_clothes but it didn't work. every bodyparts changes are applied with opcode 070D: rebuild_player $PLAYER_CHAR now you can save the current skin with 0793: save_player_clothes, then change the skin and apply these with 070D: rebuild_player $PLAYER_CHAR and then restore to get the previous skin with 0794: restore_player_clothes070D: rebuild_player $PLAYER_CHAR is there a way to use something like Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected]) to make this work? Yes, i show you parts of the sanvice main.scm. Therefor it contains globals, please don't use globals in cleo scripts 08F7: get_player $PLAYER_CHAR bodypart 0 textureCRC_to $12160 modelCRC_to $12159 08F7: get_player $PLAYER_CHAR bodypart 1 textureCRC_to $12158 modelCRC_to $12157 08F7: get_player $PLAYER_CHAR bodypart 2 textureCRC_to $12156 modelCRC_to $12155 08F7: get_player $PLAYER_CHAR bodypart 3 textureCRC_to $12154 modelCRC_to $12153 08F7: get_player $PLAYER_CHAR bodypart 4 textureCRC_to $12152 modelCRC_to $12151 08F7: get_player $PLAYER_CHAR bodypart 5 textureCRC_to $12150 modelCRC_to $12149 08F7: get_player $PLAYER_CHAR bodypart 6 textureCRC_to $12148 modelCRC_to $12147 08F7: get_player $PLAYER_CHAR bodypart 7 textureCRC_to $12146 modelCRC_to $12145 08F7: get_player $PLAYER_CHAR bodypart 8 textureCRC_to $12144 modelCRC_to $12143 08F7: get_player $PLAYER_CHAR bodypart 9 textureCRC_to $12142 modelCRC_to $12141 08F7: get_player $PLAYER_CHAR bodypart 10 textureCRC_to $12140 modelCRC_to $12139 08F7: get_player $PLAYER_CHAR bodypart 11 textureCRC_to $12138 modelCRC_to $12137 08F7: get_player $PLAYER_CHAR bodypart 12 textureCRC_to $12136 modelCRC_to $12135 08F7: get_player $PLAYER_CHAR bodypart 13 textureCRC_to $12134 modelCRC_to $12133 08F7: get_player $PLAYER_CHAR bodypart 14 textureCRC_to $12132 modelCRC_to $12131 08F7: get_player $PLAYER_CHAR bodypart 15 textureCRC_to $12130 modelCRC_to $12129 08F7: get_player $PLAYER_CHAR bodypart 16 textureCRC_to $12128 modelCRC_to $12127 08F7: get_player $PLAYER_CHAR bodypart 17 textureCRC_to $12126 modelCRC_to $12125 0784: set_player $PLAYER_CHAR textureCRC 0 modelCRC 0 bodypart 13 0784: set_player $PLAYER_CHAR textureCRC 0 modelCRC 0 bodypart 16 087B: set_player $PLAYER_CHAR clothes_texture "PIMPTR" model "PIMPTR" body_part 17 070D: rebuild_player $PLAYER_CHAR 0784: set_player $PLAYER_CHAR textureCRC $12160 modelCRC $12159 bodypart 0 0784: set_player $PLAYER_CHAR textureCRC $12158 modelCRC $12157 bodypart 1 0784: set_player $PLAYER_CHAR textureCRC $12156 modelCRC $12155 bodypart 2 0784: set_player $PLAYER_CHAR textureCRC $12154 modelCRC $12153 bodypart 3 0784: set_player $PLAYER_CHAR textureCRC $12152 modelCRC $12151 bodypart 4 0784: set_player $PLAYER_CHAR textureCRC $12150 modelCRC $12149 bodypart 5 0784: set_player $PLAYER_CHAR textureCRC $12148 modelCRC $12147 bodypart 6 0784: set_player $PLAYER_CHAR textureCRC $12146 modelCRC $12145 bodypart 7 0784: set_player $PLAYER_CHAR textureCRC $12144 modelCRC $12143 bodypart 8 0784: set_player $PLAYER_CHAR textureCRC $12142 modelCRC $12141 bodypart 9 0784: set_player $PLAYER_CHAR textureCRC $12140 modelCRC $12139 bodypart 10 0784: set_player $PLAYER_CHAR textureCRC $12138 modelCRC $12137 bodypart 11 0784: set_player $PLAYER_CHAR textureCRC $12136 modelCRC $12135 bodypart 12 0784: set_player $PLAYER_CHAR textureCRC $12134 modelCRC $12133 bodypart 13 0784: set_player $PLAYER_CHAR textureCRC $12132 modelCRC $12131 bodypart 14 0784: set_player $PLAYER_CHAR textureCRC $12130 modelCRC $12129 bodypart 15 0784: set_player $PLAYER_CHAR textureCRC 0 modelCRC 0 bodypart 16 0784: set_player $PLAYER_CHAR textureCRC 0 modelCRC 0 bodypart 17 070D: rebuild_player $PLAYER_CHAR Edited August 8, 2010 by ZAZ CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Deji Posted August 8, 2010 Share Posted August 8, 2010 (edited) save/restore_player_clothes should work fine... You can't store the clothes texture in string variables using opcodes, but you can do much better! 08F7: get_player $PLAYER_CHAR bodypart 0 textureCRC_to [email protected] modelCRC_to [email protected] This will get the players clothes texture CRC... Meaning it will not use the huge amount of variable space that a string var does. Then use 087B to set the clothes texture. Edit: Zaz beat me to the post Edited August 8, 2010 by Deji Link to comment Share on other sites More sharing options...
bmb Posted August 9, 2010 Author Share Posted August 9, 2010 (edited) 070D: rebuild_player $PLAYER_CHAR That's the part of the puzzle I was missing. Didn't even think about having to rebuild the character again to restore C. J. no normal. It'd probably help to post your script This is just a little Disguise script I am working on. The Joke glasses at Bincos were of no use so I decided to give them one. When C. J. puts on the Groucho glasses and black sun hat his wanted level gets suspended and walks around being ignored by everyone. When removed he reverts back to normal. {$CLEO .cs}//-------------MAIN---------------thread 'DISGUISE' :DISGUISE_19wait 0 if Player.Defined($PLAYER_CHAR)jf @DISGUISE_19 0793: save_player_clothes if and0AB0: key_pressed 88 not Actor.Dead($PLAYER_ACTOR)jf @DISGUISE_19 wait 0 01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0 088A: actor $PLAYER_ACTOR perform_animation "COWER" IFP_file "PED" 8.0 loopA 0 lockX 1 lockY 1 lockF 1 limT -1 unknown 0 unknown 0 wait 150 Player.SetClothes($PLAYER_CHAR, "GROUCHO", "GROUCHOS", 15)Player.SetClothes($PLAYER_CHAR, "HATMANCBLK", "HATMANC", 16)Player.Build($PLAYER_CHAR)00BA: show_text_styled GXT 'DIS1' time 1000 style 4 04EB: AS_actor $PLAYER_ACTOR crouch 009D4: suspend_wanted_level :DISGUISE_195wait 0 03BF: set_player $PLAYER_CHAR ignored_by_everyone 1 if 0AB0: key_pressed 90 jf @DISGUISE_195 088A: actor $PLAYER_ACTOR perform_animation "COWER" IFP_file "PED" 8.0 loopA 0 lockX 1 lockY 1 lockF 1 limT -1 unknown 0 unknown 0 wait 150 0794: restore_player_clothes Player.Build($PLAYER_CHAR)03BF: set_player $PLAYER_CHAR ignored_by_everyone 0 00BA: show_text_styled GXT 'DIS2' time 1000 style 4 04EB: AS_actor $PLAYER_ACTOR crouch 0 jump @DISGUISE_19 Let me know if you see any problems with it. I was going to put a small sphere around C.J.'s coordinates and if a random ped, cop, or gang member was in the sphere the disguise wouldn't work (like being seen). I couldn't figure out how to do a pedestrian just walking into or being the sphere with out being specific. Zaz "Professor" Thanks, as always your help has been outstanding. Deji much respect to you also and thanks for the input p.s. thanks for posting the animations list. Edited August 9, 2010 by bmb Link to comment Share on other sites More sharing options...
ZAZ Posted August 9, 2010 Share Posted August 9, 2010 You wanna check if peds are near CJ which discover him so that the disguise should not work? In which radius? CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
bmb Posted August 10, 2010 Author Share Posted August 10, 2010 You wanna check if peds are near CJ which discover him so that the disguise should not work? Yes because putting on the disguise when they are next to him is just plain silly. It wouldn't work in real life so why would work it in the game. In which radius? Not sure what you mean. If your asking where is it in the script I took it out. If your asking how big I'm don't know, I'm still trying to grasp how big to make radius's. thought I would start with 20 and increase or decrease by testing it in game. The problem I am having is grouping all the different peds in one code. Doing op code searches I've noticed some of codes use unknown_actor and random_ped. That seemed like what I'm looking for, but I wasn't sure. Using a local-string-variable plus "if or" and all the ped #'s is ridicules. Link to comment Share on other sites More sharing options...
ZAZ Posted August 10, 2010 Share Posted August 10, 2010 First some notes to your posted script. The point is, to arrange the code so as to minimize the amount of CPU cycles consumed on each update, to optimize it and let read only what must absolutely be done in each update. So don't let the opcode 0793: run in the start loop but put it after the key_press. Same for opcode 03BF: in the second loop The if_player_defined_check checks if player is wasted or busted, so you don't need to check if he is dead. It should prevent crashes for example if player dies but should do animations because of the script so add an if_player_defined_check also in the second loop I think you don't need the animation code because opcode 04EB: is enough The problem I am having is grouping all the different peds in one code. Indeed, trying to get more peds handles makes sense in some cases but it's depending to your plan. For your disguise script should it be enough to check only if one ped is near player because it doesn't matter if there are more peds. opcode 08E5: search for a random_ped and the engine returns the value -1 if no ped was found. So check then if the random_ped handle is -1 or the opposite, if it is not -1 and if it is not -1, check if the actor is dead {$CLEO .cs}thread 'DISGUISE':DISGUISE_19wait 0if Player.Defined($PLAYER_CHAR)jf @DISGUISE_19if and0AB0: key_pressed 88// x keyjf @DISGUISE_190006: [email protected] = -1 // integer values00A0: store actor $PLAYER_ACTOR position to [email protected] [email protected] [email protected]: get_actor_in_sphere [email protected] [email protected] [email protected] radius 20.0 handle_as [email protected] 50if8039: NOT [email protected] == -1 // integer values004D: jump_if_false @DISGUISE_35if8118: NOT actor [email protected] dead004D: jump_if_false @DISGUISE_3501C2: remove_references_to_actor [email protected] @DISGUISE_19:DISGUISE_3501C2: remove_references_to_actor [email protected]: save_player_clotheswait 001B9: set_actor $PLAYER_ACTOR armed_weapon_to 0wait 150Player.SetClothes($PLAYER_CHAR, "GROUCHO", "GROUCHOS", 15)Player.SetClothes($PLAYER_CHAR, "HATMANCBLK", "HATMANC", 16)Player.Build($PLAYER_CHAR)00BA: show_text_styled GXT 'fem_on' time 1000 style 404EB: AS_actor $PLAYER_ACTOR crouch 109D4: suspend_wanted_level03BF: set_player $PLAYER_CHAR ignored_by_everyone 1:DISGUISE_195wait 0if Player.Defined($PLAYER_CHAR)jf @DISGUISE_195if0AB0: key_pressed 90// z keyjf @DISGUISE_19504EB: AS_actor $PLAYER_ACTOR crouch 1wait 1500794: restore_player_clothesPlayer.Build($PLAYER_CHAR)03BF: set_player $PLAYER_CHAR ignored_by_everyone 000BA: show_text_styled GXT 'fem_off' time 1000 style 4wait 100004EB: AS_actor $PLAYER_ACTOR crouch 0jump @DISGUISE_19 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
bmb Posted August 13, 2010 Author Share Posted August 13, 2010 Thanks Zaz works great! Made a couple changes to make the crouch smoother, and added 80DF: not actor $PLAYER_ACTOR driving so he wouldn't stand in a vehicle. The text was only for testing but I like how you made it so it didn't need a fxt file, I will use it in the future. When the script checks for peds around it seems to randomly spin traffic sometimes. No big deal though. Here's the new script {$CLEO .cs}//-------------MAIN---------------thread 'DISGUISE' :DISGUISE_19wait 0 not Actor.Driving($PLAYER_ACTOR)if Player.Defined($PLAYER_CHAR)jf @DISGUISE_19 if 0AB0: key_pressed 81 jf @DISGUISE_19if80DF: not actor $PLAYER_ACTOR driving jf @DISGUISE_19 [email protected] = -1 Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])08E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 20.0 handle_as [email protected] wait 50 if not [email protected] == -1 jf @DISGUISE_149 if not Actor.Dead([email protected])jf @DISGUISE_149 Actor.RemoveReferences([email protected])jump @DISGUISE_19 :DISGUISE_149Actor.RemoveReferences([email protected])0793: save_player_clothes wait 0 01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0 04EB: AS_actor $PLAYER_ACTOR crouch 1 wait 250 Player.SetClothes($PLAYER_CHAR, "GROUCHO", "GROUCHOS", 15)Player.SetClothes($PLAYER_CHAR, "HATMANCBLK", "HATMANC", 16)Player.Build($PLAYER_CHAR)04EB: AS_actor $PLAYER_ACTOR crouch 0 09D4: suspend_wanted_level 03BF: set_player $PLAYER_CHAR ignored_by_everyone 1 :DISGUISE_254wait 0 if Player.Defined($PLAYER_CHAR)jf @DISGUISE_254 if 0AB0: key_pressed 81 jf @DISGUISE_254 04EB: AS_actor $PLAYER_ACTOR crouch 1 wait 250 0794: restore_player_clothes Player.Build($PLAYER_CHAR)03BF: set_player $PLAYER_CHAR ignored_by_everyone 0 04EB: AS_actor $PLAYER_ACTOR crouch 0 jump @DISGUISE_19 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now