![](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//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//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 Explicit Public Sub npcScirpt(ByVal scriptnum As Long, ByVal player As Long) Select Case scriptnum Case 0 'do nothing Case 1 PlayerMsg player, "Scripted NPC", Red 'do nothing End Select End Sub Public Sub ItemScirpt(ByVal scriptnum As Long, ByVal player As Long) Select Case scriptnum Case 0 'do nothing Case 1 PlayerMsg player, "Scripted Item", Red 'do nothing End Select End Sub Public Sub MapScirpt(ByVal scriptnum As Long, ByVal player As Long) Select Case scriptnum Case 0 'do nothin Case 1 PlayerMsg player, "Scripted Map", Red End Select End Sub ``` Open modTypes What 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: NpcRec Inside the type add to the bottom: ``` 'Script NPC Script As Long ``` Find: ItemRec Inside the type add to the bottom: ``` 'Script NPC Script As Long ``` Find: MapRec Inside the type add to the bottom: ``` 'Script NPC Script 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 modCombat Find sub CanPlayerAttackNpc And 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 PlayerWarp Add below: ``` TempPlayer(Index).GettingMap = YES ``` This: ``` If Map(mapNum).Script > 0 Then Call MapScirpt(Map(mapNum).Script, Index) End If ``` Find sub UseItem Add 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_NPC Add one Scroll bar and one label. Scroll bar name: scrlScript Label name: lblScript Place them wherever you want in the form, double click scrlScript and Paste that inside: ``` 'Script NPC lblScript.Caption = scrlScript.Value NPC(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 NpcEditorInit After: ``` .txtLevel.Text = NPC(EditorIndex).Level ``` Add: ``` 'NPC Script .scrlScript.Value = NPC(EditorIndex).Script ``` Find sub ItemEditorInit above: ``` If frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_CONSUME Then ``` Add: ``` If frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_NONE Then frmEditor_Item.scrlScript.visible = True frmEditor_Item.lblScript.visible = True frmEditor_Item.scrlScript.Value = .Script End 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 modScripts You 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//smile.png)_