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

EO script question


wawahoe123
 Share

Recommended Posts

Could anybody please give me codes, or a tutorial with all the basic codes for EO 2.0?

(With basic codes I mean like code to + hp and mp, code to change player sprite, code to give and take item from player and to check if it has it and all such things)
Link to comment
Share on other sites

@Sheldon:

> Since EO doesn't have a scripting engine you'll need to edit via the source code which needs a copy of VB6.
>
> Here's a tut for downloading it
> http://www.touchofdeathforums.com/smf/index.php/topic,68399.msg749075.html#new

Yeah, i know, I'm not stupid. But I just got a scripted npc script thingy working so now i can script NPC's. I still can use codes for it like to add hp and take items etc. But i don't know the code to do things like that. So now I'm asking if anybody could post 'em here.
Link to comment
Share on other sites

```
call setplayervital(index,HP,getplayervital(index,HP) + 10)
```
Index is the player slot in the server, hp can be switched out with MP then the value would be the current player's hp value (again HP can be swapped with MP) and then the + 10 would add the amount to the players current vital (hp or mp)
Link to comment
Share on other sites

@jcsnider:

> ```
> call setplayervital(index,HP,getplayervital(index,HP) + 10)
> ```
> Index is the player slot in the server, hp can be switched out with MP then the value would be the current player's hp value (again HP can be swapped with MP) and then the + 10 would add the amount to the players current vital (hp or mp)

Ty, but it says index is not declared…
Link to comment
Share on other sites

The index is not declared because there's no parameter to the sub-routine or function that you're using.

Here's an example sub-routine which changes both the player's HP and MP. Notice how it has a parameter.

```
Public Sub Example(ByVal Index As Long)
' Sets the players current HP to the players max HP (server-side).
Call SetPlayerVital(Index, Vitals.HP, GetPlayerMaxVital(Index, Vitals.HP))

' Inform the client about this change.
Call SendVital(Index, Vitals.HP)

' Sets the players current MP to the players max MP (server-side).
Call SetPlayerVital(Index, Vitals.MP, GetPlayerMaxVital(Index, Vitals.MP))

' Inform the client about this change.
Call SendVital(Index, Vitals.MP)
End Sub

```
Link to comment
Share on other sites

Well, atm this is the code im using

```
                                Case 1
                                    If HasItem(index, 2) Then
                                    Call PlayerMsg(attacker, "Thanks for bringing it!", White)
                                    Call TakeInvItem(index, 2, 1, True)
                                    Call GiveInvItem(index, 1, 1, True)
                                Else
                                    Call PlayerMsg(attacker, "Come back when you have it...", White)
                                        End If
                                    Exit Function
```The hasitem code is supposed to check if the player has the item. If it has it, it will take it. But now, why does it say index is not declared? What did i do wrong?
Link to comment
Share on other sites

@Wawahoe:

> Well, atm this is the code im using
>
> ```
>                                 Case 1
>                                     If HasItem(index, 2) Then
>                                     Call PlayerMsg(attacker, "Thanks for bringing it!", White)
>                                     Call TakeInvItem(index, 2, 1, True)
>                                     Call GiveInvItem(index, 1, 1, True)
>                                 Else
>                                     Call PlayerMsg(attacker, "Come back when you have it...", White)
>                                         End If
>                                     Exit Function
> ```The hasitem code is supposed to check if the player has the item. If it has it, it will take it. But now, why does it say index is not declared? What did i do wrong?

In this part of the code, index is attacker.

Index can be seen as current player and, in this instance, index is passed as attacker.

EDIT: SUPER SIMPLE VERSION
attacker == player. The player is the attacker, the attacker is the player. They are one in the same.
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...