Print Page | Close Window

Give item directly to player

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=21
Printed Date: 20 December 2006 at 6:00pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Give item directly to player
Posted By: Sync
Subject: Give item directly to player
Date Posted: 07 February 2006 at 4:56pm
Originally Posted By Baltan

This was requested in tut request, and its simple  :wink:

Tut By:
Dark Dragon ((me))

[Server Side]

Open ModGameDatabase

Goto Sub AttackNPC

change:
        ' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1
        If n = 1 Then
             Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
        End If


to:
        ' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1
        If n = 1 Then
             'Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
             Call GiveItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue)
        End If


if i missed anything please correct me



Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 4:59pm
Approved



Posted By: Da Undead
Date Posted: 05 March 2006 at 1:01pm

In..

        ' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1
        If n = 1 Then
             'Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
             Call GiveItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue)
        End If

Is the ' suppose to be there, before Call SpawnItem(Npc(NpcNum).DropItem,etc...??? 



Posted By: funkynut
Date Posted: 05 March 2006 at 1:08pm
Yes, thats the old code


Posted By: tosuxo
Date Posted: 05 March 2006 at 1:16pm
e.g. if you wanted to revert back to the old way, then you can just put the ' infront of the new code

perhaps players could have an option to send it to their inventory, or otherwise, and then it would make things more interesting


Posted By: Branar
Date Posted: 21 March 2006 at 7:10am

Shouldn't you check to see if the inventory is full first?



Posted By: Sonire
Date Posted: 21 March 2006 at 7:59am
I could be wrong (I don't have any code to double check at the moment) but I believe funcntion giveitem checks to see if the inventory is full.

-------------
I grant permission for anyone to alter a tutorial previously posted by me for use in a tutorial submission for MSE, so long as "Originally Coded By Sonire" is credited at the top of the tutorial.



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info