Hello there.
I need a little help here with a script error making me crazy.
I made a single player scenario map with two players wich can be both human or computer driven and i added some secondary objective to both of them.
All the objectives i assigned to player 0 (ingame player 1) works perfectly, but i am having troubles with objectives assigned to player 1 (ingame player 2).
The objectives are supposed to be set initially invisible and initially inactive and have to be activated by some triggers (actually two region_enters and one object_touch).
Now, when i test player 2 and activate the triggers i get this error script message:
(script)ERROR: objective 'strego_prison_1' is not exists
(script)ERROR: objective 'con_cittastrego' is not exists
where of course strego_prison_1 and con_cittastrego are the names of the triggered objectives. Same thing with the others.
here is the code of the triggering functions:
Code: Select all
--Mission script Start (attiva missione strego_prison_1)
function StregoPrison_1()
if GetCurrentPlayer() == omosapience and GetCurrentPlayer() == 2 then
MessageBox(path.."strego_prison_1_desc.txt");
SetObjectiveState ("strego_prison_1", OBJECTIVE_ACTIVE);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "strego_prison_1", nil);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "strego_prison_1", "StregoPrison_1");
--Mission script End
--Mission script Start (completa missione strego_prison_1 e attiva missione strego_prison_2)
function StregoPrison_1_completed()
if GetCurrentPlayer() == omosapience and GetCurrentPlayer() == 2 then
MessageBox(path.."strego_prison_1_completed_desc.txt");
SetObjectiveState ("strego_prison_1", OBJECTIVE_COMPLETED);
end;
Trigger (OBJECT_TOUCH_TRIGGER, "strego_prison_1", nil );
end;
Trigger (OBJECT_TOUCH_TRIGGER, "strego_prison_1", "StregoPrison_1_completed" );
--Mission script End
--Mission script Start (completa missione strego_prison_2)
function StregoPrison_2()
if GetCurrentPlayer() == omosapience and GetCurrentPlayer() == 2 then
MessageBox(path.."strego_prison_2_completed_desc.txt");
SetObjectiveState ("strego_prison_2", OBJECTIVE_COMPLETED);
end;
Trigger (OBJECT_TOUCH_TRIGGER, "strego_prison_2", nil );
end;
Trigger (OBJECT_TOUCH_TRIGGER, "strego_prison_2", "StregoPrison_2" );
--Mission script End
I checked and those are the precise names i gave to those objectives (yes, names of the objects to touch are the same of objectives, it works for the other player's mission as well, so i guessed it would work there too), perfectly spelled and all.
I tried many things to get what is done wrong, this is one of the last checks:
Code: Select all
function StartStrego()
walker = GetCurrentPlayer();
if walker == 2 and omosapience == 2 then
MessageBoxForPlayers(PLAYERFLT_2,path.."startstrego.txt");
--start check about objectives not working
checkprison1 = GetObjectiveState("strego_prison_1", 2);
checkprison2 = GetObjectiveState("strego_prison_2", 2);
checkcitta = GetObjectiveState("con_cittastrego", 2);
print ('check prison1:',checkprison1,'check prison2:',checkprison2,'check citta:',checkcitta);
SetObjectiveState ("strego_prison_1", OBJECTIVE_ACTIVE);
SetObjectiveState ("strego_prison_2", OBJECTIVE_ACTIVE);
SetObjectiveState ("con_cittastrego", OBJECTIVE_ACTIVE);
--end check about objectives not working
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "startstrego", nil);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "startstrego", "StartStrego");
The function is called at very start of map. The print command returned three "1", the SetObjectiveState returned one error:
(script)ERROR: objective 'strego_prison_1' is not exists
then nothing more.
The other two SetObjectiveState seems to be not processed at all. No active missions in the ingame panel.
If i go on with the game, when i reach the other triggers the console again says:
(script)ERROR: objective 'strego_prison_1' is not exists
(script)ERROR: objective 'con_cittastrego' is not exists
All seems to say those objectives are not at all present in the game or they are called different names, BUT if i set them to be initially visibile or active, they are visibile in the player active objective ingame panel list with their texts. Why then they are checked by GetObjectiveState ? Doesent it should say something like strego_prison_1 not existent?
I tried another check having objective strego_prison_1 initially ACTIVE and VISIBLE by default:
Code: Select all
function StartStrego()
walker = GetCurrentPlayer();
if walker == 2 and omosapience == 2 then
MessageBoxForPlayers(PLAYERFLT_2,path.."startstrego.txt");
--start check about objectives not working
checkprison1 = GetObjectiveState("strego_prison_1", 2);
checkprison2 = GetObjectiveState("strego_prison_2", 2);
checkcitta = GetObjectiveState("con_cittastrego", 2);
print ('first round - check prison1:',checkprison1,'check prison2:',checkprison2,'check citta:',checkcitta);
SetObjectiveState ("strego_prison_1", OBJECTIVE_COMPLETED);
SetObjectiveState ("strego_prison_2", OBJECTIVE_ACTIVE);
SetObjectiveState ("con_cittastrego", OBJECTIVE_ACTIVE);
checkprison1 = GetObjectiveState("strego_prison_1", 2);
checkprison2 = GetObjectiveState("strego_prison_2", 2);
checkcitta = GetObjectiveState("con_cittastrego", 2);
print ('second round - check prison1:',checkprison1,'check prison2:',checkprison2,'check citta:',checkcitta);
SetObjectiveState ("strego_prison_2", OBJECTIVE_ACTIVE);
SetObjectiveState ("con_cittastrego", OBJECTIVE_ACTIVE);
--end check about objectives not working
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "startstrego", nil);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "startstrego", "StartStrego");
function is correctly triggered and messagebox show up.
console results:
first round - check prison1:2
check prison2:1
check citta:1
which means the game SEES strego_prison_1 objective as active and visible!
then:
(script)ERROR: objective 'strego_prison_1' is not exists
which means game DO NOT SEE strego_prison_1 objective as existent!
script stops there to work, the function is not processed on other lines, and the region is not deleted, so i can re-enter it again and again having the same results, included the messagebox.
So those objectives ARE existent and they works and the game knows it, and i can't understand why it seems not to find them at all when i try to modify their status by script.
I made some other tests and things seems really weird.
I made another brand new map just for test purposes. Added just two towns, two heroes and two secondary objectives, one for each player, along with regions to trigger them.
Well, as first player's task is correctly triggered, player 2 again can't trigger his secondary task. Same error message: task is not exists.
Now I wonder if really player_2 CANNOT trigger any Objective_Kind_Manual at all. I downloaded some maps and at best I found player_2 with secondary predefined tasks.
Some other tries i made:
1. I transformed the map from singleplayer to multiplayer type, thinking that maybe on multi also player_2 was able to get script managed (e.g. Objective_Kind_Manual) secondary missions. Nope: same results: task is not exists. Sounds possible that even in multiplayer games you cannot assign script triggered secondary missions to another player but player 1??? Well, not enough!
2. I said, ok, no secondary missions possible, then lets make them Primary missions. Guess what? Same chit. But in gods sake, is it possible that this game engine does not permit to have not predefined core managed kind of missions for all players BUT player one? I really hope its me making some kinda mistake somewhere...
Any hint anyone about where did i go wrong?
Does anyone knows of maps with player_2 having missions of Objective_Kind_Manual type? If so please give me the links so i can check how they works.
Thanks in advance