Register for your free account! | Forgot your password?

You last visited: Today at 16:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Hybrid]Shortcut npc

Discussion on [Hybrid]Shortcut npc within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old 11/24/2010, 09:41   #16
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
Realize, mine is runtime-editable (in sense of editing the script file, in this case, all are *.vb, will be taken in to consideration at run-time, and changes will be visible in game without a server restart) where I doubt the first one is.

The second one is, but it seems like it'd be a lot of pain to implement things that require more logic such as, how would one script the marriage NPC in this format (due to the packet logic, and the need for variables). In scenarios such as where keep-alive scope variables are required (i.e. the tinter/armor dye) how does one store variables with this system (or even perform arithmetic).

I think the second system has a good idea to it, but isn't thoroughly thought out, and would require the end-programmer to do a more work than required to implement for support for these sorts of things (i.e. variables) while accommodating for speed.

Also,
Code:
Engine = new ScriptEngine("VB/C#");
Code:
// By: Wolf
// Npc: 10021
// Name: ArenaGuard

using System;
using ConquerScriptLinker;

public partial class NpcEngine
{
    public static void ArenaGuard()
    {
        string[] dlg = null;
        switch (OptionID)
        {
            case 0:
                dlg = new string[3];
                dlg[0] = "TEXT Hello would you like to enter the PK Arena for 50 silvers?";
                dlg[1] = "OPTION1 Yes, here you go.";
                dlg[2] = "OPTION-1 No thanks.";
                break;
            case 1:
                if (Player.Money >= 50)
                {
                    Player.Money -= 50;
                    Command("@mm 1005 50 50");
                }
                else
                {
                    dlg = new string[2];
                    dlg[0] = "TEXT I'm sorry you dont have 50 silvers.";
                    dlg[1] = "OPTION-1 Oh, I will go work my corner more.";
                }
                break;
        }
        if (dlg != null)
            Dialog(dlg);
    }
}
Good to go.

Edit -- Scripted Marriage:
Code:
'#include ...\define_data.vb
'#include ...\define_string.vb
' By: Hybrid
' Npc: 390
' Name: Love Stone

Imports System
Imports ConquerScriptLinker

Partial Public Class NpcEngine
    Public Shared Sub LoveStone()
        Dim dlg As String() = Nothing

        Select Case OptionID
            Case 0
                ReDim dlg(3)
                dlg(0) = "TEXT I am the all mighty digital-pimp, what is it you wish?"
                dlg(1) = "OPTION1 Get married."
                dlg(2) = "OPTION2 Get divorced."
                dlg(3) = "OPTION-1 Nothing."
            Case 1
                Player.SendData(DataID.Switch, DataSwitchArg.MarriageMouse, 0, 0)
            Case 2
                Dim spouse As INpcPlayer = FindPlayerByName(Player.Spouse)
                If Not spouse Is Nothing Then
                    Player.SpouseAccount = ""
                    Player.Spouse = "None"
                    spouse.SpouseAccount = ""
                    spouse.Spouse = "None"

                    Player.SendString(StringID.Spouse, "None")
                    spouse.SendString(StringID.Spouse, "None")
                Else
                    Dim SpouseFile As String = DatabasePath & "\Accounts\" & Player.SpouseAccount & ".ini"
                    If String.Compare(QueryDatabase("Character", "Spouse", "", SpouseFile), Player.Account, True) Then
                        Player.SpouseAccount = ""
                        Player.Spouse = "None"
                        Player.SendString(StringID.Spouse, "None")

                        WriteDatabase("Character", "Spouse", "", SpouseFile)
                    End If
                End If
        End Select

        If Not dlg Is Nothing Then
            Dialog(dlg)
        End If
    End Sub
End Class
InfamousNoone is offline  
Thanks
1 User
Old 11/24/2010, 10:08   #17
 
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 81
the first one can be modified during runtime and changes do update. the second one is good but it can't perform arithmetic and is very limited, also a lot of work to create.
ChingChong23 is offline  
Old 11/24/2010, 10:37   #18
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
Oh, at first I assumed that was C#, but I suppose that's probably LUA you're using there in the first one, eh? I don't particularly like LUA, but it would certainly get the job done for this task (when I coded my engine I intended it to be used for other stuff other than Conquer, but I'm not going to bother going into detail...)
InfamousNoone is offline  
Old 11/24/2010, 11:24   #19
 
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 81
nah it's Beanshell and its for Java. it also supports full Java syntax and the scripts have full access to the server scope, i have a wrapper class full of helpful methods that each script may use.

Lua & IronPython for C# would be good ones to look into though. WoW private servers like to use Lua.
ChingChong23 is offline  
Old 11/24/2010, 20:44   #20
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Just made my scripting format.

Ill be using something kinda like ini(except its not).
Format:
Code:
By: Me ;END
ID: 2209; ;END
Cases: 12; ;END

Case1: ;END
Text: Howdy there partner! ;END
Link: Hi ;GOTO 4 ;END
;CASE1END;

;NPCEND;
Looks ugly? Doesnt really matter. I'll be making an user friendly application to generate this file with what they want. Fully flexible. Will create backups and send to the server, Might even upload all the npcs to a secure link and have the server read them(Wondering on delay of the npc loading if needed to establish a connection to the site, but create a connection then if connection loses just make all NPCS say "NPCs are offline will be back shortly, if after 3 failed attempts to establish a connection all gms/pms will be informed of this error and all players will be alerted "Error with NPCs. Will be back online asap.") and have not designed the engine at all yet.
_DreadNought_ is offline  
Reply


Similar Threads Similar Threads
Hilfe bei Shortcut und Gui
10/06/2010 - AutoIt - 8 Replies
Hallo :) Ich bin relativ neu in Auto it und wollte fragen wie ich bei meinem Script ein Exit Shortcut machen kann? Ausserdem wollte ich frage wie ich ein Gui erstelle bei dem man nur euf einen Knopf drücken muss und dann reconnectet wird...? HotKeySet ("^!{s}","start") Func start() Run ("C:\Program Files\Mozilla Firefox\firefox.exe") WinWaitActive ("Google - Mozilla Firefox")
SRO DB-BOT Shortcut Key
06/09/2010 - SRO Private Server - 10 Replies
Hi, can someone tell me if there is a shortcut key to pop-up the botmenu? Like in isrobot. Pos1 or something. Since I am using Windows 7 it does cause trouble alt+tab with the bot. It wont appear anymore! Windows xp didn´t hat this problem. Thanks alot
Vista EO Shortcut
04/20/2009 - EO Exploits, Hacks, Tools & Macros - 6 Replies
As most of us know there are some errors with Vista and EO's play.exe and autopatch.exe Ive edited my own shortcut (recently got Vista) so it works a lot better. Jusrt replace this shortcut with your old one IF you have Vista. give thx if you like xD or give thx for the effort xDxD
COOL SHORTCUT
09/22/2008 - Zero - 8 Replies
hey im new to zero, only playing for a couple of weeks and im not sure if everyone already knows this... but here it goes to make all robots dissapear press CTRL + tab ! this is great for market and robots re-appear when u move less lag ;)



All times are GMT +1. The time now is 16:28.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.