How can I make it so that when a player enters a region, they receive a red key (the key from the red tent)?
Posts from Current questions and answers regarding the map editor.
Auto-translated
using a trigger - first, you create a region and name it (for example, "RedKey"), then you write a script to give the key after a corresponding event (in your case, this event is the entry of heroes/or a hero of a given player into the region).
Yes, that's clear, I just need the script to generate the key.
However, I suspect that not everything is clear, so I'll provide a script outline with explanations.
function RedKeyFF (heroname)
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"RedKeyF", nil);
MessageBox("/Maps/SingleMissions/Your_Map_Name/RedKey.txt");
GiveBorderguardKey(PLAYER_1,RED_KEY);
end;
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "RedKeyF","RedKeyFF" );
where - heroname (the name of a random hero (you can replace it with the name of a scripted hero, in which case the script will only work with that hero)).
When your hero enters the region named RedKeyF, a trigger is activated, which launches the function (function RedKeyFF), a message RedKey.txt is displayed (with approximately the following content - "The guards, after conferring, decided to give you the keys to the red gate"), and, in fact, the key to the Red Gate is given.
Maybe you could share the map? That would increase the chances of figuring it out.
if GetObjectOwner(...)==1 then
...
end;