Quantcast

Jump to content

» «
Photo

[REL|SA] Spooky-style SCM Hook

52 replies to this topic
JGuntherS@NL
  • JGuntherS@NL

    Being a being

  • Members
  • Joined: 15 Nov 2005

#31

Posted 24 December 2007 - 10:10 AM

I think this'll work, if I get your code right:
CODE
StoreMainCheck13:
if (TrailerCheck4 == 1)
{
  pTrailer4->GetCarCoord(&fT4X, &fT4Y, &fT4Z);
  pTrailer4->GetCarZ(&fT4Zangle);
}
pGame->TextNow("STORE", 5000, 1);
FileSavePosition();
StoreAll = 1;
goto CreatePed1;

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#32

Posted 31 December 2007 - 02:33 AM

I've been trying to build this under "Microsoft Visual C++ 2008 Express Edition" but I'm getting a lot of errors. I'm newish to C++ but I do have a little understanding of how such things work and what they require like the SDK thingy wow.gif

Ok so my build log is here >> http://pastebin.ca/839572

I have the "Microsoft Platform SDK for Windows XP SP2" installed along with the DirectX one (which I know I don't need but I thought I'd let you know that).

So any ideas what I can do to resolve this and get it to compile ?

Any help would be apreciated, thankyou.

PS. I got rid of tons of stuff using the hash fix on the first post #define USE_HASH_MAP_IN_STDEXT.

ceedj
  • ceedj

    PEDS Creator

  • Members
  • Joined: 21 May 2005

#33

Posted 02 January 2008 - 01:52 PM Edited by ceedj, 06 January 2008 - 02:22 PM.

Hey, I sorta kinda created a class to make a new opcode, which reads like get_actor_seat_number.

If you DON'T have these opcodes in Opcodes.h, add them first:
CODE

DEFINE_OPCODE(get_actor_car, 0x03C0, "vv");
DEFINE_OPCODE(get_veh_num_pass_seats, 0x01EA, "vv");
DEFINE_OPCODE(get_veh_in_pass_seat_to_actor, 0x0432, "viv");
DEFINE_OPCODE(is_actor_driving, 0x00DF, "v");


In SpookyScriptClasses.h, add this to protected:

CODE
DWORD pdwTempActor;
int NumSeats;


if it's not already there, add this too:

CODE
DWORD m_dwVehicle;


Add this below the other voids in the ScriptActor class:

CODE
void GetActorCarAndSeat(DWORD* pdwVehicle, int* Seat);


In SpookyScriptClasses.cpp, in the ScriptActor class functions, add this:

CODE
void ScriptActor::GetActorCarAndSeat(DWORD* pdwVehicle, int* Seat)
{ int SeatTemp;
ScriptCommand(&get_actor_car, &m_dwActor, pdwVehicle);
ScriptCommand(&get_veh_num_pass_seats, pdwVehicle, &NumSeats);
switch (NumSeats){
 case 1:
  if (!ScriptCommand(&is_veh_pass_seat_free, pdwVehicle, 0))
  {ScriptCommand(&get_veh_in_pass_seat_to_actor, pdwVehicle, 0, &pdwTempActor);
   if (pdwTempActor == m_dwActor)
   {SeatTemp = 0;
   *Seat = SeatTemp;
   return;}}
   break;
 case 3:
  if (!ScriptCommand(&is_veh_pass_seat_free, pdwVehicle, 0))
  {ScriptCommand(&get_veh_in_pass_seat_to_actor, pdwVehicle, 0, &pdwTempActor);
   if (pdwTempActor == m_dwActor)
   {SeatTemp = 0;
   *Seat = SeatTemp;
   return;}}
  if (!ScriptCommand(&is_veh_pass_seat_free, pdwVehicle, 1))
  {ScriptCommand(&get_veh_in_pass_seat_to_actor, pdwVehicle, 1, &pdwTempActor);
   if (pdwTempActor == m_dwActor)
   {SeatTemp = 1;
   *Seat = SeatTemp;
   return;}}
  if (!ScriptCommand(&is_veh_pass_seat_free, pdwVehicle, 2))
  {ScriptCommand(&get_veh_in_pass_seat_to_actor, pdwVehicle, 2, &pdwTempActor);
   if (pdwTempActor == m_dwActor)
   {SeatTemp = 2;
   *Seat = SeatTemp;
   return;}}
  break;
}
if (ScriptCommand(&is_actor_driving, &m_dwActor))
 {SeatTemp = 4;
 *Seat = SeatTemp;
 return;}

}


Call like this:

CODE
pActor->GetActorCarAndSeat(pCar->GetVehicle(), &Ped1Seat);


Make sure you int Ped1Seat (or whatever you wish to call it), then use that variable as you need to. 0-2 conform with the passenger seat numbers in a vehicle; it's set to 4 to signify a driver, since the is_actor_driving opcode returns true in a driverseat OR passenger seat. Again, do what you want with the var. In my case, this is for a save routine, to check if actors are in created cars, so I have the proper vars to restore them on a file reload.

This DOES NOT check if you are in a particular type of vehicle, so make sure to check that on your own.

Here's some code to show how I tested it, writing to a file (tempactor.txt) the seat number of that actor:
CODE

pAnimPed->GetActorCarAndSeat(pCar1->GetVehicle(), &Ped1Seat);
 pFile6 = fopen("tempactor.txt","w+");
 if (!pFile6)
 {goto AnimationWait;}
 fprintf(pFile6, "%d", Ped1Seat);
 fclose(pFile6);


Hope someone finds it useful. smile.gif

EDIT: Some changes to make the AS packs work right:

CODE
DEFINE_OPCODE(start_AS, 0x0615, "v");
DEFINE_OPCODE(end_AS, 0x0616, "i");
DEFINE_OPCODE(assign_AS, 0x0618, "vi");
DEFINE_OPCODE(AS_loop_flag, 0x0643, "ii");
DEFINE_OPCODE(AS_remove_ref, 0x061B, "i");


Works lovely now. smile.gif

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#34

Posted 14 January 2008 - 05:12 PM

Ok is this an ok build ?

It's my first one that actually completed and gave me the .exe.

Everything looks fine when I start the game etc, all the fade stuff works and freaks me right out biggrin.gif so I know it is functioning but from the log do you think it is functioning correctly ?

I have not modified the files at all, just installed the tools (compiler - (studio 2003.net) and SDK's) and compiled it.

Also while I am here is there any other files which I should update like updated Opcode.h or anything or are they in this build ?

Thankyou if you can help !

JGuntherS@NL
  • JGuntherS@NL

    Being a being

  • Members
  • Joined: 15 Nov 2005

#35

Posted 15 January 2008 - 08:15 PM

QUOTE (Carnage_C @ Jan 14 2008, 17:12)
Ok is this an ok build ?

It's my first one that actually completed and gave me the .exe.

Everything looks fine when I start the game etc, all the fade stuff works and freaks me right out biggrin.gif so I know it is functioning but from the log do you think it is functioning correctly ?

I have not modified the files at all, just installed the tools (compiler - (studio 2003.net) and SDK's) and compiled it.

Also while I am here is there any other files which I should update like updated Opcode.h or anything or are they in this build ?

Thankyou if you can help !

That is an ok build! You only got some warnings, that's completely normal smile.gif.

About the updates, CJ's latests addition are not yet included, the rest is.

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#36

Posted 15 January 2008 - 10:10 PM

Cheers for the reply.

This is great work man I must say, thanks a lot.

ceedj
  • ceedj

    PEDS Creator

  • Members
  • Joined: 21 May 2005

#37

Posted 05 February 2008 - 06:58 PM

A slightly better class for special actors...

In SpookieScriptClasses.h (public)

CODE
static bool SpecialActorLoaded(DWORD dwSlot);


In SpookieScriptClasses.cpp (script script)

CODE
bool ScriptScript::SpecialActorLoaded(DWORD dwSlot)
{
return ScriptCommand(&is_special_slot_loaded, dwSlot)?true:false;
}

In SpookieScriptClasses.cpp (script object)

CODE
void ScriptObject::LoadSpecialActor(int iSlot, char Model[8])
{
SCMThread *owner = currentThread;
m_iSlot = iSlot;
ScriptCommand(&load_special_actor, iSlot, Model);
ScriptCommand(&load_requested_models);
while (!ScriptScript::SpecialActorLoaded(iSlot)) SCRIPT_WAIT(10);
}


In Opcodes.h

CODE
DEFINE_OPCODE(is_special_slot_loaded, 0x023D, "i");

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#38

Posted 02 March 2008 - 10:41 PM

How do I launch threads ?

So like: (made up code)

CODE

#define MAX_MISSION_COUNT 100
int MyMissionCount = 0; //Global to script

MyMainThread()
{

while (MyMissionCount < MAX_MISSION_COUNT)
{
    switch (MyMissionCount)
    {
          case 0: LaunchThread(MyThreadName);
          case 1: LaunchThread(MyThreadName1);            
          case 47: LaunchThread(MyThreadName47);
    }
}

}


I'm trying to setup a main loop thread which I think I have it sussed how to do it (while loop based on MyMissioncount etc) but I really can't see how I can launch a thread. Sorry I think I'm being a complete blind ****er but honestly I can not find this function or a method to do so, I'm fairly new to c++ so sorry if this is really easy and don't beat me up too much.

Thanks if you can help !

ceedj
  • ceedj

    PEDS Creator

  • Members
  • Joined: 21 May 2005

#39

Posted 03 March 2008 - 12:46 PM

Threads and missions are not the same thing, so I'm not really sure what the Mission Count has to do with anything. Are you trying to launch missions from the original SCM or threads?

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#40

Posted 03 March 2008 - 01:26 PM

Yes sorry I don't explain very well

I'm working in CustomScript.cpp and I want from one thread to jump out of it and execute another (which will be a mission) then after I'm done with that thread I'll MyMissionCount++; and go back to the original one to check the value of MyMissionCount and launch another thread based off that and so on and so on.

so:

CODE

MyMissionCountCheckThread()
{
    if (blah == blah)  Launch(MyNextMissionNumber);
}


These Missions I keep talking about will be my own missions (I make) in CustomScript.cpp. Maybe I am using the term Thread in the wrong place, but these:

CODE

DWORD __stdcall ThreadNameHere(SCMThread *threadDesc)
{
THREAD_INIT();
       //Loads of code here
THREAD_EXIT();
return 0;
}


I want to have my mission/objective code in those and when I've finished one (thread) I will always go back to a main one I have setup that will launch the next one.

Sorry I don't know a great deal about all this, just trying to find my way.



JGuntherS@NL
  • JGuntherS@NL

    Being a being

  • Members
  • Joined: 15 Nov 2005

#41

Posted 03 March 2008 - 07:59 PM

You can do createSCMThread(ThreadNameHere), that will start up another SCM thread, running next to all your other threads and the threads defined in main.scm. The thread in which you launched the new thread will continue after the new thread has been created, so if you want it to wait until the new thread has finished you'll have to create some waiting mechanism, for example:

CODE

// pseudo-code! only to give you an impression, the code won't actually work!
bool gMissionFinished = false;

.. MainThread(..)
{
..
createSCMThread(otherThread);
while (!gMissionFinished)
  SCRIPT_WAIT(10);
..
}

.. OtherThread(..)
{
..
// do things
..
gMissionFinished = true;
return;
}

ceedj
  • ceedj

    PEDS Creator

  • Members
  • Joined: 21 May 2005

#42

Posted 03 March 2008 - 08:40 PM Edited by ceedj, 03 March 2008 - 08:46 PM.

Ok, I'm doing something "sort-of" similar. I don't know how you're going about it in your main thread, but let's say you have three:

DWORD __stdcall MainThread(SCMThread *threadDesc)

DWORD __stdcall Mission1Thread(SCMThread *threadDesc)

DWORD __stdcall Mission2Thread(SCMThread *threadDesc)

You might try something like this (really, REALLY pseudo-code):

CODE
DWORD __stdcall MainThread(SCMThread *threadDesc)
{

MyMissionCountCheckThread()
{
   if (blah == blah)  MissionVar1 = 1;
if (blah == blah)  MissionVar2 = 1;
if (blah == blah)  MissionVar3 = 1;
}

THREAD_EXIT();
return 0;
}
DWORD __stdcall Mission1Thread(SCMThread *threadDesc)
{
THREAD_INIT();

for(;;)
{
while(MissionVar1 != 1) SCRIPT_WAIT(500);
SCRIPT_WAIT(500);
//Do mission 1 here
      //When mission is done, reset MissionVar1 to 0
}

THREAD_EXIT();
return 0;
}
DWORD __stdcall Mission2Thread(SCMThread *threadDesc)
{
THREAD_INIT();

for(;;)
{
while(MissionVar2 != 1) SCRIPT_WAIT(500);
SCRIPT_WAIT(500);
//Do mission 2 here
      //When mission is done, reset MissionVar2 to 0
}

THREAD_EXIT();
return 0;


Etc, etc. Of course, make sure those MissionVar's are only set when you want that mission to happen, and reset it when you are finished. There is probably a much more elegant way of doing this, but I only have a few threads that do this, so it works for me.

EDIT: What he ^ said. biggrin.gif

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#43

Posted 03 March 2008 - 09:35 PM

Thanks a lot guys, very helpfull posts. icon14.gif

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#44

Posted 07 March 2008 - 03:03 PM

How can I create and then reference (in a var) a vehicle. So like this code:

CODE

THREAD_INIT();
SCRIPT_WAIT(1000);
pGame->CreateCarGenerator(1669.162, -2113.085, 14.301, 270.0, 492, 10, 0, 1, 0, 0, 1, 1);
pGame->CreateCarGenerator(2011.469, -1413.152, 16.74655, 270.0, 416, 0, 3, 1, 0, 0, 1, 1); // AMBULANCE
pGame->SetGeneratedCars(2);
pPlayerChar->WaitUntilDefined();
pPlayerActor->PutAt(1667.449,-2107.221,14.07227);
pPlayerActor->SetActorZAngle(180.0);
SCRIPT_WAIT(1000);
pGame->Fade(1500, 1);
SCRIPT_WAIT(1500);
pGame->TextNow("AMBU1", 6000, 2);
THREAD_EXIT();


I'd like to be able to identify the vehicle (Ambulance) for checking later on so I can check if CJ is driving it. I know about OC : is_actor_driving_car, 0x00DB, "vv" but I don't know howto give the vehicle a variable ID so I can use the above OC like:

CODE

if (CallOpcode(&is_actor_driving_car, pPlayerActor???, theAmbulanceID???) {}


Is there any chance I could get an example from anyone or point me to a post where I can study and read about such methods ?

Oh while I'm being a cheeky ***** I may aswell ask, is there any documentation which could assist me learning this, I'd really like to learn off my own back and not have to ask all the time (I have many questions) as people have better things to do than help me (newblet).

Thanks if you can help, I'm just trying to learn and don't mean to be annoying.

Edit>> Sorry about the double post, I didn't think to be honest until I saw I was the last reply.

ceedj
  • ceedj

    PEDS Creator

  • Members
  • Joined: 21 May 2005

#45

Posted 09 March 2008 - 11:59 AM Edited by ceedj, 09 March 2008 - 12:05 PM.

1) Why use a generator? Why not just create a car that has a handle of its own? That way you have a handle to work with for opcodes like checking for driving a specific vehicle and what not.

Remember, the is_actor_driving opcodes ONLY check if an actor is actually in a vehicle; it doesn't care if you are a driver or a passenger (see my "seat" code a few posts up if you need to get seat information.)

2) Your CreateCarGenerator code is wrong; you MUST have a handle to reference. You need this somewhere (I do it in my declarations, at the top of the CustomScript.cpp file)

ScriptObject *pCarGenrator1

Then you can do this:

pCarGenrator1->CreateCarGenerator(1669.162, -2113.085, 14.301, 270.0, 492, 10, 0, 1, 0, 0, 1, 1);

Just so you know, pCarGenerator is NOT THE HANDLE OF THE CAR. So many people get this wrong; it is the handle of the GENERATOR. To get/create the handle of the car generated there, use one of the range opcodes or create a check to see what kind of vehicle and model the player is driving.

3) There really is no documentation for this, other than learning mission coding. One thing to remember is that a LOT of creation opcodes in Mission Builder/Sanny Builder put the handle FIRST, which is right by those compiler standards (the ini file corrects this) but WRONG for this kind of thing; all handles for creating stuff (actors, cars, objects, etc) are generally LAST in the parameter order. Opcodes that reference handles usually have the handle first. If ever in doubt, open the SASCM.ini file from one of the builders and look at the param order for the opcodes. I think between JGS, Spookie and myself, we have the most important ones covered.

4) Speaking of opcodes, it's been a while since I've updated my list:

CODE
DEFINE_OPCODE(nis_veh_pass_seat_free, 0x8431, "vi");
DEFINE_OPCODE(is_valid_actor_handle, 0x056D, "v");
DEFINE_OPCODE(is_valid_vehicle_handle, 0x056E, "v");
DEFINE_OPCODE(is_valid_object_handle, 0x03CA, "v");
DEFINE_OPCODE(nis_valid_actor_handle, 0x856D, "v");
DEFINE_OPCODE(nis_valid_vehicle_handle, 0x856E, "v");
DEFINE_OPCODE(nis_valid_object_handle, 0x83CA, "v");
DEFINE_OPCODE(AT_driver_action, 0x06C7, "vvii");
DEFINE_OPCODE(is_actor_in_car, 0x0448, "vv");
DEFINE_OPCODE(print_entered_vehicle_name_enabled, 0x09B9, "i");
DEFINE_OPCODE(print_entered_zone_name_enabled, 0x09BA, "i");
DEFINE_OPCODE(set_night_vision_enabled, 0x08B1, "i");
DEFINE_OPCODE(set_thermal_vision_enabled, 0x08B2, "i");
DEFINE_OPCODE(set_menu_access_in_widescreen_mode_enabled, 0x0A48, "i");
DEFINE_OPCODE(set_aircraft_traffic_enabled, 0x0923, "i");
DEFINE_OPCODE(set_traffic_density_multiplier_to, 0x01EB, "f");
DEFINE_OPCODE(set_helicopters_traffic_enabled, 0x096A, "i");
DEFINE_OPCODE(set_police_patrols_traffic_enabled, 0x099E, "i");
DEFINE_OPCODE(set_police_motobikes_traffic_enabled, 0x072C, "i");
DEFINE_OPCODE(set_pedestrians_density_multiplier_to, 0x03DE, "f");
DEFINE_OPCODE(set_ambulances_and_firetrucks_enabled, 0x06D0, "i");
DEFINE_OPCODE(random_vehicle_generator_enable_modelID, 0x0733, "i");
DEFINE_OPCODE(random_vehicle_generator_disable_modelID, 0x0732, "i");
DEFINE_OPCODE(trailer_to_cab, 0x0893, "vv");
DEFINE_OPCODE(get_veh_paint_to, 0x0988, "vv");
DEFINE_OPCODE(set_veh_paint_to, 0x06ED, "vi");
DEFINE_OPCODE(set_veh_headlights, 0x067F, "vi");
DEFINE_OPCODE(set_veh_parklights, 0x0919, "vi");
DEFINE_OPCODE(set_veh_engine, 0x0918, "vi");
DEFINE_OPCODE(actor_attack_veh, 0x0672, "vv");
DEFINE_OPCODE(actor_flee_panic, 0x05DA, "vffffi");
DEFINE_OPCODE(is_actor_swimming, 0x0965, "v");
DEFINE_OPCODE(set_actor_swim_speed, 0x0A28, "vf");
DEFINE_OPCODE(actor_swim_to, 0x07E1, "vfff");
DEFINE_OPCODE(is_actor_performing_anim, 0x0611, "vs");
DEFINE_OPCODE(put_actor_in_veh_turret, 0x0464, "vvfffifi");
DEFINE_OPCODE(actor_disem_veh_and_freeze, 0x09C9, "vv");
DEFINE_OPCODE(actor_disem_instantly, 0x0792, "v");
DEFINE_OPCODE(remove_actor_from_turret, 0x0465, "v");
DEFINE_OPCODE(get_actor_anim_progress_to, 0x0613, "vsv");
DEFINE_OPCODE(UNK_actor_actor, 0x0859, "vv");
DEFINE_OPCODE(actor_weapon_drop, 0x087E, "vi");
DEFINE_OPCODE(set_actor_walk, 0x0245, "vs");
DEFINE_OPCODE(set_FPS_view, 0x0A2F, "i");
DEFINE_OPCODE(actor_no_inturupt_by_weapons_fire, 0x0946, "vi");
DEFINE_OPCODE(actor_fight_style, 0x07FE, "vii");
DEFINE_OPCODE(get_car_speed, 0x02E3, "vv");
DEFINE_OPCODE(get_actor_modelID, 0x0665, "vv");
DEFINE_OPCODE(get_actor_act_interior, 0x09E8, "vv");
DEFINE_OPCODE(set_actor_RCMode, 0x0715, "vv");
DEFINE_OPCODE(exit_RCMode, 0x04DB, "");
DEFINE_OPCODE(is_player_RCMode, 0x0241, "v");
DEFINE_OPCODE(set_veh_visible, 0x0338, "vi");
DEFINE_OPCODE(disable_rc_explode_A, 0x048A, "i");
DEFINE_OPCODE(disable_rc_explode_B, 0x04D6, "i");
DEFINE_OPCODE(set_vehicle_cam_to, 0x09AD, "i");
DEFINE_OPCODE(is_veh_non_civ, 0x0969, "v");
DEFINE_OPCODE(is_veh_emerg, 0x0975, "v");
DEFINE_OPCODE(actor_owner, 0x0A32, "v");
DEFINE_OPCODE(actor_owner_of_veh, 0x0A33, "vv");
DEFINE_OPCODE(actor_tele_veh_driver, 0x072A, "vv");
DEFINE_OPCODE(actor_tele_veh_pass_seat, 0x072B, "vvi");
DEFINE_OPCODE(actor_visible, 0x0337, "vi");
DEFINE_OPCODE(is_special_slot_loaded, 0x023D, "i");
DEFINE_OPCODE(set_actor_anim_progress_to, 0x0614, "vsf");
DEFINE_OPCODE(is_modelID_valid, 0x07DE, "i");
DEFINE_OPCODE(set_veh_open_comp, 0x0657, "vi");
DEFINE_OPCODE(set_veh_comp_rot, 0x08A6, "vif");

//Object Stuff
DEFINE_OPCODE(object_liftable, 0x08E9, "vi");
DEFINE_OPCODE(object_model_scale, 0x08D2, "vf");
DEFINE_OPCODE(object_instant_damage_type, 0x0723, "vi");
DEFINE_OPCODE(toggle_object_in_moving_list, 0x0392, "vi");
DEFINE_OPCODE(object_targetable, 0x035D, "vi");
DEFINE_OPCODE(object_indestructable, 0x07F7, "vi");
DEFINE_OPCODE(set_object_act_int, 0x0566, "vi");
DEFINE_OPCODE(set_object_collision, 0x0382, "vi");
DEFINE_OPCODE(get_object_pos, 0x01BB, "vvvv");
DEFINE_OPCODE(set_object_pos, 0x01BC, "vfff");
DEFINE_OPCODE(get_object_zangle, 0x0176, "vv");


Ask away if you have questions! smile.gif

Carnage_C
  • Carnage_C

    Player Hater

  • Members
  • Joined: 03 Mar 2007

#46

Posted 11 March 2008 - 03:03 AM

Thanks for the help Ceedj.

I'm trying to run before I can walk here I reckon so I'm going to learn a good bit about SCM scripting before I jump into this stuff again.

ceedj
  • ceedj

    PEDS Creator

  • Members
  • Joined: 21 May 2005

#47

Posted 26 August 2009 - 10:25 AM Edited by ceedj, 30 August 2009 - 02:15 AM.

Ok, so it's a big bump, but it's relevant as someone recently asked about a good C++ hook, and useful too. smile.gif

Want to disable ALL pickups? Saves too? So did I, as now I can film ANYWHERE without those silly pickups mocking me with their spin in my shots. Here's what to do:

In Opcodes.h, add this:

CODE
DEFINE_OPCODE(end_thread_named, 0x0459, "s");


In CustomScript.cpp, we're going to use Gunther's awesome readSCMVar function to "get" the Global vars that create the pickups in the original main.scm. I've already done the work here, but if I missed anything, let me know here and I'll update the post. I used spaceeinstiens SA Global Variables list, and Craig K's SA_opened up source (which is what I always use to reference the original script, since it's just a text file) to find all the pickups. This takes care of the flowers, weapons, armor, cameras, and collection rewards, including the weapons you get at Torino's ranch for completing "Vertical Bird." I even got rid of the asset pickups. Nifty! What I did was use FOR loops, since most (but not all, obviously) of the entries in the script are sequential; the FOR loop is ideal for this.

CODE
//Disable pickups
DWORD dwPickup;
//collections weapons
for (int i = 803; i < 815; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//toreno's ranch weapons
for (int i = 2873; i < 2877; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//weapons 1
for (int i = 3032; i < 3170; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//weapons 2
for (int i = 3171; i < 3230; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//weapons 3
for (int i = 3231; i < 3248; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//flowers
for (int i = 3257; i < 3262; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//more flowers, body armor and bribes
for (int i = 3263; i < 3395; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}
//Oddballs
//Camera
dwPickup = readSCMVar(2512);
CallOpcode(&destroy_pickup, &dwPickup);
//Millie's Toy
dwPickup = readSCMVar(820);
CallOpcode(&destroy_pickup, &dwPickup);
//Emmets Gun
dwPickup = readSCMVar(32);
CallOpcode(&destroy_pickup, &dwPickup);
//asset pickups
dwPickup = readSCMVar(55);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(66);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(527);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(710);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(1908);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(1931);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(1933);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(1938);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(1996);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(1998);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(2000);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(5271);
CallOpcode(&destroy_pickup, &dwPickup);
dwPickup = readSCMVar(7512);
CallOpcode(&destroy_pickup, &dwPickup);


Even though there are several lines of code for the oddball stuff, the FOR loops really saved time and coding. The weapons are split up because of the gaps in certain parts of the script; also looks like there might have been an extra flower that was eventually taken out.

Here's what I did to remove the save function and icons:

CODE
CallOpcode(&end_thread_named, "PSAVE1");
for (int i = 865; i < 883; i++)
{dwPickup = readSCMVar(i);
CallOpcode(&destroy_pickup, &dwPickup);}


The save thread in the script (PSAVE1) is now disabled, and the icons stay gone as well.

Hope this is useful to someone! smile.gif

EDIT: Changed the "more flowers" to add one I missed.

EDIT2: There are 5 weapon pickups in the game done via IPL that this does NOT remove. Just a heads up. smile.gif

Donny78
  • Donny78

    Zombie

  • Members
  • Joined: 18 Jul 2008

#48

Posted 24 October 2009 - 04:01 PM

Can this be used to deactivate the main scm so only my script runs ?

NTAuthority
  • NTAuthority

    member_title

  • The Yardies
  • Joined: 09 Sep 2008
  • European-Union

#49

Posted 24 October 2009 - 04:08 PM

QUOTE (Donny78 @ Oct 24 2009, 18:01)
Can this be used to deactivate the main scm so only my script runs ?

I think you still need to do initialization stuff... MTA's source code can be helpful as always, it shows minimal script initialization stuff in multiplayer_sa\CMultiplayerSA.cpp. smile.gif An easier method is to just use a stripped main.scm with the bare minimum of initialization code, like stripping stuff from the stripped main.scm.

Donny78
  • Donny78

    Zombie

  • Members
  • Joined: 18 Jul 2008

#50

Posted 24 October 2009 - 04:16 PM

Cheers for the quick reply, I'll take a look at it.

ManUthps
  • ManUthps

    Player Hater

  • Members
  • Joined: 22 Aug 2009

#51

Posted 05 April 2010 - 11:33 PM

hm link is down confused.gif can someone reupp pls?

sidk47
  • sidk47

    Player Hater

  • Members
  • Joined: 15 Oct 2010

#52

Posted 31 October 2010 - 04:57 PM

The link is down, someone please re-upload the link.

MicroD
  • MicroD

    Player Hater

  • Members
  • Joined: 06 Mar 2012

#53

Posted 06 March 2012 - 04:41 PM

Link of this file is down, please re-upload it nervous.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users