Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

EO Quest/Item/Tile Source Systems


Richy420Rich
 Share

Recommended Posts

Source Quest System Tutorial

This 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 CanPlayerAttackNpc

You'll need to change this code from.
If Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And Npc(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then

To 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 Then
CanPlayerAttackNpc = False
Call QuestScript(attacker, Int(npcNum))
Exit Function
End If
```
Server Side  (modTypes)

Under >>> ' public data structures
Place this on the bottom;

```
Public Quest(1 To MAX_PLAYERS) As PlayerRec

```
After >>> Public Type HotbarRec
    Slot As Long
    sType As Byte
End Type

Place this;

```
Public Type QuestRec
NPCQuestProgress As Long
End 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 Script

Case 1
If Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 2 Then
Call PlayerMsg(attacker, "Angel: Nice job getting the weird potion!", Green)
ElseIf Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 1 Then
If HasItem(attacker, 3) Then
Call 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 = 2
Else
Call 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 If
ElseIf Player(attacker).NPCQuest(Int(Script)).NPCQuestProgress = 0 Then
Call 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 = 1
End If
Exit Sub

Case 2
Exit Sub

Case 3
Exit Sub

Case 4
Exit Sub

Case 5
Exit Sub

Case Else
Call PlayerMsg(attacker, "There is no quest script for NPC Number " & Int(Script) & ". Check the source..", BrightRed)
Exit Sub

End Select
End Sub
```
Client Side (modTypes)

Above PlayerRec Place this;

```
Public Type QuestRec
NPCQuestProgress As Long
End 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 System

Basically 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 lol

Anyways, drop this code inside the new module or where ever you deem fit.

```
Public Sub ItemScript(index, Script)
Dim RandTalk

RandTalk = RAND(1, 8)
Select Case Script

Case 1
' Item number 1 will run this script if item type is selected as Scripted
If Int(RandTalk) = 2 Then
Call PlayerMsg(index, "I wonder what I can do with this gold man!", White)
ElseIf Int(RandTalk) = 3 Then
Call PlayerMsg(index, "I should have left Item1 as currency haha, now I can't spend the gold!", White)
ElseIf Int(RandTalk) = 4 Then
Call PlayerMsg(index, "Wonder why an Angel is here.", White)
ElseIf Int(RandTalk) = 5 Then
Call PlayerMsg(index, "Oh well, just too bored now.", White)
ElseIf Int(RandTalk) = 6 Then
Call PlayerMsg(index, "This explaination should be good enough.", White)
ElseIf Int(RandTalk) = 7 Then
Call PlayerMsg(index, "Someone just stole my Gold!", BrightRed)
Call TakeInvItem(index, 1, 200)
Else
Call PlayerMsg(index, "They see me rollin'. They hatin'. Oh wait, nevermind.", White)
End If
Exit Sub

Case 2
'Item Num 2
Exit Sub

Case 3
'Item Num 3
Exit Sub

Case 4
'Item Num 4
Exit Sub

Case 5
'Item Num 5
Exit Sub

Case Else
Call PlayerMsg(index, "There is no item script for Item Number " & Int(Script) & ". Check the source.", BrightRed)
Exit Sub

End Select
End 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 System

Client 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) - PlayerMove

Above this code;

    ' They tried to hack
    If Moved = NO Then
        Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index))
    End If

Add 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 Script

Case 1
' Select the Scripted Tile to whichever script you want ran here.
Call PlayerMsg(index, "You stepped on a scripted tile!", Red)
Exit Sub

Case Else
Call PlayerMsg(index, "There is no tile script for this Tile, Script Number " & Int(Script) & ". Check the source.", BrightRed)
Exit Sub

End Select
End Sub

```
Client Side (modText) - BltMapAttributes

Under >>> 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) - MapEditorMouseDown

Under >>> ' slide
                If frmEditor_Map.optSlide.Value Then
                    .Type = TILE_TYPE_SLIDE
                    .Data1 = MapEditorSlideDir
                    .Data2 = 0
                    .Data3 = 0
                End If

Add 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 Long
Place 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 optScript
Need to add a frame on the right hand side where the other frames are, name it fraScript
In 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 1
Name the command button cmdScript and Caption it as Okay

Click 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 Sub
errorhandler:
    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 Sub
errorhandler:
    HandleError "cmdScript_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End 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

  • Replies 78
  • Created
  • Last Reply

Top Posters In This Topic

@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 :D

Define the "TileScript", and check where do you paste the "If .type…. "
Link to comment
Share on other sites

@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. :P

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.
Link to comment
Share on other sites

@iSkweek:

> Where would I define it? Sorry I am slightly noobish :P

Client Side (modGameEditors) - MapEditorMouseDown

Under >>> ' slide
                If frmEditor_Map.optSlide.Value Then
                    .Type = TILE_TYPE_SLIDE
                    .Data1 = MapEditorSlideDir
                    .Data2 = 0
                    .Data3 = 0
                End If

Add 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

@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

@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

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

lol, I did it almost exactly the same last night xd

works 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

questrec, im noob too, but i would do something like, adding a quest in playerrec.

like:

```
IN playerrec

Quest(1 to 250) as Questrec

```
and then in questrec, have certain entries, for example…

```
Type QuestRec
QuestNr as Long
NpcNr as long
Rewarditem1 as long
NeedItem1 as Long
end Type

```
just a example i put down out of my head xd

Dami
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...