Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intro to mod
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#1
Intro to mod

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.
(This post was last modified: 05-25-2016, 12:36 AM by Hypercube.)
05-25-2016, 12:00 AM
Find
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#2
RE: Intro to mod

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.
05-25-2016, 01:50 AM
Find
WALP Offline
Posting Freak

Posts: 1,221
Threads: 34
Joined: Aug 2012
Reputation: 45
#3
RE: Intro to mod

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, 02:12 AM
Find
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#4
RE: Intro to mod

(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
05-25-2016, 09:28 PM
Find
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#5
RE: Intro to mod

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.
(This post was last modified: 05-25-2016, 09:58 PM by Abion47.)
05-25-2016, 09:56 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#6
RE: Intro to mod

Make sure you have this line in your SOMA/resources.cfg:
PHP Code: (Select All)
<Directory Path="/mods" AddSubDirs="true"/> 

05-25-2016, 10:00 PM
Find
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#7
RE: Intro to mod

(05-25-2016, 10:00 PM)Daemian Wrote: Make sure you have this line in your SOMA/resources.cfg:
PHP Code: (Select All)
<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.
(This post was last modified: 05-26-2016, 01:21 AM by Hypercube.)
05-26-2016, 01:20 AM
Find
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#8
RE: Intro to mod

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?
05-26-2016, 01:42 AM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#9
RE: Intro to mod

Yeap. You can test that by moving away the .hps from the directory.

05-26-2016, 03:04 AM
Find
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#10
RE: Intro to mod

(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.
05-26-2016, 04:14 AM
Find




Users browsing this thread: 2 Guest(s)