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

Hmmm, I can't figure it out, lol


dragonlord52
 Share

Recommended Posts

Could anyone tell me why the variables I want put in the .ini file isn't getting put in there? I've made sure the NPC doesn't die when I hit it as that is what I thought the issue was at first but it didn't fix it.

> ' Executes when a player presses the CONTROL key.
> Sub OnAttack(Index, Damage)
> Dim Target
>
> If Int(Damage) > 0 Then
> If Int(GetPlayerTarget(Index)) > 0 Then
> Target = GetPlayerTarget(Index)
> map = GetPlayerMap(Index)
> x = GetNpcX(map, Target)
> y = GetNpcY(map, Target)
> Call DamagePlayer(Index, Target, Damage)
> Call SpellAnim(1, map, x, y)
> Else
> Target = GetPlayerTargetNPC(Index)
> map = GetPlayerMap(Index)
> x = GetNpcX(map, Target)
> y = GetNpcY(map, Target)
> level = GetPlayerLevel(Index)
> points = GetPlayerPOINTS(Index)
> Call DamageNPC(Index, Target, Damage)
> Call SpellAnim(1, map, x, y)
> Call WeaponSkill(Index)
> Call PutVar("scripts\characters\" & GetPlayerName(Index) & ".ini", "TEMP", "level", "" & level & "")
> Call PutVar("scripts\characters\" & GetPlayerName(Index) & ".ini", "TEMP", "points", "" & points & "")
> End If
> End If
> End Sub

Thanks, the help is much appreciated!
Link to comment
Share on other sites

I don't really see why there'd be a problem, unless the folder "characters" does not exist inside the folder "scripts"… If it doesn't, add it and try again.
If it does, though, try changing:

> "" & level & ""

to

> level

Same goes for points. 

If that doesn't work, just try messing around with it for a while.  I've noticed that the variable never seems to be the right type you want it to be when you're working with PutVar…
Link to comment
Share on other sites

@DarkMazer:

> I don't really see why there'd be a problem, unless the folder "characters" does not exist inside the folder "scripts"… If it doesn't, add it and try again.
> If it does, though, try changing:to Same goes for points. 
>
> If that doesn't work, just try messing around with it for a while.  I've noticed that the variable never seems to be the right type you want it to be when you're working with PutVar...

OMG I'm such a n00b sometimes xD that folder is suppose to be charextras xD

And yes, Call WeaponSkill is a script in progress that I have created.

EDIT: I have edited the script with your suggestions and still nothing happens
Link to comment
Share on other sites

Another thing:
You didn't declare x, y, map, level, points
Try this:
```
' Executes when a player presses the CONTROL key.
Sub OnAttack(Index, Damage)
  Dim Target
  Dim x
  Dim y
  Dim map
  Dim level
  Dim points

  If Int(Damage) > 0 Then
      If Int(GetPlayerTarget(Index)) > 0 Then
        Target = GetPlayerTarget(Index)
        map = GetPlayerMap(Index)
        x = GetNpcX(map, Target)
        y = GetNpcY(map, Target)
        Call DamagePlayer(Index, Target, Damage)
        Call SpellAnim(1, map, x, y)
      Else
        Target = GetPlayerTargetNPC(Index)
        map = GetPlayerMap(Index)
        x = GetNpcX(map, Target)
        y = GetNpcY(map, Target)
        level = GetPlayerLevel(Index)
        points = GetPlayerPOINTS(Index)
        Call DamageNPC(Index, Target, Damage)
        Call SpellAnim(1, map, x, y)
        Call WeaponSkill(Index)
        Call PutVar("scripts\characters\" & GetPlayerName(Index) & ".ini", "TEMP", "level", "" & level & "")
        Call PutVar("scripts\characters\" & GetPlayerName(Index) & ".ini", "TEMP", "points", "" & points & "")
      End If
  End If
End Sub
```
Link to comment
Share on other sites

Everything in there works fine without the decelerations just so you know. Since I don't use any of those variables in the PutVar commands they shouldn't effect it all.

I still don't see the use of dim when you don't always have to have to make things work as every working script I've made (none of them but the skill script are on here) work without it.
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...