Posts from Scripts for beginners.
Could you provide a script that would allow a hero to function without needing a town?
Guys, help me out, I need scripts to enhance the AI players.
On a specific day, add a certain amount of gold/resources to each AI player. Add a certain number of monsters of a specific level to the main city of each AI player.
Thanks in advance.
I've just started learning scripting, so I don't quite understand why the following code isn't working for me:(
function f1()
MessageBox("The Prophet does not wish to see you.")
end
SetObjectEnabled("Prophet", nil)
Trigger(OBJECT_TOUCH_TRIGGER, "Prophet", 'f1')SetObjectEnabled works as expected, but the Trigger doesn't. What's wrong?
MessageBox("The Prophet does not wish to see you.")
That is completely wrong. Look at the manual; it requires a link to a text file, not just text.
Another question, if it's not too much trouble)
I have a secondary "Conquer" objective of type Manual with initial visibility/activity parameters set to false.
But it's not working :(
path = GetMapDataPath()
function activate(obj)
SetObjectiveState(obj, OBJECTIVE_ACTIVE,PLAYER_2)
end
function complete(obj)
SetObjectiveState(obj, OBJECTIVE_COMPLETED,PLAYER_2)
MessageBox(path.."meow1.txt")
end
function proph_event(hero)
if GetObjectiveState("Conquer") == OBJECTIVE_UNKNOWN then
activate("Conquer")
else
if GetObjectiveState("Conquer") == OBJECTIVE_ACTIVE and HasArtefact(hero, 29) then
complete("Conquer")
Trigger(OBJECT_TOUCH_TRIGGER, "Prophet", nil)
end
end
SetObjectEnabled("Prophet", nil)
Trigger(OBJECT_TOUCH_TRIGGER, "Prophet", "proph_event")
OBJECTIVE_UNKNOWN
Check this out.
PLAYER_2 is questionable... If it's a single-player map, the player plays as the first player. If it's multiplayer, that's okay...
I'm not creating anything right now, just experimenting. That's why I have both the first and second player, but the quests should be tied to the second player.
OBJECTIVE_UNKNOWN — the task is unknown to the player.
How would you personally do it? :)
I'm not creating anything substantial right now, just experimenting. That's why I have both the first and second player, but the quests should be tied to the second player.
It seems like everything is correct; this is included in the list of the `GetObjectiveState` method. Regarding what's written in `script_functions_rus`
How would you personally do it?