Special LUA scripts

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Special LUA scripts

Post by John Adams » Sun Aug 18, 2013 11:43 am

FooF, I have a feeling I never told you about this either ;) so here's some info for anyone scripting LUA going forward.

In the Spells folder (not sure why...) are 2 scripts: commands.lua and gm_spells.lua. Scat and I used these to perform repeated tasks or special commands, for example:

Code: Select all

function cast(Caster, Target, Type)
    if Type == "Examine" then
        Examine(Caster, Target)
    elseif Type == "Grab Soil" then
        GrabSoil(Caster, Target)
    elseif Type == "Plant Seeds" then
        PlantSeeds(Caster, Target)
    elseif Type == "Burn Tent" then
        BurnTent(Caster, Target)
    elseif Type == "Destroy Totem" then
        DestroyTotem(Caster, Target)
    elseif Type == "Smack Hive" then
        SmackHive(Caster, Target)
    elseif Type == "Help Down" then
        HelpDown(Caster, Target)
    elseif Type == "Read Gravestone" then
        ReadGravestone(Caster, Target)
    elseif Type == "ClimbTheBench" then
        ClimbTheBench(Caster, Target)
    elseif Type == "PullYourselfThroughTheFoliage" then
        PullYourselfThroughTheFoliage(Caster, Target)
    elseif Type == "InspectBox" then
        InspectBox(Caster, Target)
        elseif Type == "ThrowSnowball" then
                ThrowSnowball(Caster, Target)
    end
end
Use case is my Snowball spell will call the commands.lua script and pass "ThrowSnowball" as a parameter... and you get hit with a snowball.

In the old DB Milestone 1 content, BurnTent, HelpDown, etc... those were put in 1 common place so we're not hunting for special actions in thousands of script files.

gm_spells.lua was to handle things like Moonjump, silly little things for GMs to play with that are not part of the normal scripting.


I'd like theFoof to tell me how he handled things like this in FfS, so maybe we can archive these scripts if he doesn't want to use the same method going forward.

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: Special LUA scripts

Post by thefoof » Sun Aug 18, 2013 5:39 pm

For these kind of updates I typically just create an entity command and use the casted_on function on the affected spawn to check the command_name, and do whatever should be done for that quest step.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Special LUA scripts

Post by John Adams » Sun Aug 18, 2013 7:08 pm

Cool. Evolution is a good thing :) If your way of doing it makes more sense, then we can dismiss these older scripts. I'll keep them around for reference for now.

Thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests