Official 1C Company forum

Official 1C Company forum (http://forum.1cpublishing.eu/index.php)
-   Death to Spies (http://forum.1cpublishing.eu/forumdisplay.php?f=91)
-   -   User defined mission tasks... (http://forum.1cpublishing.eu/showthread.php?t=4096)

AHO 09-29-2008 11:04 AM

User defined mission tasks...
 
User defined mission tasks...

It is possilble to add new (user defined) mission tasks to every level.
Following will add a new test task to the level "Hotel". The aim is to kill the hotel manager.

Steps:
0. Unpack the content of the archive levels.vfs and rename the file to levels.vfs.org (You need of course the unpaker for vfs... Can be found in this board.)

1. Add task string to "MissionText -Array.
kill_manager = "Kill the hotel manager.";

2. Add the following task definition to the end of the function "Level.OnLoaded:

Level.AddMissionTask( MissionText.kill_manager, 'id_km', "levels\\hotel\\km.txt" );
Level.AddActionHandler( Level.AH_ACTOR_KILLED , "HM03" , "OnKilledManager");

3. Create-Event-Handler (New Funktion) at the end of the hotel.lua

function Level.OnKilledManager()
Level.CompleteMissionTask( "id_km" );
Level.RemoveMissionTask('id_km');
end

4. Create a briefing textfile "km.txt" with text.

AHO 10-01-2008 09:47 PM

Does anybody has an idea what kind of task I could add to which level of the game?

Condition is it should fit to the game and the historical background...

Pizzadvl 10-04-2008 11:14 AM

Quote:

Originally Posted by AHO (Post 52176)
Does anybody has an idea what kind of task I could add to which level of the game?

Condition is it should fit to the game and the historical background...


You can't make new levels can you?

AHO 10-06-2008 01:26 PM

Quote:

Originally Posted by Pizzadvl (Post 52936)
You can't make new levels can you?

No, just mission tasks inside a level!

ryan221b 06-02-2012 05:01 PM

Quote:

Originally Posted by AHO (Post 51475)
User defined mission tasks...

It is possilble to add new (user defined) mission tasks to every level.
Following will add a new test task to the level "Hotel". The aim is to kill the hotel manager.

Steps:
0. Unpack the content of the archive levels.vfs and rename the file to levels.vfs.org (You need of course the unpaker for vfs... Can be found in this board.)

1. Add task string to "MissionText -Array.
kill_manager = "Kill the hotel manager.";

2. Add the following task definition to the end of the function "Level.OnLoaded:

Level.AddMissionTask( MissionText.kill_manager, 'id_km', "levels\\hotel\\km.txt" );
Level.AddActionHandler( Level.AH_ACTOR_KILLED , "HM03" , "OnKilledManager");

3. Create-Event-Handler (New Funktion) at the end of the hotel.lua

function Level.OnKilledManager()
Level.CompleteMissionTask( "id_km" );
Level.RemoveMissionTask('id_km');
end

4. Create a briefing textfile "km.txt" with text.

I've managed to add the new task to the mission but if I save and load the task gets duplicated every time. I had a look at the OnSave function but didn't know how to modify it. Could someone help me solve this problem?

OSS 06-07-2012 03:02 PM

Quote:

Originally Posted by ryan221b (Post 431309)
I've managed to add the new task to the mission but if I save and load the task gets duplicated every time. I had a look at the OnSave function but didn't know how to modify it. Could someone help me solve this problem?

In what function did you insert the code to add new tasks?

AHO 06-10-2012 11:48 PM

Quote:

Originally Posted by ryan221b (Post 431309)
I've managed to add the new task to the mission but if I save and load the task gets duplicated every time. I had a look at the OnSave function but didn't know how to modify it. Could someone help me solve this problem?

Hi,
could you post your lua code?

ryan221b 08-15-2012 11:45 AM

Sorry about the late answer. I re read the post, followed the instructions,
and it worked! I must have put it in the wrong function the last time.

But now I have another problem: I can't leave the Hotel! :confused:

I've poked around the script and i've made the task appear after you kill the traitor. Another problem is that if I get the docs and then kill the traitor the mission ends then and there, no "Kill the Manager" or even "Leve the Hotel".

Here are the functions i've changed:

When the traitor is killed
function Level.OnKilledGad()

if (Level.IsMissionFailed() != false) then
return;
end

if (Level.IsMissionTaskCompleted( 'FNDS' ) == false) then
Level.FailedMission( MissionText.Failed_GadKilled );
return;
end


-- Deleted to make sure Manager is killed before leaving
-- if (Level.IsMissionTaskCompleted( 'DOCS' ) ) then
-- Level.SetupLeaveTask();
-- end

Level.CompleteMissionTask( 'KILL', 15.0 );
Level.EnableLevelMark('POOL', false);

-- Custom Manager task added when traitor is killed

Level.AddMissionTask( MissionText.kill_manager, 'id_km', "levels\\hotel\\km.txt" );
Level.AddActionHandler( Level.AH_ACTOR_KILLED , "HM03" , "OnKilledManager");

Level.AddSmallMessage( MissionText.Clues, 15.0, 255, 255, 255 );
Level.AddLargeMessage( MissionText.TaskChanged, 15.0, 255, 255, 255 );

-- END

if (Level.IsPlayerAtLibrary()) then
local gad = AI.FindNPC('HG42');
if (gad != nil) then
AI.SetGameFlag(gad, AI.F_ENABLE_ALWAYS, true);
end
end

end

When the manager is killed
function Level.OnKilledManager()
Level.CompleteMissionTask( "id_km" );
Level.RemoveMissionTask('id_km');

-- Check if docs have been retrived
if (Level.IsMissionTaskCompleted( 'DOCS' ) ) then
Level.SetupLeaveTask();
end
end


I added this to MissionText:
kill_manager = "Kill the hotel manager.";
Clues = "It looks like the manager helped him.";


Any help would be greatly appreciated :grin:


All times are GMT. The time now is 09:09 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.