Jump to content
Grim_Wizard

fp.freeplay.script will not load

Recommended Posts

Hey all, 

 

I'm working on a custom freeplay script to spawn vehicles. I have looked around and found that several mods use fp.freeplay.script to spawn vehicles and turn door occlusion off. When the game starts the script should execute two debug lines into the log file

 

bool OnLoad()
{
	start();
	System::SetEnv("e4_doocclusion", 0);
	Process::Kill();
	return true;
	System::LogFile("At least the script file loaded");
}

void start()
{
	GameObjectList spawnerList("SCSpawner");
	GameObject spawner = spawnerList.GetObject(0);
	Game::ExecuteCommand("SpawnVehicles", &spawner);
	System::LogFile("It's working dingus");
};

 

When executing SpawnVehicles an additional debug line is logged. SpawnVehicles works fine on its own, however I can tell that the script is not being executed as there is no debug line in the logfile. I have looked around, but I cannot figure out if I have to link the script file in the editor or do any additional work. I have also looked through the spec xmls to make sure that I'm not missing a file path and couldn't find anything. Any help?

Link to comment
Share on other sites

Quick idea is to check that the map object is named correctly, and that it has no flags/properties that would allow it to be interacted with in any way (I had a flag set that would allow a crane to pick up an object I used when I first added Limited Water to my personal mod).

Can also try these lines

GameObjectList spawnerList("SCSpawner");
if (spawnerList.GetNumObjects()>0)
{
  GameObject Obj=spawnerList.GetObject(0);
  Game::ExecuteCommand("SpawnVehicles",&Obj);
  System::Log("Freeplay: Vehicle Spawns Started");
} 
else
  System::Error("Freeplay: Vehicle Spawner Not Found");

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...