Skip to content

Scripts for beginners.

#206
Auto-translated
Ment
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.


function a1()
if GetObjectiveState ("q1") == OBJECTIVE_COMPLETED then
RemoveObject ("qq1");
end;
end;

Trigger(OBJECTIVE_STATE_CHANGE_TRIGGER, "q1", "a1" )

I did it like this. You had a couple of inaccuracies, but it still doesn't work. I even set a quest to remove monsters, and it still doesn't help. Is it necessary to specify that it's for all players, or is that understood by default?

By the way, it complains about the first line of the script. Specifically, about - function a1(), and it's not about the number of characters in the name; I tried 5 letters, and it still complains. Maybe the function itself is somehow wrong; I don't know. My brain is about to explode.