Hucaru / Valhalla

A Golang MapleStory (v28) server
MIT License
274 stars 71 forks source link

System Scritps #27

Closed Hucaru closed 4 years ago

Hucaru commented 4 years ago

I am thinking/writing the scripting system responsible for handling system wide events e.g. boats and PQs I have the following example script for boat rides (only the scheduler has been implemented):

//Time Setting is in millisecond
var closeGateTime = 240000; //The time to close the gate
var takeoffTime = 300000; //The time at which takeoff occurs
var landTime = 600000; //The time required to land everyone

var invasionTime = 60000; //The time that spawn balrog from takeoffTime between ellinia and orbis

function run(controller) {
    controller.log("run:start")
    // dock the boats in all instances
    // needs to set a property in the map that is then used by npc script to allow ticket sales
    controller.schedule("closeGate", closeGateTime)
    controller.schedule("takeoff", takeoffTime)
    controller.log("run:end")
}

function closeGate(controller) {
    controller.log("closeGate")
    // needs to set a property in the map that is then used by npc script to not sell tickets
}

function takeoff(controller) {
    controller.log("takeoff:start")
    // move characters from boat waiting maps to boat flying map in all instances

    controller.schedule("invasion", invasionTime)
    controller.schedule("land", landTime)
    controller.log("takeoff:end")
}

function invasion(controller) {
    controller.log("invasion")
    // 40% change to spawn
    // spawn 8150000 at 485, -221
    // spawn 8150000 at -590, -221
    // show boat
    // change map bgm (Bgm04/ArabPirate)
}

function land(controller) {
    controller.log("land:start")
    // move characters from boat to stations in all instances

    run(controller)
    controller.log("land:end")
}

If no objections/suggestions are made I will go ahead and finish the implementation.

The scheduler appears to be working correctly: image

Boat takeoff and docking working off of schedule: image

ErwinsExpertise commented 4 years ago

This looks great! It will be very helpful moving forward.

Hucaru commented 4 years ago

image