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

"terrain stat bonus script" help needed


Nubbs
 Share

Recommended Posts

1.ok  im using EE 2.7 so basically what i want to know is

A. is this possible?
B. i need to know how "difficult" it would be
C.the right places in the script i would need to edit to make it work

2\. i want to make my game to where if a player class is on a certain map they would get a + bonus to their stats (only while on the select map)

3\. this is the only way i could think i could do this (beware im noob and this is my first attempt at writing my own scriptso this might look retarded in every aspect of it)

4.IF some of these commands done even exist lol let me know im not going to cry if you post " wow youre an idiot… my grandma can script better.. you shouldve done this like so... everyone else knows how to do it..why dont you?.. you suck " i have no hard feelings against anyone here since ya know its just the freakin internet...

Sub ScriptedTile(Index, Script)
Select Case Script
Case 0
Call GetPlayerClass(index,(class number i would want to have the bonus)
    if GetPlayerClass = (class number that would recieve bonus)

Call GetPlayerMap(index,(Mapnumber))
    if GetPlayerMap = (map number i would want the bonus to be for)
Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
Call GetPlayerSTR
Call SetPlayerSTR(index,(say + 5 )
Call GetPlayerDEF
Call SetPlayerDEF(index,(again + 5)
    End If
Call GetPlayerClass(index) = false
Call GetPlayerMap(index) = false
  Exit Sub

thanks for reading through all this mess
Link to comment
Share on other sites

here, this should be what you want, not tested, but an outline that should work

```

Case 0

dim class
dim str
dim def

    if GetPlayerClass = (class number that would recieve bonus)

    if GetPlayerMap = (map number i would want the bonus to be for)
          Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
          str = GetPlayerSTR
          Call SetPlayerSTR(index,(str + 5 )
          def= GetPlayerDEF
          Call SetPlayerDEF(index,(def + 5)
    End If
End if
Exit Sub

```
again, that is just an outline, i just cleaned up your code a bit…

im not sure what you mean by

Call GetPlayerClass(index) = false
Call GetPlayerMap(index) = false

what are you trying to do there?
Link to comment
Share on other sites

didn't understand it at first but i get it now) Riney  thank you every little bit helps

@[VB:

> Warconn link=topic=39203.msg380947#msg380947 date=1235331465]
>
> im not sure what you mean by
>
> Call GetPlayerClass(index) = false
> Call GetPlayerMap(index) = false
>
> what are you trying to do there?

ok what that was supposed to be is .. basically i thought i needed these or something like this to end the sub if the player was not on a map( or the right class) that they would recieve the bonus ..

if your still confused about what i mean ill find a better way to explain it (sorry very very busy day at work today)

thanks for cleaning up the mess i was so loopy yesterday (i didnt think to make it in the editor and then copy/paste… im going to test that out to see if it works and then let you know and go from there... again thank you for helping me with this... i only got a "6" on the nerd script test (43% scored higher than me and 41% scored lower) though i think with it being a multiple choice test i might've  got lucky on  2 questions... lol
Link to comment
Share on other sites

@Nubbs:

> didn't understand it at first but i get it now) Riney  thank you every little bit helps
>
> ok what that was supposed to be is .. basically i thought i needed these or something like this to end the sub if the player was not on a map( or the right class) that they would recieve the bonus ..
>
> if your still confused about what i mean ill find a better way to explain it (sorry very very busy day at work today)
>
> thanks for cleaning up the mess i was so loopy yesterday (i didnt think to make it in the editor and then copy/paste… im going to test that out to see if it works and then let you know and go from there... again thank you for helping me with this... i only got a "6" on the nerd script test (43% scored higher than me and 41% scored lower) though i think with it being a multiple choice test i might've  got lucky on  2 questions... lol

yea, no problem

you would want to use an "else" there for people who do not have the class requirments, like

```
else

call playermsg(index, "You enter a house, but do not feel at home.", RED)

```
i think thats what you want lol?
Link to comment
Share on other sites

no,Warconn sorry lol i think you get what i mean but i dont want to Call PlayerMsg i just want it not to work if the player class isnt the one receiving the bonus…thanks again

@Xeross:

> Then make a check if OldMap is map that you want and decrease the stat, or something similiar

o0oh thanks for that idea :).. so would i need to make a check if i just want the stats to stay the same (when not on a map that the class would receive a bonus on)? obviously im not sure if i do or dont  but my intuition tells me that i dont… thanks for the help hopefully when i get this working i can post it in the database..(with credits including all here who have helped me) :cheesy:
Link to comment
Share on other sites

Sub OnMapLoad(Index, OldMap, NewMap) so if i use this

A. do i need a case #?

B. if the answer "A" is yes then my question is answered before i ask it

C. if the answer to "A" is no then… Would i need to add GetVar, PutVar commands and make an .ini file to make this work differently for say 4 classes( just an example making the animals=classes and the "terrain type"=map number)  frog's get bonus in a swamp map, polar bears get a bonus on a snow map...
Link to comment
Share on other sites

you could use Case code or If code whatever you like.

From the back of my head.
```
if NewMap = MAPNUM then
  Call SetPlayerSTR(GetPlayerSTR(index) + 5)
end if

if OldMap = MAPNUM then
  Call SetPlayerSTR(GetPlayerSTR(index) - 5)
end if

```This is all from the back of my head dunno if it works, last time i used ss is half a year ago or more.
Link to comment
Share on other sites

```
Sub OnMapLoad(Index, OldMap, NewMap)

Case 0

dim class
dim str
dim def

    if GetPlayerClass = (class number that would recieve bonus)

    if GetPlayerMap = (map number i would want the bonus to be for)

          Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
            str = GetPlayerSTR
          Call SetPlayerSTR(index,(str + 5)
            def= GetPlayerDEF
          Call SetPlayerDEF(index,(def + 5)
    ElseIf

      GetPlayerClass = (class number that would recieve bonus)

      GetPlayerMap = (map number i would want the bonus to be for)

          Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
            str = GetPlayerSTR
          Call SetPlayerSTR(index,(str + 5)
            def= GetPlayerDEF
          Call SetPlayerDEF(index,(def + 5)
    ElseIf

      GetPlayerClass = (class number that would recieve bonus)

      GetPlayerMap = (map number i would want the bonus to be for)

          Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
            str = GetPlayerSTR
          Call SetPlayerSTR(index,(str + 5)
            def= GetPlayerDEF
          Call SetPlayerDEF(index,(def + 5)
    ElseIf

      GetPlayerClass = (class number that would recieve bonus)

      GetPlayerMap = (map number i would want the bonus to be for)

          Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
            str = GetPlayerSTR
          Call SetPlayerSTR(index,(str + 5)
            def= GetPlayerDEF
          Call SetPlayerDEF(index,(def + 5)
    else

End If
End if
Exit Sub 
```
i havent tested it but i figured id post it and see if someone finds something wrong with it before i do test it.. im pretty confident this will work .. :D i wanted to make this work for 4 different classes …1 map per class...

*EDIT /fail    >.<
Link to comment
Share on other sites

I'll fix up errors for you.

Done!

```
Sub OnMapLoad(Index, OldMap, NewMap)
Dim class
Dim Str
Dim Def

If GetPlayerClass = 0 Then ' Class
If GetPlayerMap = 0 Then ' Map
Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
Str = GetPlayerSTR(index)
Call SetPlayerSTR(index, (Str + 5)
Def = GetPlayerDEF(index)
Call SetPlayerDEF(index, (Def + 5)
End If
Else If GetPlayerClass = 0 Then ' Class
If GetPlayerMap = 0 Then ' Map
Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
Str = GetPlayerSTR(index)
Call SetPlayerSTR(index, (Str + 5)
Def = GetPlayerDEF(index)
Call SetPlayerDEF(index, (Def + 5)
End If
Else If GetPlayerClass = 0 Then ' Class
If GetPlayerMap = 0 Then ' Map
Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
Str = GetPlayerSTR(index)
Call SetPlayerSTR(index, (Str + 5)
Def = GetPlayerDEF(index)
Call SetPlayerDEF(index, (Def + 5)
End If
Else If GetPlayerClass = 0 Then ' Class
If GetPlayerMap = 0 Then ' Map
Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
Str = GetPlayerSTR(index)
Call SetPlayerSTR(index, (Str + 5)
Def = GetPlayerDEF(index)
Call SetPlayerDEF(index, (Def + 5)
End If
Else If GetPlayerClass = 0 Then ' Class
If GetPlayerMap = 0 Then ' Map
Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
Str = GetPlayerSTR(index)
Call SetPlayerSTR(index, (Str + 5)
Def = GetPlayerDEF(index)
Call SetPlayerDEF(index, (Def + 5)
End If
End If
End Sub
```
Link to comment
Share on other sites

@Nubbs:

> ```
> Sub OnMapLoad(Index, OldMap, NewMap)
>
> Case 0
>
> dim class
> dim str
> dim def
>
>      if GetPlayerClass = (class number that would recieve bonus)
>             
>      if GetPlayerMap = (map number i would want the bonus to be for)
>
>            Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
>             str = GetPlayerSTR
>            Call SetPlayerSTR(index,(str + 5)
>             def= GetPlayerDEF
>            Call SetPlayerDEF(index,(def + 5)
>     ElseIf
>
>       GetPlayerClass = (class number that would recieve bonus)
>             
>       GetPlayerMap = (map number i would want the bonus to be for)
>
>            Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
>             str = GetPlayerSTR
>            Call SetPlayerSTR(index,(str + 5)
>             def= GetPlayerDEF
>            Call SetPlayerDEF(index,(def + 5)
>     ElseIf
>
>       GetPlayerClass = (class number that would recieve bonus)
>             
>       GetPlayerMap = (map number i would want the bonus to be for)
>
>            Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
>             str = GetPlayerSTR
>            Call SetPlayerSTR(index,(str + 5)
>             def= GetPlayerDEF
>            Call SetPlayerDEF(index,(def + 5)
>     ElseIf
>
>       GetPlayerClass = (class number that would recieve bonus)
>             
>       GetPlayerMap = (map number i would want the bonus to be for)
>
>            Call PlayerMsg(Index, "Ahhh.. feels like.home.", WHITE)
>             str = GetPlayerSTR
>            Call SetPlayerSTR(index,(str + 5)
>             def= GetPlayerDEF
>            Call SetPlayerDEF(index,(def + 5)
>     else
>
> End If
> End if
> Exit Sub 
> ```
> i havent tested it but i figured id post it and see if someone finds something wrong with it before i do test it.. im pretty confident this will work .. :D i wanted to make this work for 4 different classes …1 map per class...
>
> *EDIT /fail     >.<

If you're going to use a case you have to make sure Select Case Something is there
Link to comment
Share on other sites

```
' Executes each time a player changes map.
Sub OnMapLoad(Index, OldMap, NewMap)
Dim Str
Dim Def
' Give Stats
If GetPlayerClass(index) = 0 Then ' Class
  If GetPlayerMap(index) = 1 Then ' Map
      Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str + 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def + 5))
      Call SendPlayerData(index)
    End If
End If
' Take stats when not on map
If GetPlayerClass(index) = 0 Then ' Class
  If Not GetPlayerMap(index) = 1 Then ' Map
      Call PlayerMsg(Index, "Ahhh.. feels like home.", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str - 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def - 5))
      Call SendPlayerData(index)
    End If
End If
End Sub
```
Fixed more errors. I works now.
Link to comment
Share on other sites

To take stats on certin maps:
```
' Executes each time a player changes map.
Sub OnMapLoad(Index, OldMap, NewMap)
Dim Str
Dim Def
' Give Stats
If GetPlayerClass(index) = 0 Then ' Class
  If GetPlayerMap(index) = 1 Then ' Map
      Call PlayerMsg(Index, "I feel weaker here...", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str - 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def - 5))
      Call SendPlayerData(index)
    End If
End If
' Take stats when not on map
If GetPlayerClass(index) = 0 Then ' Class
  If Not GetPlayerMap(index) = 1 Then ' Map
      Call PlayerMsg(Index, "I feel stronger here...", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str + 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def + 5))
      Call SendPlayerData(index)
    End If
End If
End Sub
```
To give stats on certin maps:
```
' Executes each time a player changes map.
Sub OnMapLoad(Index, OldMap, NewMap)
Dim Str
Dim Def
' Give Stats
If GetPlayerClass(index) = 0 Then ' Class
  If GetPlayerMap(index) = 1 Then ' Map
      Call PlayerMsg(Index, "I feel stronger here...", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str + 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def + 5))
      Call SendPlayerData(index)
    End If
End If
' Take stats when not on map
If GetPlayerClass(index) = 0 Then ' Class
  If Not GetPlayerMap(index) = 1 Then ' Map
      Call PlayerMsg(Index, "I feel weakerhere...", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str - 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def - 5))
      Call SendPlayerData(index)
    End If
End If
End Sub
```
Link to comment
Share on other sites

Oh i see the error.

Fixed:
```
' Executes each time a player changes map.
Sub OnMapLoad(Index, OldMap, NewMap)
Dim Str
Dim Def
' Give Stats
If GetPlayerMap(index) = 1 And GetVar("StatsUp.ini", GetPlayerName(index),"StatsUp") = 0 Then ' Map
If GetPlayerClass(index) = 0 Then ' Class
      Call PlayerMsg(Index, "I feel stronger here...", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str + 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def + 5))
      Call SendPlayerData(index)
      Call PutVar("StatsUp.ini", GetPlayerName(index),"StatsUp", 1)
    End If
End If
' Take stats when not on map
If Not GetPlayerMap(index) = 1 Then ' Map
If GetPlayerClass(index) = 0 Then ' Class
      Call PlayerMsg(Index, "I feel weaker here...", WHITE)
      Str = GetPlayerSTR(index)
      Call SetPlayerSTR(index, (Str - 5))
      Def = GetPlayerDEF(index)
      Call SetPlayerDEF(index, (Def - 5))
      Call SendPlayerData(index)
      Call PutVar("StatsUp.ini", GetPlayerName(index),"StatsUp", 0)
    End If
End If
End Sub
```
Link to comment
Share on other sites

so i need to make an .ini file named "StatsUp" that looks like this

> [StatsUp]
>
> Statsup=(what do i put here?)
>
> and what exactly is that number used for/representing? (i dont understand it completely)

GetVar("StatsUp.ini", GetPlayerName(index),"StatsUp")

shouldn't it be

GetVar("StatsUp.ini", & GetPlayerName(index),"StatsUp")?
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...