Frictional Games Forum (read-only)

Full Version: Intro to mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
so it's your very basic and simple intro right, you start off trying to wake up, you can't move until the sequence is over. the only problem is that whenever I play my mod specifically in the modloader, I can move for some reason.

here's the script:
void OnStart()
{
Player_SetCrouching(true);
Player_SetActive(false);
Effect_Fade_Out(0.0f);
Map_AddTimer("T1", 1.5, "Intro");
Map_AddTimer("T2", 2.5, "Intro");
Map_AddTimer("T3", 4, "Intro");
Map_AddTimer("T4", 9, "Intro");
Map_AddTimer("T5", 16, "Intro");
Map_AddTimer("T6", 20, "Intro");
}

Is there anything wrong with what I did? Because I don't think player_setactive(false); should mean player_setactive(true);

It does work in debug mode, but I honestly have no idea what's going on here.
--------------------------------------------------
And now for some reason it won't let me play in debug because it couldn't load the map... the only changes i made was to add something to an automatic monster chase, it just takes a few steps into view, that's it.
First thing, when you have a series of timed interactions that you want to activate, it's easier and more reliable to use a Sequence rather than a series of map timers.

As far as the player function goes, try moving it to the OnEnter map function instead of OnStart. OnStart only runs once when the map is first initialized, at which point the player entity may or may not yet exist. OnEnter runs every time when the map is loaded, at which point it can be safely assumed that the player entity has been created by the engine.
I had the same problem myself, never got to a proper solution, but a workaround is to change the walk/run speed multiplier to 0 so even if the player moves he does not go anywhere. The problem with this though is that headbobbing still occurs when player attemts to move.

Try abion's solution first though, this is plan b.
(05-25-2016, 01:50 AM)Abion47 Wrote: [ -> ]First thing, when you have a series of timed interactions that you want to activate, it's easier and more reliable to use a Sequence rather than a series of map timers.

As far as the player function goes, try moving it to the OnEnter map function instead of OnStart. OnStart only runs once when the map is first initialized, at which point the player entity may or may not yet exist. OnEnter runs every time when the map is loaded, at which point it can be safely assumed that the player entity has been created by the engine.

The second question I asked was why my map just won't load anymore. It loads fine in ModLoader, but it loads the previous version of the map right before I added a few new things in the script and some stuff for decoration in the hpl editor, but it won't load in debug. Error: Could not load map sort of thing. Huh
Does the game crash when you try to load the map? What is the full error string that appears when you try?

(05-25-2016, 02:12 AM)WALP Wrote: [ -> ]I had the same problem myself, never got to a proper solution, but a workaround is to change the walk/run speed multiplier to 0 so even if the player moves he does not go anywhere. The problem with this though is that headbobbing still occurs when player attemts to move.

Try abion's solution first though, this is plan b.

There are also functions to change the player's look speed, as well as functions to disable crouching, standing, jumping, running, and head bob. The downside to using those functions is that you would need to then reset them all to their default values afterwards, though, when you want the player to be able to move again. So if Player_SetActive works on its own, I'd definitely recommend using that instead.
Make sure you have this line in your SOMA/resources.cfg:
PHP Code:
<Directory Path="/mods" AddSubDirs="true"/> 
(05-25-2016, 10:00 PM)Daemian Wrote: [ -> ]Make sure you have this line in your SOMA/resources.cfg:
PHP Code:
<Directory Path="/mods" AddSubDirs="true"/> 

Oh, sorry it actually says "could not load script file", not "could not load mod file". I still don't get why it won't load...
But yes, it just put the <Directory Path="/mods" AddSubDirs="true"/> in the resources file.
Generally, when the game says it can't load a script file, that means there is an error in the script that is causing it not to compile. Is there not a dialog box that opens up when you try to load the map?
Yeap. You can test that by moving away the .hps from the directory.
(05-26-2016, 01:42 AM)Abion47 Wrote: [ -> ]Generally, when the game says it can't load a script file, that means there is an error in the script that is causing it not to compile. Is there not a dialog box that opens up when you try to load the map?

Well basically, i open debug, select my map, click load, and it instantly crashes with a small window that say FATAL ERROR: Could not load map 'the_experiment.hps' or whatever. And I don't see why there would be any errors in the script, if there were, wouldn't it show the line number where the error occurs? Because it doesn't show that, so it doesn't help me find the problem.
Pages: 1 2 3