Auto-translated
Is there a way to play a video after the map is completed or before it starts?
New here? I'm Roha — want a quick tour?
SetPlayerHeroesCountNotForHire(player_id, number_to_reduce_the_standard_number_of_heroes_by), something like that.
, something like that.SetPlayerHeroesCountNotForHire(player_id, number_to_reduce_the_standard_number_of_heroes_by)
Removing an object
function gogo()
if GetObjectiveState("quest name at the prophet") == OBJECTIVE_COMPLETED then
RemoveObject("Name of the object to be removed")
end
end
Trigger(OBJECTIVE_STATE_TRIGGER, "quest name at the prophet", "gogo")
Some immediate comments:
1) The object to be removed must be of type Static, and the IsRemovable property must be set to true (check in the objectPropretiesTree).
The name is also given there – in the name field.
2) If the quest is the same for multiple players and for the same object, add a check for IsObjectExists. Then remove it.
3) Strictly speaking, I haven't tested this trigger for prophet quests. But it will probably work.
void errorHook( fCallback ) Allows you to set an error handler. By default, when a script error occurs, the current thread terminates. Thanks to this function, you have the opportunity to adjust this behavior – before stopping, control will be passed to the fCallback function. Example: function onError() print("Error occured ") end function SetArtefactUntrans(nArtefactName) errorHook(onError) RemoveArtefact("Berein",nArtefactName) GiveArtefact("Berein",nArtefactName,1) end If an error occurs in the SetArtefactUntrans function (for example, if the hero does not have the required artifact), the string "Error occured " will be displayed in the console. Note that this very informative string will not save you from the thread stopping (nor from displaying diagnostics in the console). The hook will work in all script threads (and not just in the one that called it) until errorHook is called with the parameter nil. I also recommend paying attention to the fact that the hook only works on runtime errors; it does not affect interpretation errors. Regarding the example provided, it is much more reasonable to check the hero for the presence of the required artifact instead of using a hook.