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

Script Problems


Recommended Posts

Well guys if i write in version EE 2.71….

Call TakeItem(index,10,0)

he wont takeoff the item of my inventory or like this here

' Executes whenever a scripted NPC does an action.
Sub ScriptedNPC(Index, Script)
Select Case Script
Case 0
    If QuestItem(index, 10) Then
            Call TakeItem(index, 10, 0)
            Call GiveItem(index, 5, 0)
            Call PlayerMsg(index, "Congrats quest complete.", 4)
            end If
Exit Sub

Case Else
Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)

Exit Sub
End Select
End Sub

here the function

Sub QuestItem(index, item)
SLOT = 1
QuestItem = false
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
QuestItem= true
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub

both of this are from GodLord so credits to him :o

but now if choose on my npc script 0(for case 0)
he wont do anything if i try to complete quest with my Quest item in the inventar...

(anyway can i write Functions or anything else on my own? sub QuestItem(index,item)?)

thx for help
Link to comment
Share on other sites

Why not just use Godlord's CanTake function?

Also, you're calling TakeItem wrong, it should be: Call TakeItem(index, 10, 1)

But yea, why not just do:
      If CanTake(Index, 10, 1) Then
            Call TakeItem(index, 10, 1)
            Call GiveItem(Index, 10, 0)
            Call PlayerMsg(index, "Congrats quest complete.", 4)
      End If
      Exit Sub

Also, the item you're taking/giving, can't be stackable
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...