09-08-2007, 02:56 AM
Well, basically, when you hit attack (whatever button that may be for you.) on a shopkeeper, it'll queue up the shop that has the same name as the NPC.
Difficulty: Cut and Paste + For the love of all that is unholy, Understand.
First off, find: Function CanAttackNpc
Now there's a case with the four directions.
Each one contains this code:
Simple enough, it finds out what the NPC's behavior is, and acts accordingly.
Now, change it to this:
Don't forget to Dim I.
Basically, if the NPC is a shopkeeper, it runs through every shop in the I loop, and checks each shop's name to the NPC's name. If it matches, it calls the shop. Simple enough eh?
So.. do that for all four directions. you might also want to remove the ability to call shops with /trade, and if you'd like, even remove the map's shop attribute, since you don't need it.
Again, it's just something simple I added a long time ago, and I figure most people here have as well, but this should help some of the newbies, right?
EDIT: almost forgot, you need to make sure the shop index is loaded when you have trade requests, or it'll call up the shop on the map. I'll post how later, but it's not that hard.. so you can always do it yourself.
Difficulty: Cut and Paste + For the love of all that is unholy, Understand.
First off, find: Function CanAttackNpc
Now there's a case with the four directions.
Each one contains this code:
Code:
If Npc(NpcNum).Behavior NPC_BEHAVIOR_FRIENDLY And Npc(NpcNum).Behavior NPC_BEHAVIOR_SHOPKEEPER Then
CanAttackNpc = True
Else
Call PlayerMsg(Attacker, "You cannot attack a " & Trim(Npc(NpcNum).Name) & "!", BrightBlue)
End If
Simple enough, it finds out what the NPC's behavior is, and acts accordingly.
Now, change it to this:
Code:
If Npc(NpcNum).Behavior NPC_BEHAVIOR_FRIENDLY And Npc(NpcNum).Behavior NPC_BEHAVIOR_SHOPKEEPER Then
CanAttackNpc = True
Else
If Npc(NpcNum).Behavior = NPC_BEHAVIOR_SHOPKEEPER Then
For i = 1 To MAX_SHOPS
If Trim(Shop(i).Name) = Trim(Npc(NpcNum).Name) Then
Call SendTrade(Attacker, i)
End If
Next i
Else
Call PlayerMsg(Attacker, "You cannot attack a " & Trim(Npc(NpcNum).Name) & "!", BrightBlue)
End If
End If
Don't forget to Dim I.
Basically, if the NPC is a shopkeeper, it runs through every shop in the I loop, and checks each shop's name to the NPC's name. If it matches, it calls the shop. Simple enough eh?
So.. do that for all four directions. you might also want to remove the ability to call shops with /trade, and if you'd like, even remove the map's shop attribute, since you don't need it.
Again, it's just something simple I added a long time ago, and I figure most people here have as well, but this should help some of the newbies, right?
EDIT: almost forgot, you need to make sure the shop index is loaded when you have trade requests, or it'll call up the shop on the map. I'll post how later, but it's not that hard.. so you can always do it yourself.