Quantcast

Jump to content

» «
Photo

[SRC|REL] SCM Hook for Vice City

65 replies to this topic
Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#1

Posted 01 January 2005 - 02:32 PM

Hiya,

I've had this code done for a while now, but never got round to releasing it. The few people I've given it to found it more helpful than the DirectX Hook/SCM Hook combined, and so.. here it is.

http://spookie.powerpill.co.uk/scmmod/

The code should allow you to make missions in C++, although alot of the functions might need adding to the script classes (you'll see what I mean when you get it wink.gif ). Doing this allows you to write mission code in the format of...
CODE
pSwatVan->GetRelativeCoordinates(-8.0, 30.0, 3.0, &fX, &fY, &fZ);
pGame->SetCameraPosition(fX, fY, fZ, 0.0f, 0.0f, 0.0f);
pGame->SetCameraOnVehicle(pSwatVan->GetVehicle());
pGame->SetWidescreen(true);
SCRIPT_WAIT(1000);
pGame->Fade(1000, FADE_IN);
while (pGame->Fading()) SCRIPT_WAIT(0);
pGame->TextNow("!CAUGHT", 4000, 1);

...which would set the camera relative to the swat van vehicle, point the camera at the swat van, wait a second, fade in for 1 second and then display the "!CAUGHT" text for 4 seconds.

The last command in the above sample code, pGame->TextNow, displays text from a GXT entry, but with the included GXT hook, you can add your own "fake" gxt entries (prefixed with an exclamation mark) as I have done with "!CAUGHT"...
CODE
spookie_dot_gxt GxtEntries[] =
{
"", L"NOT FOUND",
"!CAUGHT", L"The feds have picked up Phil and Hilary for questioning!"
};
(from GXTHook.cpp)

Anyway, I'm going to cut this post here, as I'm sure that I am rambing on (it was a long night last night tounge.gif )

Have fun with it, and Happy New Year!

Kryptos
  • Kryptos

    Hacker

  • Members
  • Joined: 05 Nov 2003

#2

Posted 02 January 2005 - 09:31 PM

Since no one else has said this yet, I suppose it only appropriate that it be me. Spookie, it's great to see a guy like you here, in this community. It's people like you who are constantly making the required advancements that thrust new oppurtunities into the plates of the laymen. Thanks for this new offering, it won't go unappreciated.

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#3

Posted 02 January 2005 - 09:39 PM

hehe, I think nobody has replied yet because they are still lying dead on the floor after seeing this... biggrin.gif

Kryptos
  • Kryptos

    Hacker

  • Members
  • Joined: 05 Nov 2003

#4

Posted 02 January 2005 - 09:42 PM

...or dead on the floor after New Years. I was going to reply yesterday, nearly immediately after reading this, but in my drunken state I feared both that this was a topic which didn't require replies, and also that my words would fall in a seemingly confusing fashion.

Squiddy
  • Squiddy

    Back!

  • The Connection
  • Joined: 06 Oct 2004

#5

Posted 02 January 2005 - 09:42 PM

Told you before Spookie, it's great to have you here. This is another really great contribution. inlove.gif

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#6

Posted 02 January 2005 - 10:17 PM

Amazing work Spooky!

At a first glance it seems quite easy to convert it to Delphi, what makes it interesting... wink.gif

Barton Waterduck
  • Barton Waterduck

    retired modder

  • Members
  • Joined: 12 Feb 2002

#7

Posted 03 January 2005 - 03:34 AM Edited by Barton Waterduck, 03 January 2005 - 03:41 AM.

Yes, and it would be even greater if:
1. People use it.
2. Release their mission coding work using it (since the mods released using tools like this since the first one (like it) came out for gta 3 has been less than 2 (that I can remeber anyway)). confused.gif

And I have a feeling that the more advanced mission script editors that will be coming out for the PC version of GTA SA using C like structured codes will be just as "popular". I hope I'm wrong though. Seriously. Not trying to start another flame war. dozingoff.gif Since this post could get people pissed anyway, I just want to "end" with that I would like to see another BASIC like mission script editor since BASIC is EASY (or should be). Like a real professional BASIC compiler supporting C like functions, subs, object oriented programming, using functions in functions, like
CODE
set_car_color get_actor_car(player_actor), get_car_color1(get_actor_car(player_actor)), 2

Simple code without any useless "{" symbols or any C thingies like it.

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#8

Posted 04 January 2005 - 02:31 PM

I didn't reply because I assumed the topic was locked (don't know why confused.gif ).

Anyway, this looks really great, does it have a list of its own commands? and if so, where are they (i.e. all the opcodes in this format).

Squiddy
  • Squiddy

    Back!

  • The Connection
  • Joined: 06 Oct 2004

#9

Posted 04 January 2005 - 03:02 PM

At the end of gamescripting.h you find all used opcodes, just like it was in the 'old' scm hook.
In scriptclasses.h all avaiable commands for game, player etc. are declared and implemented in scriptclasses.cpp.

Or what do you mean?

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#10

Posted 05 January 2005 - 01:53 PM

No, that is what I meant, but do the rest need adding to it for the compile to work.

i.e. if I wanted to use 0506, would I have to add the line:

CODE
const SCRIPT_COMMAND set_car_variation  = { 0x0506, "vii" }; // (CAR_*), variant, variant

gadfly
  • gadfly

    Player Hater

  • Members
  • Joined: 12 Jan 2005

#11

Posted 13 January 2005 - 09:39 AM

I have not been by these forums in months, I did alot of mission coding never released to anyone but friends and I using gtama. I liked their tool. but being a C coder I am absolutely thrilled at this new development.

Unlike some people who are constantly moaning, there are some of us that love C. C really has a great syntax and style, half the languages borrow its syntax,java, javascript, php .... . The old way of mission coding at times was so hacked. Just doing simple loops or comparisions was hackish. Now we have goool ole C.

I must admit I have never seen an asi file. I did compile the code, it did give me a couple of errors about bMsg not being initiated due to the goto Mission failed statement. I did a temp work around til I spend the time to see what was going on ( only had about 10 mins to look at it ). and compiled it to a dll. renamed the dll scmmod.asi and it seemed to work.

How does gtavc know to load the asi file? Since I have not been here in a while has this all been discussed? I saw the dx thread but that is loaded differently as a wrapper to dx.

Well again a mighty thanx

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#12

Posted 13 January 2005 - 11:57 AM

QUOTE (gadfly @ Jan 13 2005, 10:39)
How does gtavc know to load the asi file? Since I have not been here in a while has this all been discussed? I saw the dx thread but that is loaded differently as a wrapper to dx.

Normally .asi files are plugins for the Miles Sound System the game uses, so it scans for those files on startup and executes them. You could also name it .m3d or .flt, I think flt files are loaded last (if you need to overwrite settings made by an asi file). All are simple dll files.

Barton Waterduck
  • Barton Waterduck

    retired modder

  • Members
  • Joined: 12 Feb 2002

#13

Posted 18 January 2005 - 05:28 PM Edited by Barton Waterduck, 18 January 2005 - 05:41 PM.

QUOTE
I did alot of mission coding never released to anyone but friends and I using gtama.

If you aren't interested in supporting the mission modding community then PLEASE keep that to yourself. And if you can't handle reading my personal opinions, then please keep that to yourself too. And please save your account info the next time you create one. It's starting to get seriously annoying. Thank you.

gadfly
  • gadfly

    Player Hater

  • Members
  • Joined: 12 Jan 2005

#14

Posted 20 January 2005 - 01:09 AM

QUOTE (Barton Waterduck @ Jan 18 2005, 17:28)
If you aren't interested in supporting the mission modding community then PLEASE keep that to yourself. And if you can't handle reading my personal opinions, then please keep that to yourself too. And please save your account info the next time you create one. It's starting to get seriously annoying. Thank you.

I can HANDLE your opinions fine. HTF am I not handling them? Heh. I just disagree with them. I have seen you many many times complain here about other peoples work and a opinions. I find it insanely funny how you say I cant HANDLE your opinions then tell me not to post MINE. Heh.

Sometimes I have to wonder if you are for real or just a troll. Even though I much prefered the gtama editor to yours, I never bashed your contribution or your editor. I think its great if people like your code syntax.

I am glad that now I can code missions in C and will in fact be working on some missions that I will share here with others when I am done with them. Barton what I dont understand about you, is why you constantly need to attack other peoples contributions? If you dont find them usefull then dont use them.



Barton Waterduck
  • Barton Waterduck

    retired modder

  • Members
  • Joined: 12 Feb 2002

#15

Posted 21 January 2005 - 05:47 PM Edited by Barton Waterduck, 21 January 2005 - 05:55 PM.

QUOTE (gadfly @ Jan 20 2005, 02:09)
QUOTE (Barton Waterduck @ Jan 18 2005, 17:28)
If you aren't interested in supporting the mission modding community then PLEASE keep that to yourself. And if you can't handle reading my personal opinions, then please keep that to yourself too. And please save your account info the next time you create one. It's starting to get seriously annoying. Thank you.

I can HANDLE your opinions fine. HTF am I not handling them? Heh. I just disagree with them. I have seen you many many times complain here about other peoples work and a opinions. I find it insanely funny how you say I cant HANDLE your opinions then tell me not to post MINE. Heh.

Sometimes I have to wonder if you are for real or just a troll. Even though I much prefered the gtama editor to yours, I never bashed your contribution or your editor. I think its great if people like your code syntax.

I am glad that now I can code missions in C and will in fact be working on some missions that I will share here with others when I am done with them. Barton what I dont understand about you, is why you constantly need to attack other peoples contributions? If you dont find them usefull then dont use them.

Well, first of all, I guess this belongs in the blarg forum, but I'm posting because I'm curious about what exactly you're talking about. It seems to me that whenever I make ANY suggestions to ANYTHING no matter what it is, just because it's me making the suggestions, people are telling me I complain about their work. In this thread, I was very careful to just point out some facts about what I remember about a tool released for GTA 3 without actually having any opinions about it in any way. And what's the first thing that happends ? Y-Less comes in here and asks why this topic isn't locked ? A poll is started in the Myriad forum to get peoples opinions about a radar and when I suggest making the poll bigger by including different color themes to the radar the hole place goes bonkers ? When people can't handle the simplest suggestions or opinions, how am I supposed to be able to respect those people ? I'm just sitting there stairing at the screen thinking "What the hell is this BS ? Who the hell are these people ?". And then I usually give up, turn of my PC and watch TV. I have this limit you see. I can handle just -- that much bs before I switch off and get on with my life. That I have this function in my brain makes me feel good too. Very good. Does this help ?

edit: I think I'm actually gonna make a thread in the blarg forum to ask people these questions. I guess it could be "fun" (or just get nasty, who cares). Damn, it seems the blarg forum is gone. sucks.

Kryptos
  • Kryptos

    Hacker

  • Members
  • Joined: 05 Nov 2003

#16

Posted 22 January 2005 - 05:22 AM

Life is opinionated. He who believes solely in religion and denounces science is as ignorant as he who believes solely in science but denounces religion. You see, both systems were created by mankind, and to understand humanity you must first understand this key relationship which has plagued our hopeless species since its origin, being that of evolution from single celled organisms or the hand of God. If you don't enjoy doing something, as it would seem you don't at times, then don't waste your time doing it, no matter the consequence. If people don't respect what you do then obviously they won't respect what you accomplish, and instead of spending your life trying to change those people enjoy the aspects that don't involve them. There are billions of people on Earth, there's no point in creating an ulcer for yourself over a small group that represent nothing more than 7.14 e-6% of our population. And please spare me any rants that may follow, this is merely a piece of advice, not a specification that must be lived by, and yes, this has everything to do with the previous confrontation.

jacob.
  • jacob.

    Homie

  • Members
  • Joined: 27 Jun 2004

#17

Posted 22 January 2005 - 06:41 AM

QUOTE (Kryptos @ Jan 22 2005, 05:22)
Life is opinionated. He who believes solely in religion and denounces science is as ignorant as he who believes solely in science but denounces religion. You see, both systems were created by mankind, and to understand humanity you must first understand this key relationship which has plagued our hopeless species since its origin, being that of evolution from single celled organisms or the hand of God. If you don't enjoy doing something, as it would seem you don't at times, then don't waste your time doing it, no matter the consequence. If people don't respect what you do then obviously they won't respect what you accomplish, and instead of spending your life trying to change those people enjoy the aspects that don't involve them. There are billions of people on Earth, there's no point in creating an ulcer for yourself over a small group that represent nothing more than 7.14 e-6% of our population. And please spare me any rants that may follow, this is merely a piece of advice, not a specification that must be lived by, and yes, this has everything to do with the previous confrontation.

Couldn't have said it better myself! inlove.gif

Dunno why barton is taking this one person's opinion so seriously. Anyway, this looks awesome, can't believe i missed it! Going to try it now.

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#18

Posted 22 January 2005 - 11:09 AM

QUOTE (Barton Waterduck @ Jan 21 2005, 17:47)
QUOTE (gadfly @ Jan 20 2005, 02:09)
QUOTE (Barton Waterduck @ Jan 18 2005, 17:28)
If you aren't interested in supporting the mission modding community then PLEASE keep that to yourself. And if you can't handle reading my personal opinions, then please keep that to yourself too. And please save your account info the next time you create one. It's starting to get seriously annoying. Thank you.

I can HANDLE your opinions fine. HTF am I not handling them? Heh. I just disagree with them. I have seen you many many times complain here about other peoples work and a opinions. I find it insanely funny how you say I cant HANDLE your opinions then tell me not to post MINE. Heh.

Sometimes I have to wonder if you are for real or just a troll. Even though I much prefered the gtama editor to yours, I never bashed your contribution or your editor. I think its great if people like your code syntax.

I am glad that now I can code missions in C and will in fact be working on some missions that I will share here with others when I am done with them. Barton what I dont understand about you, is why you constantly need to attack other peoples contributions? If you dont find them usefull then dont use them.

Well, first of all, I guess this belongs in the blarg forum, but I'm posting because I'm curious about what exactly you're talking about. It seems to me that whenever I make ANY suggestions to ANYTHING no matter what it is, just because it's me making the suggestions, people are telling me I complain about their work. In this thread, I was very careful to just point out some facts about what I remember about a tool released for GTA 3 without actually having any opinions about it in any way. And what's the first thing that happends ? Y-Less comes in here and asks why this topic isn't locked ? A poll is started in the Myriad forum to get peoples opinions about a radar and when I suggest making the poll bigger by including different color themes to the radar the hole place goes bonkers ? When people can't handle the simplest suggestions or opinions, how am I supposed to be able to respect those people ? I'm just sitting there stairing at the screen thinking "What the hell is this BS ? Who the hell are these people ?". And then I usually give up, turn of my PC and watch TV. I have this limit you see. I can handle just -- that much bs before I switch off and get on with my life. That I have this function in my brain makes me feel good too. Very good. Does this help ?

edit: I think I'm actually gonna make a thread in the blarg forum to ask people these questions. I guess it could be "fun" (or just get nasty, who cares). Damn, it seems the blarg forum is gone. sucks.

I didn't say I thought it should be locked!

I actually don't have a problem with you most of the time.

What I meant in my first post was I thought when the topic was made and pinned, they locked it as well, don't ask me why, I just did. if you read my post it says "I thought it HAD been locked" not "it SHOULD be locked".

That you posted before me was a coincidence and apparently you mis-interpreted my post.

ot0_m0t0
  • ot0_m0t0

    Rat

  • Members
  • Joined: 02 Sep 2002

#19

Posted 28 January 2005 - 05:23 PM

If you are compiling it make sure you compile it as a simple .dll, later just rename it to .asi.
Other than that its inlove.gif

jacob.
  • jacob.

    Homie

  • Members
  • Joined: 27 Jun 2004

#20

Posted 23 February 2005 - 04:22 AM Edited by !cMc! Jacob, 10 April 2005 - 09:26 PM.

[color=4AB8FF]Does this gxt hook use ASM at all?
Is the DLL required to be injected into gta-vc.exe for the gxt hook to work?

Kryptos
  • Kryptos

    Hacker

  • Members
  • Joined: 05 Nov 2003

#21

Posted 23 February 2005 - 04:52 AM

This actually uses the old ASI file trick. As Steve-M already stated:

QUOTE (steve-m)
QUOTE (gadfly)
How does gtavc know to load the asi file? Since I have not been here in a while has this all been discussed? I saw the dx thread but that is loaded differently as a wrapper to dx.


Normally .asi files are plugins for the Miles Sound System the game uses, so it scans for those files on startup and executes them. You could also name it .m3d or .flt, I think flt files are loaded last (if you need to overwrite settings made by an asi file). All are simple dll files.

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#22

Posted 23 February 2005 - 09:28 AM

QUOTE (!cMc! Jacob @ Feb 23 2005, 05:22)
Does this gxt hook use ASM at all?
Is the DLL required to be injected into gta-vc.exe for the gxt hook to work?

!cMc! Jacob goes to buy a Learn C++ in 24 Hours book

(..the last person that said that is now an advanced c++ scripter tounge.gif )

The GXT hook does use inline asm.

The DLL has to be loaded into the gta-vc process, but it doesn't matter how you go about that.

p.s. When you message me at 4am, you can assume that I'm sleeping if I don't reply. I'm not ignoring you.

The_Grudge
  • The_Grudge

    The_Grudge

  • BUSTED!
  • Joined: 08 Jan 2005

#23

Posted 26 February 2005 - 02:47 PM Edited by The_Grudge, 26 February 2005 - 03:40 PM.

EDIT:
Nevermind, Squiddy helped me smile.gif

jacob.
  • jacob.

    Homie

  • Members
  • Joined: 27 Jun 2004

#24

Posted 22 April 2005 - 09:06 PM Edited by !cMc! Jacob, 22 April 2005 - 09:41 PM.

CODE
--------------------Configuration: scmhook - Win32 Release--------------------
Compiling...
MissionHook.cpp
C:\Documents and Settings\Jacob\Desktop\SCM Hooking 2\src\MissionHook.cpp(234) : warning C4018: '==' : signed/unsigned mismatch
MissionThreads.cpp
SCMMod.cpp
ScriptClasses.cpp
GameScripting.cpp
GxtHook.cpp
Linking...
MissionThreads.obj : error LNK2005: _ReplaceTerm already defined in MissionHook.obj
SCMMod.obj : error LNK2005: _ReplaceTerm already defined in MissionHook.obj
ScriptClasses.obj : error LNK2005: _ReplaceTerm already defined in MissionHook.obj
GameScripting.obj : error LNK2005: _ReplaceTerm already defined in MissionHook.obj
GxtHook.obj : error LNK2005: _ReplaceTerm already defined in MissionHook.obj
Release/scmhook.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

scmhook.dll - 6 error(s), 1 warning(s)

I had a similiar problem on your previous DirectX hook's source but it one day mysteriously dissapeared. Now I try to compile this part 2 and I get the errors listed above.
Any suggestions? I haven't modified one line of the source.

[EDIT] Microsoft.com states that this can be caused from mixing libraries of different types. Right now I'm trying to compile as a Multithreaded DLL, is that right?

MODMAN OG
  • MODMAN OG

    Player Hater

  • Members
  • Joined: 10 Jun 2005

#25

Posted 10 June 2005 - 12:09 PM

How can I code a war between the Triads and the Mafia on GTA3?

GodGell
  • GodGell

    shlurp my burger, sir

  • Members
  • Joined: 31 Oct 2003

#26

Posted 12 June 2005 - 12:55 AM Edited by GodGell, 12 June 2005 - 12:59 AM.

wow! does this mean we won't have to use the sometimes helplessly primitive script language anymore? biggrin.gif yeey!

i'll see if i can rewrite my car shop with it. if i can, that'd mean:

0. the dll would be able to parse handling.cfg on each startup
1. no main.scm modification, aka savegames don't get f*cked up
2. no having to make a 65536-line script file for every car, aka i don't have to strip everything else off to make it under the script size limit


wow! but i see it's in visual c++.. we'll see whether i can compile it with BCB5. smile.gif

GodGell
  • GodGell

    shlurp my burger, sir

  • Members
  • Joined: 31 Oct 2003

#27

Posted 12 June 2005 - 03:49 AM

QUOTE (bcb5 compiler)
[C++ Warning] GAMESCRIPTING.H(59): W8058 Cannot create pre-compiled header: initialized data in header
[C++ Warning] GameScripting.cpp(37): W8002 Restarting compile using assembly
[C++ Warning] GAMESCRIPTING.H(59): W8058 Cannot create pre-compiled header: initialized data in header
[C++ Warning] GameScripting.cpp(51): W8070 Function should return a value
[Tasm Error] GameScripting.asm(697): Forward reference needs override


lol, will there be a normal C++ version (not a visual c++ one) or do i have to get myself a vc++?

ceedj
  • ceedj

    PEDS Creator

  • Feroci Racing
  • Joined: 21 May 2005

#28

Posted 06 July 2005 - 03:52 PM

Some questions on this...

1) I don't want to use this to make custom missions. I wish to use my own scm, and just use this to listen for certain keypresses, and then excute 1 or 2 opcodes when the key IS pressed. I really don't need all the jibber-jabber in MissionHook.cpp, especially the CreateMain Thread - I don't want it to overwrite (or not use) what I have in my main scm. So what do I do with this file?

2) Where do I put the actual code? For example, suppose I figure out the keypress syntax. Where do I put that? And the opcodes themselves?

Sorry for the nebish questions. I really don't need this to do a whole lot though.

I'm using Dev C++ is it matters...

Thanks!

albuemil
  • albuemil

    Player Hater

  • Members
  • Joined: 15 Oct 2002

#29

Posted 08 July 2005 - 03:50 PM

Hy,

I would like to know if this method could be used with San Andreas, and if so what changes would be needed (actually an example would be the best) ?

I've seen there's an "ASI Loader" for San Andreas (i think it was on www.gtatools.com), so maybe we could make this work.

Hope that somebody figures it out and gives us (newbies) an example lol.gif

Thanx in advance

ceedj
  • ceedj

    PEDS Creator

  • Feroci Racing
  • Joined: 21 May 2005

#30

Posted 11 July 2005 - 11:48 PM

Can anyone who's used this tell me what I can get rid of in spooky's source? I'd like this to run alongside my main.scm, not replace it. Or does anyone have a "stripped" version of this?

Any help is MUCH appreciated, as I can get the script to complie and run, but I can't figure out what to get rid of.

Thanks.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users