System Random Quest Generator

Evoroth

New Member
Reaction score
11
In short:
This "system" allows you to create a list of quests, assign it different difficulties and let players get quests for the difficulties they wish.

I made it for a guy in this thread, and just wanted to know what you others think about it.

Questgeneratorsystemscreen.jpg


I can say that it's a bit experimential, but I have tested it a lot and there's no bugs or leaks as far as I know. It should be very easy to create your own random quest list.

How it works in game:

Player 1 can type "new" to start a new quest. You can only do this if you have less than 4 active quests. A multiboard appears in which you choose the difficulty of the quest, and after that, you activate a random quest from the list you have made, and its description
appears. As soon as you have killed all the units you're supposed to kill, a "Completed Quest"-message appears and you get the reward. You can type "questlist" to get a list of your current
quests.

To make your own quests, you only have to set a few variables at map start. This is how I have done with quest 1 (you can see it in the Quest Variables trigger in my demo map):

Set QuestName[1] = |cff00dd00Pure Epic Slaughtering|r
Set QuestMessage[1] = There's something special about killing humans, right? I would really like you to kill 5 of them.
Set QuestTarget[1] = Footman
Set QuestKills[1] = 5
Set QuestRewardGold[1] = 200

So, when you activate the quest, you will see this message:

Pure Epic Slaughtering (green text)
There's something special about killing humans, right? I would really like you to kill 5 of them.

And when you have killed 5 footmen, you get 200 gold. You can set these values to anything, it works perfectly. Also, you can set this:

Set QuestRewardLumber[1] = 200
Set QuestRewardItem[1] = Snow Shoes

...to add lumber and item rewards. The item appears at the body of the last unit you killed for the quest.

Also, you can add

Set QuestCompletedMessage[1] = "Your mother will be proud!"

...to make that message appear when the quest is completed, instead of the ordinary "You have completed the quest"-message.

So, this was quest one, and obviously, every quest has a number. When you choose an easy quest, you get one random from quest 1 to 10. Medium quests are 11 to 25, and hard are
from 26 to 50. This can be easily changed (if you, for example want 20 easy quests, from 1 to 20), you can see where in the Choose New Quest trigger. However, DO NOT use quest 0.
Just because you're not supposed to, and because I say so.

If you want to change the maximum number of active quests, there's just a few 4's you have to change in the code. I have marked them with comments.

However, the objective of the quest doesn't have to be killing creatures. If so, just set quest's QuestKills to 1, and QuestTarget to an unique unit which you place in a special area in the
map so that it cannot be reached, seen, or killed. Then you add in quest message what the players should do, trigger your quest in the way you want, and when it's goals has been met, just
make the unit who completed the quest, damage that special unit via some Damage Unit action or DamageUnit function.

OK, I will forget to write some thing anyway. Ask if you need, so I can continue. To import this system, add these triggers to your map:

Kill Quest Units
function Trig_Kill_Quest_Units_Actions takes nothing returns nothing
local integer i = 1
local location l = null
local integer id
loop
if GetUnitTypeId(GetDyingUnit()) == udg_QuestTarget[udg_QuestId] then
set id = udg_QuestId
set udg_KillCount = udg_KillCount + 1
if udg_KillCount == udg_QuestKills[id] then
set l = GetUnitLoc(GetDyingUnit())
if udg_QuestCompletedMessage[id] == null then
call DisplayTextToForce(GetPlayersAll(),"You have completed the quest "+udg_QuestName[id]+" and recieved "+ I2S(udg_QuestRewardGold[id])+" gold!")
else
call DisplayTextToForce(GetPlayersAll(),udg_QuestCompletedMessage[udg_QuestId[id]])
endif
call SetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD) + udg_QuestRewardGold[id])
call SetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_LUMBER) + udg_QuestRewardLumber[id])
call CreateItemLoc(GetItemTypeId(udg_QuestRewardItem),l)
call RemoveLocation(l)
set udg_QuestTaken[udg_QuestId] = false
set udg_QuestId = 0
set udg_KillCount = 0
else
call DisplayTextToForce(GetPlayersAll()),"You have killed "+I2S(udg_KillCount)+"/"+I2S(udg_QuestKills[id])+" "+GetUnitName(GetDyingUnit())+"s.")
endif
endif
exitwhen i > 4
set i = i + 1
endloop
endfunction

//===========================================================================
function InitTrig_Kill_Quest_Units takes nothing returns nothing
set gg_trg_Kill_Quest_Units = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Kill_Quest_Units, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Kill_Quest_Units, function Trig_Kill_Quest_Units_Actions )
endfunction


Choose New Quests
function Trig_Choose_New_Quest_Actions takes nothing returns nothing
local integer id = 0
local integer slot = 1
local integer s = 0
if GetClickedButton() == udg_DialogButton[0] then
loop
// Quest 1 to 10 are Easy. Change the values below to change that.
set id = GetRandomInt(1,10)
exitwhen udg_QuestTaken[id] == false and id != 0
endloop
loop
exitwhen udg_QuestId[slot] == 0
set slot = slot + 1
endloop
elseif GetClickedButton() == udg_DialogButton[1] then
loop
// Quest 11 to 25 are Medium. Change the values below to change that.
set id = GetRandomInt(11,25)
exitwhen udg_QuestTaken[id] == false
endloop
loop
exitwhen udg_QuestId[slot] == 0
set slot = slot + 1
endloop
elseif GetClickedButton() == udg_DialogButton[2] then
loop
// Quest 26 to 50 are Hard. Change the values below to change that.
set id = GetRandomInt(26,50)
exitwhen udg_QuestTaken[id] == false
endloop
loop
exitwhen udg_QuestId[slot] == 0
set slot = slot + 1
endloop
endif
loop
call DisplayTextToForce(GetPlayersAll()),udg_QuestName[id])
call DisplayTextToForce(GetPlayersAll()),udg_QuestMessage[id])
set s = s +1
exitwhen s == 11
endloop
set udg_QuestId[slot] = id
set udg_QuestTaken[id] = true
endfunction

//===========================================================================
function InitTrig_Choose_New_Quest takes nothing returns nothing
set gg_trg_Choose_New_Quest = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Choose_New_Quest, udg_QuestDialog[0] )
call TriggerAddAction( gg_trg_Choose_New_Quest, function Trig_Choose_New_Quest_Actions )
endfunction

New Quest Dialog
function Trig_New_Quest_Button_Conditions takes nothing returns boolean
local integer i = 1
loop
//this is one of the 4's you have to change if you want to change the max number of active quests.
if i > 4 then
return false
exitwhen true
elseif udg_QuestId == 0 then
return true
exitwhen true
endif
set i = i + 1
endloop
if GetPlayerId(GetTriggerPlayer()) != 0 then
return false
endif
return true
endfunction

function Trig_New_Quest_Button_Actions takes nothing returns nothing
call DialogClear(udg_QuestDialog[0])
call DialogSetMessage( udg_QuestDialog[0], "Choose new quest difficulty" )
set udg_DialogButton[0] = DialogAddButton( udg_QuestDialog[0], "Easy",1 )
set udg_DialogButton[1] = DialogAddButton( udg_QuestDialog[0], "Medium",2 )
set udg_DialogButton[2] = DialogAddButton( udg_QuestDialog[0], "Hard",3 )
call DialogDisplay(Player(0),udg_QuestDialog[0],true)
endfunction

//===========================================================================
function InitTrig_New_Quest_Dialog takes nothing returns nothing
set gg_trg_New_Quest_Dialog = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_New_Quest_Dialog, Player(0), "new", true )
call TriggerAddCondition( gg_trg_New_Quest_Dialog, Condition( function Trig_New_Quest_Button_Conditions ) )
call TriggerAddAction( gg_trg_New_Quest_Dialog, function Trig_New_Quest_Button_Actions )
endfunction


Questlist Command

function Trig_Questlist_Command_Actions takes nothing returns nothing
local integer i = 1
local unit u
local integer id
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Current Quests:")
loop
if udg_QuestId != 0 then
set id = udg_QuestId
call DisplayTextToPlayer(GetTriggerPlayer(),0,0," ")
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,udg_QuestName[id])
if udg_QuestTarget[id] != null then
set u = CreateUnit(Player(12),udg_QuestTarget[id],0,0,0)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,I2S(udg_KillCount)+"/"+I2S(udg_QuestKills[id])+" "+GetUnitName(u)+"s.")
call RemoveUnit(u)
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,udg_QuestMessage[udg_QuestId])
endif
endif
set i = i + 1
//this is one of the 4's you have to change if you want to change the max number of active quests.
exitwhen i > 4
endloop
endfunction

//===========================================================================
function InitTrig_Questlist_Command takes nothing returns nothing
set gg_trg_Questlist_Command = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Questlist_Command, Player(0), "questlist", true )
call TriggerAddAction( gg_trg_Questlist_Command, function Trig_Questlist_Command_Actions )
endfunction


... and create these global variables:

QuestTaken Boolean Array
QuestDialog Dialog Array
DialogButton Dialog Button Array
KillCount Integer Array
QuestId Integer Array
QuestKills Integer Array
QuestRewardGold Integer Array
QuestRewardLumber Integer Array
QuestRewardItem Item Array
QuestCompletedMessage String Array
QuestMessage String Array
QuestName String Array
QuestTarget Unit-Type Array
 

Romek

Super Moderator
Reaction score
964
It can be quite useful, except that it's only for "kills" quests. Were you need to kill a certain amount of units... Thats bad :p
 

hell_knight

Playing WoW
Reaction score
126
It can be quite useful, except that it's only for "kills" quests. Were you need to kill a certain amount of units... Thats bad :p

This is where improvising comes in.

Pretend you need to reach a location , for example make it when you enter that region you kill a dummy named whatever you like.

Same goes for retrieving or completting a task , make it kill a dummy unit and you will get the 1/1 on it.

Ex: Reach Mount Hyjal 1/1
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs
  • Monovertex Monovertex:
    @The Helper I'm really not seeing the "Signature" link in the sidebar on that page. Here's a screenshot:
  • The Helper The Helper:
    I have reported it - I was wondering why nobody I have given sigs to over the last few years have used them
  • The Helper The Helper:
    Ghan has said he has fixed this. Monovertex please confirm this fix. This was only a problem with people that had signatures in the upper levels like not the special members but the respected members.
  • The Helper The Helper:
    Here is a better place to manage this stuff https://www.thehelper.net/account/account-details which I think should be way more visible
  • The Helper The Helper:
    I am hoping that online user count drop is finally that TikTok bot banned
  • Ghan Ghan:
    I added the filter last night.
  • The Helper The Helper:
    They are still there

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top