Print Page | Close Window

Random Damage

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=206
Printed Date: 20 December 2006 at 5:53pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Random Damage
Posted By: Sync
Subject: Random Damage
Date Posted: 11 February 2006 at 3:30pm
Ah, I'll go ahead and write a tut for this. It isn't too hard, I already have it in my game. Just gimme a couple of hours to make it noob-friendly.

Wait.. Random damage? Easy.


Dificulty: 1/5

Find Function GetPlayerDamage

Add this somewhere in there. I would advise putting it after


GetPlayerDamage = Int(GetPlayerSTR(Index) / 2)


Here's the code:

GetPlayerDamage = GetPlayerDamage + Int(Rnd * 6) - 3


Someone has beaten me to it but it isn't so hard. This isn't my code also... But, what the code does is takes the STR of the player divided by two then Damage is equal to + 3 or - 3 of that number. Nifty, eh? If you wanna change that you can make it +2 or -2 or whatever you want. Just change it to

GetPlayerDamage = GetPlayerDamage + Int(Rnd * <time two of what you want damage to be) - <+ or - what you want damage to be>


For example, if I wanted it +5 or -5 of the damage it would be

GetPlayerDamage = GetPlayerDamage + Int(Rnd * 10) - 5


What the code does is make it so that you hit anywhere between -5 orig STR / 2 or +5 of orig STR / 2. If my str was 10 the code makes it so that i can hit 1,2,3,4,5,6,7,8,9 or 10.(1 being the lowest since it cant go below 0 unless you make it that way) This is a much easier way, I think. And if you want it for NPCs.. You'll have to find that out on your own.

[edit] I forgot to mention. That's all server-side.

--------Edit--------
I'm feeling somewhat nice so I'll put up how to make it for NPCs.

Look for this:

Damage = Npc(NpcNum).STR - GetPlayerProtection(Target)


And add under that

Damage = Damage + Int(Rnd * 6) - 3


That's pretty much it, NPCs will be able to hit +3 or -3 unless you change that line of code. Oh and yeah, that's also server side.



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