Auto-translated
Has anyone managed to create their own hero specialization using scripts? For example, making a specialist in skeletons... :confused:
New here? I'm Roha — want a quick tour?
Has anyone managed to create their own hero specialization using scripts? For example, making a specialist for skeletons… :confused:
Added 14 hours and 41 minutes ago
Is there a function that determines which direction an object is facing?
I don't think this will be necessary. Portals only have 4 possible rotation angles, and they can be determined by the relative position of the mob.
Please help! I can't figure out what's wrong; the script just won't work, no matter what I try.function biaraF()
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "biara", nil);
MessageBox(GetMapDataPath()..'text9.txt');
SetObjectPosition('Raelag', 8, 129, 0)
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "biara", "biaraF");
It seems like everything is correct, and the hero's name matches the script, so there shouldn't be any errors here. The console displays: "Can't find terrain info file for map... and the map directory." All other scripts work, but this one doesn't react at all when entering the region :smile32:
O_o Hmm... the earth texture file seems to have disappeared. When exiting to the surface in the game, it crashes; in the editor, the texture is simply missing, and objects are floating in the air... I'll try copying this file from another map and editing it there :(
Added 16 minutes later
I fixed the surface error, but the script still isn't working. I discovered a strange thing: the hero teleports, but to a completely different function (a different trigger). The regions don't overlap... I don't understand what's wrong :(
I'm having a problem: (
I can't seem to get the GetDate function to work.
I need it so that when quest N is received, the countdown to day M (in my case, 10) begins, and when the 10th day arrives since the quest was received, a certain action is performed. But it's also necessary that if the hero completes the quest within those 10 days, the trigger resets, and the function loses its meaning. I wrote a complicated function with a bunch of if statements, but it refuses to work. The console doesn't output anything :( .
n = 0 (write this outside of all functions)
--Your function--
....
Quest received (the required one)
n = 1 -- now we set n to one
--end of function--
Now, through a trigger for a new day (Trigger(NEW_DAY_TRIGGER , 'day')) (example), call the function to execute.
--new day function--
if n > 0, then
n = n + 1 -- if n > 0, which in our case means that the quest has already become active, we increment n by 1.
--end of new day function--
Thus, we add +1 to n each day, starting from the day after the quest is received.
Now, all that remains is to write the verification function (it can be written directly inside the new day function)
--new day function--
--what is written above--
if n == 11 and the quest has already been completed, then
Your actions
Otherwise, if n == 11, then (this already means that after this time, the quest has not been completed)
Your other actions
"For aesthetics, if you don't need the counter to continue, make n = 0"
--end of new day function--
If "Your actions" are already written in another function, that's not a problem. Instead, write startThread (name_of_function_with_actions). That's it, I think. [/code]n = 0
function xxx
...
SetObjectiveState ('obj1' , OBJECTIVE_ACTIVE)
n = 1
end
Trigger(NEW_DAY_TRIGGER , 'day')
function day
if n > 0 then
n = n + 1
end
if n == 11 and GetObjectiveState ('obj1') == OBJECTIVE_COMPLETED then
...
elseif n == 11 then
...
end
endI don't think it's that complicated. So, here's the idea. You have a function that handles receiving the quest, right?
Then:n = 0 (write this outside of all functions)
--Your function--
....
Receive the quest (the required one)
n = 1 -- now we set n to one
--end of function--
Now, using a trigger for a new day (Trigger(NEW_DAY_TRIGGER , 'day')) (as an example), call the function to execute.
--new day function--
if n > 0, then
n = n + 1 -- if n > 0, which in our case means that the quest has already become active, we increment n by 1.
--end of new day function--
Thus, we add +1 to n every day, starting from the day after the quest is received.
Now, all that remains is to write a check function (it can be written directly inside the new day function)
--new day function--
--what is written above--
if n == 11 and the quest has already been completed, then
Your actions
Otherwise, if n == 11, then (this already means that the quest has not been completed within this time)
Your other actions
"For aesthetics, if you don't need the counter to continue, set n = 0"
--end of new day function--
If "Your actions" are already written in another function, that's fine. Instead, write startThread (name_of_the_function_with_actions). That's it, I think.[/code]
Now, a little reference material:
Trigger(NEW_DAY_TRIGGER , 'day') -- trigger for a new day
SetObjectiveState ('objname' , OBJECTIVE_ACTIVE) -- activate the quest, replace the first parameter with the name of your quest
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED/FAILED) -- complete the quest, or fail it.
n = 0 -- and so on (variable)
Trigger(TRIGGER_NAME, nil) -- reset the trigger.
Thus, here is the complete script: (replace the red with your values):n = 0
function xxx
...
SetObjectiveState ('obj1' , OBJECTIVE_ACTIVE)
n = 1
end
Trigger(NEW_DAY_TRIGGER , 'day')
function day
if n > 0 then
n = n + 1
end
if n == 11 and GetObjectiveState ('obj1') == OBJECTIVE_COMPLETED then
...
elseif n == 11 then
...
end
end
I don't think I wrote anything more complicated. ;)
Thank you very much :) You explained it clearly and understandably. I'll know now :)