peekay Posted October 27, 2008 Author Share Posted October 27, 2008 Hey there well i got a script for randomizing player damage to npc's but now i need to know how to randomise the damage that npcs do to playersthis is the player damage to npc script im usingQuote ' Executes when a player presses the CONTROL key. Sub OnAttack(Index, Damage) Dim Target Dim DmgRange DmgRange = Rand(Int(Damage) - 3, Int(Damage) + 3) If Int(Damage) > 0 Then If Int(GetPlayerTarget(Index)) > 0 Then Target = GetPlayerTarget(Index) Call DamagePlayer(Index, Target, DmgRange) Else Target = GetPlayerTargetNPC(Index) Call DamageNPC(Index, Target, DmgRange) End If End If End SubIf anyone can give me a script to randomize damage done to a player ill be thankful Link to comment Share on other sites More sharing options...
shadowwulf Posted October 27, 2008 Share Posted October 27, 2008 that should do both already``` ' Executes when a player presses the CONTROL key. Sub OnAttack(Index, Damage) Dim Target Dim DmgRange DmgRange = Rand(Int(Damage) - 3, Int(Damage) + 3) 'here we make some random damage no matter what If Int(Damage) > 0 Then 'if damage is 1 or more continue If Int(GetPlayerTarget(Index)) > 0 Then 'if target is player continue Target = GetPlayerTarget(Index) 'make Target point to target player Call DamagePlayer(Index, Target, DmgRange) 'damage target player Else 'we already know the target is an npc Target = GetPlayerTargetNPC(Index) 'target is now the target npc Call DamageNPC(Index, Target, DmgRange) 'damage the npc End If End If End Sub```see? Link to comment Share on other sites More sharing options...
DarkMazer Posted October 27, 2008 Share Posted October 27, 2008 peekay, I think you want to add these lines:```Dim DmgRangeDmgRange = Rand(Int(Damage) - 3, Int(Damage) + 3)```to Sub PlayerHit, so that it'll look like this:```Sub PlayerHit(Index, NPCNum, Damage) Dim DmgRange DmgRange = Rand(Int(Damage) - 3, Int(Damage) + 3) If Damage > 0 Then Call NPCAttack(NPCNum, Index, DmgRange) End IfEnd Sub```Also, be sure to add the same lines to Sub OnArrowHit, so ranged attack damage is randomized, too. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 27, 2008 Share Posted October 27, 2008 oh my bad. i swore i read that you you wanted it to damage players as well as npcsits only one little edit if you sourced it. Link to comment Share on other sites More sharing options...
peekay Posted October 28, 2008 Author Share Posted October 28, 2008 Thanks dark mazer Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now