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

[EO] Item equipped spell


Drakiac
 Share

Recommended Posts

This edit to the server will require an item equipped in order for you to cast a spell

These are all server side edits.
Find:
```
    ' Prevent subscript out of range
    If spellslot <= 0 Or spellslot > MAX_PLAYER_SPELLS Then Exit Sub

    spellnum = GetPlayerSpell(index, spellslot)
    mapNum = GetPlayerMap(index)
```
and under it put:
```
    ' Make sure player has item equipped
    If GetPlayerEquipment(index, Weapon) <> 1 Then
        Call PlayerMsg(index, "You need your _____ equipped!", BrightRed)
        Exit Sub
    End If
```
If the item equipped is not a weapon change it to whatever the item is.
ex.    If GetPlayerEquipment(index, Helmet) <> 1 Then

The number of the item is what you put after <>. So in this code the item required to cast the spell is item number 1.

I hope this helps some people!
-Drakiac
Link to comment
Share on other sites

That won't work.

This would be a better approach or…

> ' Make sure player has item equipped
>     If GetPlayerEquipment(index, Weapon) = 0 Then
>         Call PlayerMsg(index, "You need a weapon equipped to cast a spell!", BrightRed)
>         Exit Sub
>     End If

Select Case, don't do it like that.
Link to comment
Share on other sites

Um.. using your approach if they do have the weapon equipped then they can't cast the spell. The point of my script is so that if they do have a weapon equipped it will allow them to cast a spell. Also, I've tried it out and it does work… thanks for the constructive criticism though :)
-Drakiac
Link to comment
Share on other sites

Oh! I thought you were telling me to use this:
```
    ' Make sure player has item equipped
    If GetPlayerEquipment(index, Weapon) = 0 Then
        Call PlayerMsg(index, "You need a weapon equipped to cast a spell!", BrightRed)
        Exit Sub
    End If
```
I was going to say: I would have to do this for every item except for the one I want…. That would be a lot of wasted code.
-Drakiac
Link to comment
Share on other sites

@Drakiac:

> Oh!! His is if you have no weapon equipped then you can't cast a spell. mine is for If you only want one specific item, such as a wand, to be equipped for spells. we're comparing apples and oranges. :)

Select Case is like 1, 2, 3, 4 will not allow you to cast. I was giving two examples. Where you have to have a weapon equipped or use select case to use it as an array.
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...