Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Good C+ C++ for kinda noobie.

Options
  • 21-04-2004 10:22pm
    #1
    Closed Accounts Posts: 20,346 ✭✭✭✭


    I need to learn more about C+ for generating my own game scripts, atm i can understand them by finding out what each line does (the trial and error theory.

    For instance a MOH:AA script after months of reading them i could duplicate them but not write them for myself (ie add in new code) as i dont know the basics of C+ or any programming language for that matter.

    Example:
    local.fix = spawn script_model
    local.fix model "static/vehicle_bmwbike.tik"
    local.fix.origin = (195 88 478 )
    local.fix.angles = ( 0 0 0 )
    local.fix.scale = 1.0
    local.fix solid

    (Will add in a BMWbike to any map at those coordinates and make it solid and the angle not normally done in the game but i sussed it :D)

    I made this for the game but only by generally copying what i found inother scripts, now with Farcry people like me have the ability to add in new code. But to do that i need a more basic knowledge of C+.

    Basically i need to write fresh rather than rehash.

    Thanks

    Kdjac


Comments

  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    What's C+? ;)

    ;-phobos-)


  • Registered Users Posts: 14,714 ✭✭✭✭Earthhorse


    Eh, KdjaC, just to answer phobos's rhetorical question, there's no such language as C+.

    Most commercial games are written in C or C++ whilst the scripts you're talking of are more than likely written in a scripting language such as Perl or Python.

    Scripting languages are slower (as they are interpreted by the machine as the program runs) but they're also easier to program in.

    There are plenty of threads already on this forum on where to get started on any of the above languages but you should find out exactly what it is you want to learn before embarking on a book binge.

    Maybe check out a community site of the games concerned or somewhere like gamedev.net for more info. on the scripting languages used by these games.


  • Closed Accounts Posts: 20,346 ✭✭✭✭KdjaCL


    Thanks for replies.

    Should have been more clearer, what i can do is edit other peoples script but with new engines the ability to add in code is needed, rather than learn a specific game scriping language the actual basics of general coding is what i need. (why are : { < / ) used? etc)

    Exact example of stuff i should know is :
      -- 25 {"", "PickupFlashlight",26,"Pickups/PickupFlashlight.lua"},

    Now i can edit that to change what is already there(replace flashlight with walking stick or somfin) but i want to change it to be completley different like pick up "rock of baldur" which is used for somfin not even used in game. To do that i would need to edit several more files. But still i would have to know how to compile the script in the exact order.

    Better example is to ask you clever people can you understand the layout and meaning of this:
      -- {"Player", "Player",PLAYER_CLASS_ID,"Player/player.lua"}, -- 1 {"", "FlagEntity",20,"Others/FlagEntity.lua"}, -- 20 {"", "TestCloth",21,"Others/Cloth.lua"}, -- 21 {"", "UnitHighlight",22,"Multiplayer/UnitHighlight.lua"}, -- 22 {"", "Health",23,"Pickups/health.lua"}, -- 23 {"", "Armor",24,"Pickups/armor.lua"}, -- 24 {"", "ClassAmmoPickup",25,"Pickups/ClassAmmoPickup.lua"}, -- 25 {"", "PickupFlashlight",26,"Pickups/PickupFlashlight.lua"},

    Why the spaces and such layout?
    Why commas and other things (i know that bit, but you may see my point)
    This Q seems clear in my head but not typed :(

    Kdjac


  • Registered Users Posts: 2,426 ✭✭✭ressem


    Short answer is 'fraid not.

    These posted scripts aren't a 'taught' language like C, Perl. The snippit you posted appears to be the LUA language, used for farcry.

    Those of us here that don't script games can guess the purpose of the formatting, but the meaning of each element in the structure is specific to the game you're using.

    The layout is structured like that so that something called a parser can place each script entry with the correct entity.

    As you've recognised the entries below the Player ID is a sub-object, that links a sub-object ID to another lua script. To add a new behaviour, you have to link these ID's to some form of event trigger.

    I'm out of my depth here as I've never see the game or it's scripts so I'll stop before making a (greater) fool of myself.

    All I can recommend is choosing a particular game engine and start googling for your particular script format: E.g for farcry:
    http://lua-users.org/wiki/TutorialDirectory
    tells you the meaning of the punctuation in LUA.
    e.g. {} are covered in the tables tutorial
    the -- indicates that the following text till the end of line is a comment that the computer will ignore

    C, C++ tends to be used for the advanced stuff, like writing completely new functions into a game. For this you'll want to work using an SDK if you can. If you insist pick up the basics at
    http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html#DownloadingTheBook
    then start looking for guides on the web for your game. Be prepared to be patient on this course.


  • Closed Accounts Posts: 20,346 ✭✭✭✭KdjaCL


    Thanks for that second link i have started deciphering the LUA scripts in my own trial and error way LOL and thats when i found i can add to them without the need to recompile an EXE the layout and structure of the game allows for a complete mod to run within it or be launched with its own exe (but only exe by name as nothing needs to recompiled due to the layout of the LUA scripts)

    Ie i have found i could make an RPG type just by adding in new LUA files. But inability to write my own code kinda hindering me :D

    Thanks for that link very handy.

    kdjac


  • Advertisement
Advertisement