Richy420Rich Posted January 29, 2011 Author Share Posted January 29, 2011 Source Quest System TutorialThis basically tells people how to enable Questing in source…Not a quest maker unfortunatly, but feel free if you'd like to work off of this system..Server Side AND Client Side (modConstants)Under the NPC constants, place under the NPC_BEHAVIOUR_GUARD```Public Const NPC_BEHAVIOUR_SCRIPTED As Byte = 5```Client Side (frmEditor_NPC)Click on cmbBehaviour and scroll down on the bottom right side to see 'List'Select 'List' and on the bottom, type in Scripted like the picture below.[http://www.freewebs.com/acoria/Pic0.PNG](http://www.freewebs.com/acoria/Pic0.PNG)Server Side (modCombat)In the Function CanPlayerAttackNpcYou'll need to change this code from.If Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER ThenTo this;```If Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER And Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_SCRIPTED Then```(There are 2 lines in that function that needs changed)Now to add the Quest Calling.. AFTER the ELSE (where shown in picture) put in the following code.[http://www.freewebs.com/acoria/Pic1.PNG](http://www.freewebs.com/acoria/Pic1.PNG)```If Npc(npcNum).Behaviour = NPC_BEHAVIOUR_SCRIPTED ThenCanPlayerAttackNpc = FalseCall QuestScript(attacker, Int(npcNum))Exit FunctionEnd If```Server Side (modTypes)Under >>> ' public data structuresPlace this on the bottom;```Public Quest(1 To MAX_PLAYERS) As PlayerRec```After >>> Public Type HotbarRec Slot As Long sType As ByteEnd TypePlace this;```Public Type QuestRecNPCQuestProgress As LongEnd Type```In the bottom of PlayerRec , Place this;``` 'Quest NPCQuest(1 To MAX_NPCS) As QuestRec```I created a new module called (modQuest)If you do the same, make sure Option Explicit goes on the very top line.Otherwise, where ever you wanna put the quest scripts.Replace the one you have already with this, or put this in if you haven't yet;```Public Sub QuestScript(attacker, Script)Select Case ScriptCase 1If Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 2 ThenCall PlayerMsg(attacker, "Angel: Nice job getting the weird potion!", Green)ElseIf Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 1 ThenIf HasItem(attacker, 3) ThenCall TakeInvItem(attacker, 3, 0)Call PlayerMsg(attacker, "Angel: Wow, I needed this. Now I can make a stronger potion! Here's your reward.", Green)Call PlayerMsg(attacker, "You just obtained 100 Gold!", Green)Call GiveInvItem(attacker, 1, 100, True)Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 2ElseCall PlayerMsg(attacker, "Angel: I believe you can get a Weird Potion by cutting down one of these trees, don't know how you obtain a Potion for it though haha.", Green)End IfElseIf Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 0 ThenCall PlayerMsg(attacker, "Angel: Hey.. Maybe you can help me, I like to get a Weird Potion? I'll reward you...", Green)Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 1End IfExit SubCase 2Exit SubCase 3Exit SubCase 4Exit SubCase 5Exit SubCase ElseCall PlayerMsg(attacker, "There is no quest script for NPC Number " & Int(Script) & ". Check the source..", BrightRed)Exit SubEnd SelectEnd Sub```Client Side (modTypes)Above PlayerRec Place this;```Public Type QuestRecNPCQuestProgress As LongEnd Type```Inside PlayerRec, in the bottom, place this;``` 'Quest NPCQuest(1 To MAX_NPCS) As QuestRec```This should hook the NPC Number Quest with the Quest Progress, so there should be no conflicting.. I'm testing this now. If I'm not mistaking, it should save right..Basically to make the quest, these quest are called by the NPC Num. If the NPC Num is 1 (Which is named as Angel on mine)Case 1 will be called when you "attack" Angel.So if your NPC Num is 213.. You'd need a Case 213 to allow that NPC to give quest..That's about it… It's not the best but it works as a temp for those who don't really wanna get their hands messy with an epic system right now lol.[http://www.freewebs.com/acoria/Pic2Work.PNG](http://www.freewebs.com/acoria/Pic2Work.PNG)–------------------------------------------------------------------------------------------------------------------------------Source Item Script SystemBasically the same concept as the Quest System above.Server Side AND Client Side (modConstants)Under the ITEM_TYPE constants, place under the ITEM_TYPE_SPELL```Public Const ITEM_TYPE_SCRIPTED As Byte = 9```Client Side (frmEditor_Item)Click on cmbType, scroll in the properties tab for 'List' (Like above)Click on 'List' and add Scripted on the last line, hit enter.Server Side (modPlayer)Look for Sub UseItem (Just above the End Select) Drop this in. ``` Case ITEM_TYPE_SCRIPTED ' stat requirements For I = 1 To Stats.Stat_Count - 1 If GetPlayerRawStat(Index, I) < Item(itemnum).Stat_Req(I) Then PlayerMsg Index, "You do not meet the stat requirements to use this item.", BrightRed Exit Sub End If Next ' level requirement If GetPlayerLevel(Index) < Item(itemnum).LevelReq Then PlayerMsg Index, "You do not meet the level requirement to use this item.", BrightRed Exit Sub End If ' class requirement If Item(itemnum).ClassReq > 0 Then If Not GetPlayerClass(Index) = Item(itemnum).ClassReq Then PlayerMsg Index, "You do not meet the class requirement to use this item.", BrightRed Exit Sub End If End If ' access requirement If Not GetPlayerAccess(Index) >= Item(itemnum).AccessReq Then PlayerMsg Index, "You do not meet the access requirement to use this item.", BrightRed Exit Sub End If Call ItemScript(Index, itemnum)```Server Side (I created my own module called modItem)If created a new module, put Option Explicit on the first line..Seems like it's needed lolAnyways, drop this code inside the new module or where ever you deem fit.```Public Sub ItemScript(index, Script)Dim RandTalkRandTalk = RAND(1, 8)Select Case ScriptCase 1' Item number 1 will run this script if item type is selected as ScriptedIf Int(RandTalk) = 2 ThenCall PlayerMsg(index, "I wonder what I can do with this gold man!", White)ElseIf Int(RandTalk) = 3 ThenCall PlayerMsg(index, "I should have left Item1 as currency haha, now I can't spend the gold!", White)ElseIf Int(RandTalk) = 4 ThenCall PlayerMsg(index, "Wonder why an Angel is here.", White)ElseIf Int(RandTalk) = 5 ThenCall PlayerMsg(index, "Oh well, just too bored now.", White)ElseIf Int(RandTalk) = 6 ThenCall PlayerMsg(index, "This explaination should be good enough.", White)ElseIf Int(RandTalk) = 7 ThenCall PlayerMsg(index, "Someone just stole my Gold!", BrightRed)Call TakeInvItem(index, 1, 200)ElseCall PlayerMsg(index, "They see me rollin'. They hatin'. Oh wait, nevermind.", White)End IfExit SubCase 2'Item Num 2Exit SubCase 3'Item Num 3Exit SubCase 4'Item Num 4Exit SubCase 5'Item Num 5Exit SubCase ElseCall PlayerMsg(index, "There is no item script for Item Number " & Int(Script) & ". Check the source.", BrightRed)Exit SubEnd SelectEnd Sub```Basically to make the item scripted, these items are called by the Item Num. If the Item Num is 1 (Which the item is named Gold on mine)Case 1 will be called when you go to use the item.So if your Item Num is 213.. You'd need a Case 213 to allow that Item to use custom script…That's about it... It's not the best but it works as a temp for those who don't really wanna get their hands messy with an epic system right now lol.[http://www.freewebs.com/acoria/Pic4Work.PNG](http://www.freewebs.com/acoria/Pic4Work.PNG)EDIT:Added the Source Tile Script SystemClient and Server Side (modConstants)On the bottom of the TILE_TYPE Constants. Add this;```Public Const TILE_TYPE_SCRIPTED As Byte = 15```Server Side (modPlayer) - PlayerMoveAbove this code; ' They tried to hack If Moved = NO Then Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index)) End IfAdd this;``` If .Type = TILE_TYPE_SCRIPTED Then Call TileScript(index, .Data1) Moved = YES End If```^^ Make sure the End With is after this code, not before it. ^^Server Side (I created my own module named modTile)Make sure Option Explicit is in the first line if you create a module.Otherwise, add this code where you want.```Public Sub TileScript(index, Script)Select Case ScriptCase 1' Select the Scripted Tile to whichever script you want ran here.Call PlayerMsg(index, "You stepped on a scripted tile!", Red)Exit SubCase ElseCall PlayerMsg(index, "There is no tile script for this Tile, Script Number " & Int(Script) & ". Check the source.", BrightRed)Exit SubEnd SelectEnd Sub```Client Side (modText) - BltMapAttributesUnder >>> Case TILE_TYPE_SLIDE DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)Add this;``` Case TILE_TYPE_SCRIPTED DrawText TexthDC, tX, tY, "S", QBColor(Black)```Client Side (modGameEditors) - MapEditorMouseDownUnder >>> ' slide If frmEditor_Map.optSlide.Value Then .Type = TILE_TYPE_SLIDE .Data1 = MapEditorSlideDir .Data2 = 0 .Data3 = 0 End IfAdd this;``` If frmEditor_Map.optScript.Value Then .Type = TILE_TYPE_SCRIPTED .Data1 = TileScript .Data2 = 0 .Data3 = 0 End If ```^^ Make sure the End With is after this code, not before it. ^^Client Side (modGlobals)Under >>> Public EditorShop As LongPlace in;```Public TileScript As Long```Final thing is to edit the form..Client Side (frmEditor_Map)Need to add a option box in the Attributes Frame, name it optScriptNeed to add a frame on the right hand side where the other frames are, name it fraScriptIn fraScript , add a HScrollBar and 2 labels, and a command button.Caption the first label as Script Number. Name the second label ScriptNum and Caption it 1Name the command button cmdScript and Caption it as OkayClick on the Scrollbar, and add this code into the HScroll1_Click;```frmEditor_Map.ScriptNum = Int(HScroll1.Value)```Click on the optScript option box in Attributes and add this code into the optScript_Click;``` ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler ClearAttributeDialogue picAttributes.Visible = True fraScript.Visible = True ' Error handler Exit Suberrorhandler: HandleError "optScript_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit Sub```Click on the command box, and add this code into the cmdScript_Click; ``` ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler TileScript = Int(frmEditor_Map.HScroll1.Value) picAttributes.Visible = False fraScript.Visible = False ' Error handler Exit Suberrorhandler: HandleError "cmdScript_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub ```This should enable the scripted tiles in EO, your script number will be the case you'll call to run your scripted tile.[http://www.freewebs.com/acoria/ScriptedTile.PNG](http://www.freewebs.com/acoria/ScriptedTile.PNG) Link to comment Share on other sites More sharing options...
damian666 Posted January 29, 2011 Share Posted January 29, 2011 very nice, sourced scripted items and npc's, me like ^^now only add scripted tiles and were up to speed:)great job, im sure i can build on this.Dami Link to comment Share on other sites More sharing options...
Robin Posted January 29, 2011 Share Posted January 29, 2011 Use code tags. Link to comment Share on other sites More sharing options...
leopoldobb Posted February 1, 2011 Share Posted February 1, 2011 Thanks! Nice tutorial dude :) Link to comment Share on other sites More sharing options...
thezeus Posted February 1, 2011 Share Posted February 1, 2011 Robin, for quests, do you recommend and ini system? Link to comment Share on other sites More sharing options...
Robin Posted February 1, 2011 Share Posted February 1, 2011 @thezeus:> Robin, for quests, do you recommend and ini system?I never recommend an ini system. Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 1, 2011 Author Share Posted February 1, 2011 How else could you do it? Run them inside the Player Rec? Either way, it'd be a load of information to read/write per every quest you have. I dunno lol I'm n00b. :P Link to comment Share on other sites More sharing options...
damian666 Posted February 1, 2011 Share Posted February 1, 2011 personally i would make a a Questrec, but thats just me xdDami Link to comment Share on other sites More sharing options...
Guest Posted February 1, 2011 Share Posted February 1, 2011 Pretty nice work Richy. I may play with this until an epic quest version is released. Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 1, 2011 Author Share Posted February 1, 2011 I'm have to find out how exactly to do the QuestRec.. It works but it only works for 1 account.. Because the varibles aren't getting reset, and I need to find out how to reset the varibles without resetting the player that already did the quest.. Link to comment Share on other sites More sharing options...
thezeus Posted February 1, 2011 Share Posted February 1, 2011 Great work site. Link to comment Share on other sites More sharing options...
leopoldobb Posted February 1, 2011 Share Posted February 1, 2011 Scripted Tiles? I love you man.Edit:Your method to scripting (NPCs, Tiles and itens) creating new modules rules!Edit2:You doesn't defined "TileScript", check this. Link to comment Share on other sites More sharing options...
iSKweek Posted February 1, 2011 Share Posted February 1, 2011 I got an invalid or unqualified reference error for```If .Type = TILE_TYPE_SCRIPTED Then ```Also a variable not defined error for```.Data1 = TileScript```The rest of this is awesome though :D Link to comment Share on other sites More sharing options...
leopoldobb Posted February 1, 2011 Share Posted February 1, 2011 @iSkweek:> I got an invalid or unqualified reference error for```> If .Type = TILE_TYPE_SCRIPTED Then > ```> > Also a variable not defined error for```> .Data1 = TileScript> ```> The rest of this is awesome though :DDefine the "TileScript", and check where do you paste the "If .type…. " Link to comment Share on other sites More sharing options...
Robin Posted February 1, 2011 Share Posted February 1, 2011 @Richy:> How else could you do it? Run them inside the Player Rec? Either way, it'd be a load of information to read/write per every quest you have. I dunno lol I'm n00b. :PYou don't read/write anything except when saving the player.. >_>To be honest this just looks like a cheap port of something made in SadScript. Stuff like that just doesn't work well in Origins. It's the old 2.7 mentality. Bad habits and bad practices.Try and forget everything you already know. Go grab a copy of Origins and teach yourself everything again. Link to comment Share on other sites More sharing options...
iSKweek Posted February 1, 2011 Share Posted February 1, 2011 @leopoldobb:> Define the "TileScript", and check where do you paste the "If .type…. "Where would I define it? Sorry I am slightly noobish :P Link to comment Share on other sites More sharing options...
leopoldobb Posted February 1, 2011 Share Posted February 1, 2011 Start of sub. Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 1, 2011 Author Share Posted February 1, 2011 @iSkweek:> Where would I define it? Sorry I am slightly noobish :PClient Side (modGameEditors) - MapEditorMouseDownUnder >>> ' slide If frmEditor_Map.optSlide.Value Then .Type = TILE_TYPE_SLIDE .Data1 = MapEditorSlideDir .Data2 = 0 .Data3 = 0 End IfAdd this;``` If frmEditor_Map.optScript.Value Then .Type = TILE_TYPE_SCRIPTED .Data1 = TileScript .Data2 = 0 .Data3 = 0 End If```^^ Make sure the End With is after this code, not before it. ^^ Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 1, 2011 Author Share Posted February 1, 2011 @Robin:> You don't read/write anything except when saving the player.. >_>> > To be honest this just looks like a cheap port of something made in SadScript. Stuff like that just doesn't work well in Origins. It's the old 2.7 mentality. Bad habits and bad practices.> > Try and forget everything you already know. Go grab a copy of Origins and teach yourself everything again.Perhaps… There's like 20 other people making the same type of mods, and you choose to attack mine. A cheap port of SadScript... I guess people like the cheap port since this topic was viewed 300+ times.As I said, I know it ain't the best but it's here until someone really wants to get dirty with it. Link to comment Share on other sites More sharing options...
Robin Posted February 2, 2011 Share Posted February 2, 2011 @Richy:> Perhaps… There's like 20 other people making the same type of mods, and you choose to attack mine. A cheap port of SadScript... I guess people like the cheap port since this topic was viewed 300+ times.> As I said, I know it ain't the best but it's here until someone really wants to get dirty with it.Wasn't an attack, was just a comment. I noticed that it felt like 2.7 code and pointed it out. Inis should be forgotten about completely, especially constant IO during runtime.I'm not going to bother commenting on the '20 other people' and their quest systems because they're not actually going anywhere. I only bother posting on stuff which looks like it might actually have some promise. Link to comment Share on other sites More sharing options...
Richy420Rich Posted February 2, 2011 Author Share Posted February 2, 2011 Well, until I find out how to execute the Types correctly, I'm gonna have to leave it as is.. Because my (no .ini) edit was bugged, but I spent most of my night on sourcing all this, this wasn't no copy/paste shit. So I was offended to receive that cheap port statement.EDIT: But if anyone wants to edit any or all of this, to how you want.. I just don't have the knowledge right now this second to implement the QuestRec types. Link to comment Share on other sites More sharing options...
damian666 Posted February 2, 2011 Share Posted February 2, 2011 lol, I did it almost exactly the same last night xdworks great now doesnt it ^^and although its indeed a almost identical rip of 2.7/stable code, I would not know how to do it differently, I mean, it is sourced, so the slowness should not be there right?ps. talking about scripted tiles only mind you.Dami Link to comment Share on other sites More sharing options...
damian666 Posted February 2, 2011 Share Posted February 2, 2011 questrec, im noob too, but i would do something like, adding a quest in playerrec.like:```IN playerrecQuest(1 to 250) as Questrec```and then in questrec, have certain entries, for example…```Type QuestRecQuestNr as LongNpcNr as longRewarditem1 as longNeedItem1 as Longend Type```just a example i put down out of my head xdDami Link to comment Share on other sites More sharing options...
Guest Posted February 2, 2011 Share Posted February 2, 2011 Don't worry Richy, Robin's excuse for his bad "Bed Side Manners" are something about his heritage. All in all he is pretty damn cool once you can get past that.The reason so many people have looked at this is becouse a good game engine just can not be without a quest and skill system. In fact when Robin had his shop I do belive one of the biggest requests for custom work was a quest system. I'm sure Robin is slowely gearing up the engine so that when the time is right he can properly implement a proper quest and skill sytem. If he has no plans to do so then EO will be totaly pointless for most people. Link to comment Share on other sites More sharing options...
iSKweek Posted February 2, 2011 Share Posted February 2, 2011 I had all of that in there haha. I might just leave it til I understand it all a bit more, thanks though :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now