Skip to content
User Avatar
#2393
Auto-translated
Dyrman
Yes, I tried both ways. The result is the same.
If you redefine the Trigger in the map itself, it works. With a different sender parameter. But you won't be rewriting the scripts of ready-made maps...
It is important that the Trigger override occurs before the map script and the mod script are executed.
It is also desirable to add the standard alias for the Trigger function:
SetTrigger = Trigger
to the end of that large piece of code that performs the override.
It is probably used rarely or not at all, but it should still be taken into account.
Another question is about resetting the trigger, so that only the necessary one is reset. Would this be correct:
Trigger("NHF", OBJECT_TOUCH_TRIGGER, mob, nil);?
Yes, that is correct.
And if the Trigger(OBJECT_TOUCH_TRIGGER, mob, nil); is reset in the map itself, will it affect all of them?
No, by default, calling the trigger with standard parameters (from the Manuals) will be interpreted as a call from sender 0 (as a number, not a string). That is, in this case, only the trigger set in the usual way will be reset, and all the "special" ones will remain.
However, emulation via Trigger(0, ...) is not possible, as this is equivalent to Trigger(NEW_DAY_TRIGGER, ...).
As I understand it, if the first parameter = nil, this is also a unique sender parameter.
No, the first parameter must be either a number (standard call), in which case it will be taken as the event type, or a string, in which case it will be taken as the sender. Passing nil as the first parameter will cause an error: attempt to concat a nil value.
If desired, the sender parameter can be placed at the end as an optional parameter, then any value can be sent as the sender, except nil (which will be equivalent to not specifying the parameter) and NaN (which is not indexed in tables because it is not equal to itself). This will require a small code modification.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4