Author Topic: Smoke's Modding Guide  (Read 43431 times)

Offline Smoke39

  • Endtrail
  • ****
  • Posts: 202
  • T:REP 597
    • View Profile
Re: Smoke's Modding Guide
« Reply #10 on: February 03, 2017, 06:25:54 PM »
Got a start on the Levels section.  There's not much there yet, but the little bit that is there should still be useful.

Offline Smoke39

  • Endtrail
  • ****
  • Posts: 202
  • T:REP 597
    • View Profile
Re: Smoke's Modding Guide
« Reply #11 on: February 03, 2017, 09:46:33 PM »
Someone else would have to get the models into the game, and I'm not sure anything with moving parts could be animated properly right now.  I could probably script them, though some details might not be doable.  I haven't quite managed to make a properly functioning scope, for example.

Offline Mon-Ark

  • Raptor
  • ***
  • Posts: 144
  • T:REP 420
    • View Profile
Re: Smoke's Modding Guide
« Reply #12 on: February 04, 2017, 01:50:25 PM »
well, you can make animations with 3d modelling programs already, so theres not much need for the editor to have that. What I dont know is if the editor allows to import models and animation into wathever format the kex engine works.

If this were the case, then making it work is something that could to be done on the scripting side.

Offline Gazer

  • Raptor
  • ***
  • Posts: 137
  • T:REP 484
    • View Profile
Re: Smoke's Modding Guide
« Reply #13 on: February 10, 2017, 05:26:43 AM »
lol at Dinomite - you should just learn a simple modeling proggie. You could be the resident modelersaurus.

Hey Smoke, how about you help me with a couple of scripts? I am bad at understanding the structure of them in general. Then when I do 'get it' I will forget again in like 30 seconds afterward.

In the 'scripts' folder in the 'main.txt' file there's an area for 'once-only' -  'GameVariables' and other simple scripts that reference main scripts in the engine. I'd like to utilize this in my mapfile but I can't understand the reference to (VARFUNC(functor.Add)); I tried checking the Angelscript forums but I don't have the time to learn it from scratch. As I noted earlier, I'm bad with basic programming syntax in general anyway.

So do you understand 'InitCustomStateVars' and 'SetStateVars' and how to add them to 'main.txt'? I just want to add particularly 1 item to my level.
Thanks, Gazer
No Ciggi

Offline Smoke39

  • Endtrail
  • ****
  • Posts: 202
  • T:REP 597
    • View Profile
Re: Smoke's Modding Guide
« Reply #14 on: February 10, 2017, 02:43:23 PM »
Near the top of main.txt, after all the #includes, you'll see:

funcdef void VARFUNC(const kStr &in, const kStr &in);

This is defining a function type, named "VARFUNC," which takes two strings as parameters, and has no return type.  This allows us to pass functions of this type as a parameter to other functions.  In this case, Add() and SetValue(), in VarFunctor.  Add() is used to add new variables to GameVariables, and SetValue() is used to change the value of variables already in GameVariables.


In main(), you'll see:

SetStateVars(VARFUNC(functor.Add));

This is calling SetStateVars(), passing the Add() function as a parameter.  This is called once when the game is run, and it registers all the persistent, per-save variables.


In newgame(), you'll see:

SetStateVars(VARFUNC(functor.SetValue));

This is also calling SetStateVars(), but this time passing the SetValue() function as a parameters.  This is called every time the player starts a new game, and it resets all the persistent game variables to their default values.


The purpose of all this function passing malarky is that we can specify all the persistent game variables ONCE in SetStateVars(), rather than having to have two copies for adding and setting.

THE BOTTOM LINE is, to add your own persistent, per-save variables, just add them to either SetStateVars(), or InitCustomStateVars() (or even in a new function, and call it from SetStateVars(), however you wanna organize it).  Just use:

setFunc( "var name", "initial value" );

and it'll ADD or UPDATE your new variables, whichever is appropriate.

You can see examples of this in Turok+, where I've added a bunch of my own variables at the end of InitCustomStateVars().

Offline Gazer

  • Raptor
  • ***
  • Posts: 137
  • T:REP 484
    • View Profile
Re: Smoke's Modding Guide
« Reply #15 on: February 10, 2017, 06:39:43 PM »
I've noticed your work Smoke! you Rock! I can't do what you do ... ha ha no way no how. My mind gets all kerplunktuated (void) Kstr #sizzledik -% 420 Lsd @boozer

Thanks - Gazer

I just looked at your examples - I am shocked. You did a lot of work Smoke. If I dig into this I will never finish a single map. I generally have to check each character that I type 3 times for syntax. And I flip letters and numbers sometimes, when I tpye. lol (this php has autocorrect damn i7 chip)
So I'm dumbfounded. Gazer
« Last Edit: February 10, 2017, 07:14:26 PM by Gazer »
No Ciggi

Offline Gazer

  • Raptor
  • ***
  • Posts: 137
  • T:REP 484
    • View Profile
Re: Smoke's Modding Guide
« Reply #16 on: February 14, 2017, 01:14:44 AM »
Hey Smoke, Howzit?

Hey I posted my level without custom scripting (besides adding my mapid to the mapInfo.txt), but my level doesn't run without the developer "1" flag. Have you run across any information on what would cause that? I do have models in the game that are hakked and retextured, and then re-deposited into the game. That would be the only thing that could cause a conflict with original files. I haven't noticed any conflict though and no error messages besides game crashes at startup when developer set to "0".

Sobek.exe caused and exception - yata yata - hexadecimal code - hexa - hexa

Thanks - Gazer
No Ciggi

Offline Smoke39

  • Endtrail
  • ****
  • Posts: 202
  • T:REP 597
    • View Profile
Re: Smoke's Modding Guide
« Reply #17 on: February 14, 2017, 01:27:50 AM »
My first guess would be inconsistent capitalization somewhere.  As I highlight here, unpackaged file names are not case-sensitive, but files packaged in a kpf are case-sensitive.  E.g., having a file named "Banana.map" referred to as "banana.map" in mapInfo.txt will cause problems.

Offline Gazer

  • Raptor
  • ***
  • Posts: 137
  • T:REP 484
    • View Profile
Re: Smoke's Modding Guide
« Reply #18 on: February 14, 2017, 01:33:26 PM »
My best guess at this point is the models that I copied and retextured. I'm cognizant of the case sensitivity and I checked everything in that respect. So in testing my models now in controlled conditions I'm getting 'memory could not be read' crash log return. (with developer '0')

Eh - the little done, the vast undone. Gazer

EDIT: Smoke do you have anything on the hexadecimal codes?
« Last Edit: February 14, 2017, 01:37:09 PM by Gazer »
No Ciggi

Offline Smoke39

  • Endtrail
  • ****
  • Posts: 202
  • T:REP 597
    • View Profile
Re: Smoke's Modding Guide
« Reply #19 on: February 14, 2017, 01:57:31 PM »
Smoke do you have anything on the hexadecimal codes?

No.  I think that stuff's probably not of any use without a debugger and the game's source.
« Last Edit: February 14, 2017, 01:57:44 PM by Smoke39 »

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal