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

Whats wrong with this script?


Fruitpunch
 Share

Recommended Posts

This part goes under the NewChars sub.
```
Call PutVar("Fight.ini", "CHARS", GetPlayerName(index), 0)

```Replace the stuff in your OnAttack sub with this
```
Sub OnAttack(Index, Damage)
  Dim Target

  If Int(Damage) > 0 Then
      If Int(GetPlayerTarget(Index)) > 0 Then
        Target = GetPlayerTarget(Index)
        Call DamagePlayer(Index, Target, Damage)
        Call Buildup(Index)

      Else
        Target = GetPlayerTargetNPC(Index)
        Call DamageNPC(Index, Target, Damage)
        Call Buildup(Index)
  End If
End Sub

```This part goes at the bottom of your main.txt

```
'My Own Sub
Sub Buildup(Index)
'Part of Fruitpunch's alternative combat system

  If GetVar("Fight.ini", "CHARS", GetPlayerName(index)) < 5
  Call PutVar("Fight.ini", "CHARS", GetPlayerName(index), GetVar("Fight.ini", "CHARS", GetPlayerName(index)) + 1)

```And this last part goes under Scripted Spells
```
Case 1
      If Int(GetPlayerTarget(Index)) > 0 Then
        Target = GetPlayerTarget(Index)
        Call DamagePlayer(Index, Target, 50)
        Call Putvar("Fight.ini", "CHARS", GetPlayerName(index), 0)

      Else
        Target = GetPlayerTargetNPC(Index)
        Call DamageNPC(Index, Target, 50)
        Call Putvar("Fight.ini", "CHARS", GetPlayerName(index), 0)
      End If
      Exit Sub

```EDIT: Also you need to create an .ini named Fight. This is all you need to put in the .ini
```
[CHARS]

```
Anyone want to tell me what is wrong with it?
Link to comment
Share on other sites

still not working

here is what I have

In NewChars
```
Call PutVar("Fight.ini", "CHARS", GetPlayerName(index) & "", "0")

```In OnAttack
```
Dim Target

If Int(Damage) > 0 Then
If Int(GetPlayerTarget(Index)) > 0 Then
Target = GetPlayerTarget(Index)
Call DamagePlayer(Index, Target, Damage)
Call Buildup(Index)

Else
Target = GetPlayerTargetNPC(Index)
Call DamageNPC(Index, Target, Damage)
Call Buildup(Index)
End If
End If
End Sub

```In Scripted Spells
```
Dim Target

If Int(Damage) > 0 Then
If Int(GetPlayerTarget(Index)) > 0 Then
Target = GetPlayerTarget(Index)
Call DamagePlayer(Index, Target, 50)
Call PutVar("Fight.ini", "CHARS", GetPlayerName(index) & "", "0")

Else
Target = GetPlayerTargetNPC(Index)
Call DamageNPC(Index, Target, 50)
Call PutVar("Fight.ini", "CHARS", GetPlayerName(index) & "", "0")
End If
Exit Sub

```In Buildup
```
Sub Buildup(Index)
'Part of Fruitpunch's alternative combat system

If GetVar("Fight.ini", "CHARS", GetPlayerName(index)) < 5
Call PutVar("Fight.ini", "CHARS", GetPlayerName(index) & "", "GetVar("Fight.ini", "CHARS", GetPlayerName(index) & "") + 1")
Else
Call PlayerMsg(index, "You may use a finisher", 4)
End If
End Sub

```
Thanks for the help everyone I appreciate it.
Link to comment
Share on other sites

But if I do it for him, he won't learn anything. I guess I should at least be a little more specific though.

There's a syntax error in Sub Buildup, and you're gonna have to re-write your spell, cuz the way you have it, it won't do anything right now.
Link to comment
Share on other sites

let me take a guess and tell me if I am right
```
Dim Target

  If Int(Damage) > 0 Then
      If Int(GetPlayerTarget(Index)) > 0 Then
        Target = GetPlayerTarget(Index)
        Call DamagePlayer(Index, Target, Damage)

      Else
        Target = GetPlayerTargetNPC(Index)
        Call DamageNPC(Index, Target, Damage)
      End If
  End If
        Call Buildup(index)
End Sub
[code]

And then the same for the spell
[/code]
```
Link to comment
Share on other sites

taking another whiff at it. If this isn't right could you please direct me to a tutorial that will tell me what I need to do
```
Sub Buildup(Index)
'Part of Fruitpunch's alternative combat system

      If GetVar("Fight.ini", "CHARS", GetPlayerName(index)) < 5
      Call PutVar("Fight.ini", "CHARS", GetPlayerName(index) & "", "GetVar("Fight.ini", "CHARS", GetPlayerName(index) & "") + 1")
  Exit Sub
  Else
      Call PlayerMsg(index, "You may use a finisher", 4)
  End If
End Sub

```
Link to comment
Share on other sites

no, Warconn, FP has his vars right. And you can do it FP!! Just think about it! a couple notes:

1) Take a look at the first 'if' in Sub Buildup, is there something missing?
2) Make sure that if you use a function by itself in a place that requires a string (i.e. get/putvar, playermsg) you use quotes in front. f.e. :
GetVar("Fight.ini", "CHARS", "" & GetPlayerName(index))

And you're gonna need to rethink the spell still. xD
Link to comment
Share on other sites

OMFG LOL I AM RETARDED!!

```
Sub Buildup(Index)
'Part of Fruitpunch's alternative combat system

      If GetVar("Fight.ini", "CHARS", "" & GetPlayerName(index)) < 5 Then
      Call PutVar("Fight.ini", "CHARS", "" & GetPlayerName(index), GetVar("Fight.ini", "CHARS", "" & GetPlayerName(index)) + 1)
  Else
      Call PlayerMsg(index, "You may use a finisher", 4)
  End If
End Sub

```
And I will get to the spell tomorrow, right now I am addicted to Dawn of War II
Link to comment
Share on other sites

```
Case 1
      If GetPlayerTarget(index) <> 0 Then
        Call DamagePlayer(Index, GetPlayerTarget(index) & "", 50)
        Call Putvar("Fight.ini", "CHARS", GetPlayerName(index), 0)

      Elseif GetPlayerTargetNPC(index) <> 0 Then
        Call DamageNPC(Index, GetPlayerTargetNPC(index), 50)
        Call Putvar("Fight.ini", "CHARS", GetPlayerName(index), 0)
      Else
        Call PlayerMsg(index, "You need a target to use that", 4)
      End If
      Exit Sub

```
Would that work for the spell?
Link to comment
Share on other sites

no however this would…

```
Case 1
      If GetPlayerTarget(index) <> 0 Then
        Call DamagePlayer(Index, GetPlayerTarget(index) & "", 50)
        Call Putvar("Fight.ini", "CHARS", GetPlayerName(index) & "", "0")
      Else
      If GetPlayerTargetNPC(index) <> 0 Then
        Call DamageNPC(Index, GetPlayerTargetNPC(index), 50)
        Call Putvar("Fight.ini", "CHARS", GetPlayerName(index) & "", "0")
      Else
        Call PlayerMsg(index, "You need a target to use that", 4)
      End If
      End If
      Exit Sub

```
but it would only run the first If statement, it woould only go to the else if the value was not less that or more than 0\. so meh.
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...