DaN` Posted December 12, 2005 Share Posted December 12, 2005 Elo. I've started to understand all the Script Command injection stuff with C++ lately. I know how to insert cars into the game with the press of a key, but I'm abit stuck on 'create_pickup'. I tried creating a Bribe when a key is pressed but when compile it came up with an error. I was wondering if anyone could post a Code Snippet of a similar code, it doesn't have to be a Bribe. Thanks in advance. Link to comment Share on other sites More sharing options...
Y_Less Posted December 12, 2005 Share Posted December 12, 2005 I'm not sure you can simply create a pickup like that at all, you just set up a pickup spawn point, like car generators. And not many people in here use the C++ hook so it's doubtful many people will be able to help (though I may be completely wrong). Link to comment Share on other sites More sharing options...
DaN` Posted December 12, 2005 Author Share Posted December 12, 2005 Ok, no problem. Didn't think I would get much of a response anyway. Thanks. Link to comment Share on other sites More sharing options...
ceedj Posted December 12, 2005 Share Posted December 12, 2005 Ok, no problem. Didn't think I would get much of a response anyway. Thanks. I work pretty exclusively with the SCM hooks - code/game please? I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets Link to comment Share on other sites More sharing options...
DaN` Posted December 12, 2005 Author Share Posted December 12, 2005 (edited) Game: GTA:San Andreas Basically, I just want to know how to get the 'SCRIPT_COMMAND' bit right, aswell as any other stuff you may spot wrong. The following is from a d3d9 hook, in 'Custom.cpp': ScriptCommand(&create_pickup, bribe, *fX, *fY, *fZ, help); Note: fX, fY, fZ is part of a Float. The following is from 'Custom.h' const SCRIPT_COMMAND create_pickup = { 0x0213, "help" }; // create_pickup Where you can see the word 'help' is basically where I do need help. I get confused with it, I have the memory address right (at least I think I do) and the Opcode etc. If you need a further elaboration, I'll be happy to add. Edited December 12, 2005 by DaN` Link to comment Share on other sites More sharing options...
random_download Posted December 12, 2005 Share Posted December 12, 2005 That is the parameter types, if I remember right i = int, f = float, s = string and v = var. So it would be "iifffv" Link to comment Share on other sites More sharing options...
ceedj Posted December 12, 2005 Share Posted December 12, 2005 (edited) The "help" section you're looking for defines the parameters for the opcode. For example: DEFINE_OPCODE(create_actor, 0x009A, "iifffv"); In this opcode (which creates a new actor), the first "i" is the ped type, the second "i" is the model reference via the peds.ide, the three "f"s are the x,y,z floats, and the "v" is the variable the the actor will be referenced as. MOST (if not all) creation type opcodes in the SCM hooks put the variable reference at the END of the command, as opposed to the beginning, like in the traditional mission builders. But when you want to use that variable, it usually goes in the beginning, like this: DEFINE_OPCODE(actor_task_fall_down, 0x05BB, "vii"); Which puts the actor variable in the beginning. I've never used the create_pickup command, but if Y_Less is right and it IS set up like an init car generator, then the code SHOULD be: DEFINE_OPCODE(create_pickup, 0x0213, "iifffv); where "i" is the objects model number. In this case, it's a bribe, so your code would be ScriptCommand(&create_pickup, -94, 15, *fX, *fY, *fZ, BRIBE); Where BRIBE is your variable, so you know what to use when you wish to destroy it, reference it, etc. Any more questions, feel free to ask. EDIT: Fixed the opcode; I was looking at the wrong one)... Edited December 12, 2005 by ceedj I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets Link to comment Share on other sites More sharing options...
DaN` Posted December 12, 2005 Author Share Posted December 12, 2005 Thanks for the reply. As I said, I'm beginning to understand all this stuff. What I don't understand is where to put the 'DEFINE_OPCODE' function. I tried putting it in 'GameScripting.h' underneath the 'SCRIPT_COMMAND' functions but when I attempted to build, I got various errors. If you could explain it as clear as possible, I would be very grateful. Link to comment Share on other sites More sharing options...
ceedj Posted December 12, 2005 Share Posted December 12, 2005 If you're using a d3d9 hook (which I've never used) put it in Custom.h, like you had before. You MAY need to set up a function for it, but again, I've never used. If you're using Spookie's SCM Hook, put it in GameScripting.h, and add a function in ScriptClasses.h/.cpp. If you're using op9080's SA Hook, add it to Opcodes.h and call it as you would your other functions. Basically, set it up the same way you did for spawing cars in the rest of your code. I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets Link to comment Share on other sites More sharing options...
Un3462 Posted December 12, 2005 Share Posted December 12, 2005 just fyi, i don't think you even need those partypes for op9080's sa hook. and from what i've seen in the source, it's simply ignored (i can't imagine what it'd be used for anyway). so leaving that empty should work just as well. Link to comment Share on other sites More sharing options...
FalconGT Posted December 12, 2005 Share Posted December 12, 2005 While we are talking about scm hook d3d9, any ideas how to make an actor shoot on key press ?? Any help would be great FalconGT. Link to comment Share on other sites More sharing options...
DaN` Posted December 13, 2005 Author Share Posted December 13, 2005 Hi thanks for the useful information. Got it all setup, all I need to know now is about the function in ScriptClasses.h/cpp, if you've got a snippet from that, could I have it if possible. Thanks. Link to comment Share on other sites More sharing options...
Cowpat Posted December 21, 2005 Share Posted December 21, 2005 Maybe you have already got this, but here is how I do it. in Gamescripting.hconst SCRIPT_COMMAND create_pickup = { 0x0213, "iifffv" };then in the file of your choice...ScriptCommand(&create_pickup, 1274, 2, fX, fY, fZ, &pickup); As you can see, the second integer should be 2 to create an object which can be 'picked up'. &pickup is simply an int and fX fY fZ are of course the float co-ordinates. The police bribe, health, armor and adrenaline are all located in data/maps/generic/dynamic.ide Weapon pickups spawn successfully, as well as any other ide object. For the first time I've used adrenaline in SA, and it isn't as good as in VC, IMHO. Don't try numbers which aren't in one of the ide files, unless you like crashing your game. 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