Skip to content

Scripts for beginners.

#385
Auto-translated

In general, the code doesn't work. I suspect (actually, I'm pretty sure) that I, like any other programmer, made a mistake somewhere. The resulting function is:

 

CARAVAN = "caravan"



function respawn_caravan()
    if GetObjectiveState("NaydiSuhestv1") =~ OBJECTIVE_COMPLETED then
              return
    end
    if (GetDate( DAY_OF_WEEK ) == 5) then
        car = CARAVAN..GetDate(DAY)
        CreateCaravan(car, 1, GROUND, 173, 68, GROUND, 156, 159 )
        sleep(4)
        SetObjectRotation(car, 180)
        AddObjectCreatures(car, CREATURE_BONE_DRAGON, 4)
        AddObjectCreatures(car, CREATURE_WIGHT, 8)
        AddObjectCreatures(car, CREATURE_LICH, 12)
        AddObjectCreatures(car, CREATURE_VAMPIRE, 20)
        AddObjectCreatures(car, CREATURE_MANES, 36)
        AddObjectCreatures(car, CREATURE_WALKING_DEAD, 60)
        AddObjectCreatures(car, CREATURE_SKELETON, 80)
        OpenCircleFog(173, 68, 0, 4, 1)
        sleep(4)
        MoveCamera(173, 68, 0, 30, 1, 3.14, 0, 0, 1)
    end
end

Trigger(NEW_DAY_TRIGGER, "respawn_caravan")

 

Moreover, as soon as I added it to the code, the entire code stopped working altogether. I'm more than sure that someone who understands scripts has already spotted my mistake. Please explain what's wrong here.





Added 32 minutes ago

I removed the additional condition, and it still doesn't work.

 

The result is:

 

CARAVAN = "caravan"



function respawn_caravan()
    if (GetDate( DAY_OF_WEEK ) == 2)  then
        car = CARAVAN..GetDate(DAY)
        CreateCaravan(car, PLAYER_1, GROUND, 173, 68, GROUND, 156, 159 )
        sleep(4)
        SetObjectRotation(car, 180)
        AddObjectCreatures(car, CREATURE_BONE_DRAGON, 4)
        AddObjectCreatures(car, CREATURE_WIGHT, 8)
        AddObjectCreatures(car, CREATURE_LICH, 12)
        AddObjectCreatures(car, CREATURE_VAMPIRE, 20)
        AddObjectCreatures(car, CREATURE_MANES, 36)
        AddObjectCreatures(car, CREATURE_WALKING_DEAD, 60)
        AddObjectCreatures(car, CREATURE_SKELETON, 80)
        sleep(4)
    end
end

Trigger(NEW_DAY_TRIGGER, "respawn_caravan")

 

Perhaps the problem is that the caravan simply can't reach the city? Although the road seems to be open.