Ariel Posted August 21, 2012 Author Share Posted August 21, 2012 ![](http://www.freemmorpgmaker.com/files/imagehost/pics/4112e05c11826d11dc3e3c1a63b4fcae.png)**What is Script System**Script System allow you to make custom Npcs, Items, Maps, ETC actions.ex: I want to make a Npc that will warp me to a certain map if i have a certain item. This is an example of an action that can be made using Scripts.Cool idea:Combine this with Party Only Map, Scripted maps and NPCs and you can make a nice enjoyable Party Quest. ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)**Todo**Finish up the Item and Map. Im too lazy right now .**Requirement**Any Ver. of EO.10 minutes.Common human brain ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)Visual basic 6.**Guidelines**Make a Back up.Open the server source files.Right click on modules > Add > Module![](http://www.freemmorpgmaker.com/files/imagehost/pics/6a625b7e7c345a090f4b438c5647d4ad.png)Name it: modScripts(To name it click it and change name in Properties Window)Paste This inside of the new mod:```Option ExplicitPublic Sub npcScirpt(ByVal scriptnum As Long, ByVal player As Long)Select Case scriptnumCase 0'do nothingCase 1PlayerMsg player, "Scripted NPC", Red'do nothingEnd SelectEnd SubPublic Sub ItemScirpt(ByVal scriptnum As Long, ByVal player As Long)Select Case scriptnumCase 0'do nothingCase 1PlayerMsg player, "Scripted Item", Red'do nothingEnd SelectEnd SubPublic Sub MapScirpt(ByVal scriptnum As Long, ByVal player As Long)Select Case scriptnumCase 0'do nothinCase 1PlayerMsg player, "Scripted Map", RedEnd SelectEnd Sub```Open modTypesWhat are "Types": Variables of different data types when combined as a single variable to hold several related informations is called a User-Defined data type. And this is the main way eclipse handle the data in game.Find: NpcRecInside the type add to the bottom:```'Script NPCScript As Long```Find: ItemRecInside the type add to the bottom:```'Script NPCScript As Long```Find: MapRecInside the type add to the bottom:```'Script NPCScript As Long```Do the same in modTypes that inside the Client.This Part can be different in some EO ver.(I'm using EO3.0)Open modCombatFind sub CanPlayerAttackNpcAnd Above:```If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then```If you cant find it, try to understand where the code is executing the npc action and past it there.Add:``` 'Script npc If NPC(npcNum).Script > 0 Then npcScirpt NPC(npcNum).Script, attacker End If```This lines will check if a npc have a script, and trigger it.Find sub PlayerWarpAdd below:```TempPlayer(Index).GettingMap = YES```This:```If Map(mapNum).Script > 0 Then Call MapScirpt(Map(mapNum).Script, Index)End If```Find sub UseItemAdd after:```Select Case Item(itemNum).Type```This:``` Case ITEM_TYPE_NONE If Item(itemNum).Script > 0 Then Call ItemScript(Item(itemNum).Script, Index) End If```Server side is done. Save and debug it.Open Client Source code.Make sure you added the Type at the first to the client also.Open frmEditor_NPCAdd one Scroll bar and one label.Scroll bar name: scrlScriptLabel name: lblScriptPlace them wherever you want in the form, double click scrlScript and Paste that inside:```'Script NPClblScript.Caption = scrlScript.ValueNPC(EditorIndex).Script = scrlScript.Value```This will add the script to the npc Type.You need to do that to the Map Properties and item editors. DONT FORGET TO CHANGE **NPC**(EDITORINDEX) TO THE TYPE YOU ARE EDITING!Find sub NpcEditorInitAfter:```.txtLevel.Text = NPC(EditorIndex).Level```Add:``` 'NPC Script .scrlScript.Value = NPC(EditorIndex).Script```Find sub ItemEditorInitabove:```If frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_CONSUME Then```Add:```If frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_NONE ThenfrmEditor_Item.scrlScript.visible = TruefrmEditor_Item.lblScript.visible = TruefrmEditor_Item.scrlScript.Value = .ScriptEnd If```Find```.BossNpc = scrlBoss.Value```Add after:```.Script = scrlScript.Value```Find:```.scrlFogBlending.Value = Map.FogBlendMode```Add:```.scrlScript.Value = Map.Script```Save and debug.Make a new NPC with Script choose Script 1…When you try to talk with him(or attack) he should Tell you: "Scripted NPC"Not telling? Start again. Still not telling? Post a replay.**How to add a new Script**Open modScriptsYou see there "End Select"?Above this you add "Case x"x= the next case in the sub.Now after you made a new case, add some method to it.You can:Warp-```Call PlayerWarp(player, 1, 1, 1)```Add Stat-```Call SetPlayerStat(player, Strength, GetPlayerStat(player, Strength) + 5)```Send MSG-```Call PlayerMsg(player, "Hello I am a Scripted NPC", Yellow)```You can add "If" checks and "for" loops so you can pretty much make it do anything.Yes its that easy. Have fun!_Please reply if you find bugs and Like if you use. ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)_ Link to comment Share on other sites More sharing options...
Nifflr Posted August 21, 2012 Share Posted August 21, 2012 This looks really useful, thanks for making this tutorial. ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png) I'm sure it will be very helpful.Although I haven't tried it yet. I think I might wait to hear what more experienced users think. From what I've heard scripting isn't a good thing to do because it slows down your game – which is why it wasn't included in the vanilla engine of EO. Link to comment Share on other sites More sharing options...
Joyce Posted August 21, 2012 Share Posted August 21, 2012 This isn't actual scripting. It's just hardcoding stuff in a different sub. Link to comment Share on other sites More sharing options...
Nifflr Posted August 21, 2012 Share Posted August 21, 2012 Okay, well then it sounds like a really good Idea. I definitely think I'll try adding this to my game. Link to comment Share on other sites More sharing options...
Ariel Posted August 21, 2012 Author Share Posted August 21, 2012 Then how should i call it? ^^ Link to comment Share on other sites More sharing options...
hisherwin Posted August 22, 2012 Share Posted August 22, 2012 cool , i'll try this out Link to comment Share on other sites More sharing options...
Nifflr Posted August 22, 2012 Share Posted August 22, 2012 I have a question. In modScripts, why do you call each of the subs things like "npcSc**ir**pt" rather than "npcSc**ri**pt"? Also, I don't believe that you meant to include and within the code. Link to comment Share on other sites More sharing options...
barreytor Posted August 22, 2012 Share Posted August 22, 2012 Wasn't the event system created just to do this kind of stuff?Also, has been said before, this isn't scripting; it's just hardcoding more stuff. Link to comment Share on other sites More sharing options...
Nifflr Posted August 22, 2012 Share Posted August 22, 2012 > Wasn't the event system created just to do this kind of stuff?Aye, but the event system can't script items and it would appear that this can. Link to comment Share on other sites More sharing options...
Ariel Posted August 22, 2012 Author Share Posted August 22, 2012 lol its my mistake you can edit it to be "script".And i know it isnt actual scripting but i have no idea how else to call it.@niffler, Im not sure you should add Items and Maps yet I added them from my head and didnt tested them yet. If you do, let me know the result. Link to comment Share on other sites More sharing options...
Joyce Posted August 22, 2012 Share Posted August 22, 2012 > Wasn't the event system created just to do this kind of stuff?> > Also, has been said before, this isn't scripting; it's just hardcoding more stuff.It has a purpose really, you can't do everything with just the event system(Not to mention Events, especially parralel ones are far from efficient). This sort of stuff is neat for the more advanced users that wish to have menus pop-up or various other things. Link to comment Share on other sites More sharing options...
Wortel Angels Posted August 22, 2012 Share Posted August 22, 2012 erm isnt it the same as in EO 2.3 +Custom Events ? Link to comment Share on other sites More sharing options...
Vus Posted August 22, 2012 Share Posted August 22, 2012 Nice tutorial. Link to comment Share on other sites More sharing options...
Nifflr Posted August 22, 2012 Share Posted August 22, 2012 > Im not sure you should add Items and Maps yet I added them from my head and didnt tested them yet. If you do, let me know the result.Yeah, I'm going to wait until this tutorial is complete before I make any changes to my source. But I'll follow this topic so that I can see when you update this ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png) Link to comment Share on other sites More sharing options...
Ariel Posted August 23, 2012 Author Share Posted August 23, 2012 Should not take long, i just need to get my last project up to date with eo ver first. 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