Working on EarthBound Online, I wanted to add PSI Skills aka spells. I found a good lib on the hub for it, and with some minor tweeking it worked. The only trouble is, not good enough. The spells WILL be lernt when you go to said level and work just fine, whats wrong is the fact that when you log in, all your spells are gone. Here is my loadin code, spell code and spell level thingy:
LOADING CODE:
mob
proc
Load()
var/savefile/F = new("players/[src.ckey].sav")
var/mob/character
F["Name"] >> Name
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
F["Mob"] >> character
src.client.mob = character
..()
mob
Login()
if( X )
src.loc = locate( X, Y, Z )
X = 0
Y = 0
Z = 0
..()
Here is a example of the spell dection:
mob
proc
CheckLevel()
if(src.LVL == 2)
if(src.Check2 == 0)
Level_2()
src.Check2 = 1
if(src.LVL == 5)
if(src.Check5 == 0)
Level_5()
src.Check5 = 1
else
return 0
else
return 0
mob/proc/Level_2()
for(var/X in typesof(/mob/New_Skills/Level_2/verb)) //add every verb
src.verbs += X
mob/proc/Level_5()
for(var/X in typesof(/mob/New_Skills/Level_5/verb)) //add every verb
src.verbs += X
And then I have like usr.CheckLevel in the level up. I tried adding usr.CheckLevel() in the bottom of the loading program but that doesnt work. Can someone give me a hand?
ID:175261
May 17 2003, 2:16 pm
|
|
May 17 2003, 2:28 pm
|
|
Somehow you have to save the verbs and then load them...I have this same problem with my game.
|
Ok your spells should always be verbs unless magic item or somethin well nvm, you need to make a proc like this add i to the log in.
mob well that how i would do it. |
now in your save verb somewhere put this
F["verbs"] << usr.verbs then call it like F["verbs"] >> usr.verbs if that don't work do this instead make this mob/var/list/SVerbs = list() in your save verb put mob.saveverbs = mob.verbs and in your load thingy put for (var/item in mob.saveverbs) mob.verbs += item the second works for sure the first one is something I came up with dunno if it works |
In response to Koolguy900095
|
|
anoter more comlicated way i came up with when looking at your coding is this
mob/Login() Load() if(usr.level >= 10) usr:verbs += alfaPSI if(usr.level >= 20) usr:verbs += OmegaPSI etc... anyways just a thought, just wanted to know if that would help any |
In response to War_master66
|
|
umm...you can't define a proc inside of mob/Login()
|
In response to Goku72
|
|
if you have "classes" you can put in things like this >
Stat() ..() statpanel("Skills") if (Level>=15) stat(Power_Slash) this will give you access to a process that is spelllike :) |
In response to Goku72
|
|
hmmm strange ive used if procs before in my login proc, lets see, it checks what your random number is, then bases your stats on that certain number, sounds like a proc to me, not much from what i just said, oh and i have tested it, becuase it works in my login proc
|
In response to War_master66
|
|
read my post carefully, I didn't say you couldn't USE a proc in Login/Logout, I said you can't DEFINE one in it...which looks like you did to me, but who knows maybe my browser messed up the indentation =p. So, read better next time.
|