Is there a way to make an object call a mob proc on usr? basically what I want to do, is make objects which are clickable which call a spell proc. But it wont let me call the proc(Gives me bad proc) because its an object, and the spell is a mob proc. Is there a way around this?
Thanks,
Alathon
ID:150584
Aug 25 2001, 11:46 am
|
|
Aug 25 2001, 1:28 pm
|
|
Alathon wrote:
|
In response to FIREking
|
|
FIREking wrote:
Alathon wrote: > obj Still giving me a bad proc. The proc im calling is inside another file would that have anything to do with it? Alathon |
Im having trouble with a list again. The way im passing spells now (or trying to..) is scribing them into a Spellbook object. But, I cant seem to call it right, or somethings wrong. Heres the scribe command which puts an object inside Spellbook, and the part where i define spellbook.
obj Spellbook var newlist/Spells = list("") Scribe(obj/O as obj in src.contents, Spellbook in src.contents) set category = "Skills" if(O.typea != "Scroll") src << "Thats not even a scroll!" if(O.Slevel > src.Level) src << "Your too low level to even use the spell..." else Spellbook.Spells.Add(O) src.contents -= O src << "You scribe [O] into your Spell Book" Scribe is a mob proc, and the error is: Spells.dm:174:error:Spellbook.Spells.Add:bad var Thanks Alathon |
In response to Alathon
|
|
Im not certain about this, but when you examine the Spellbook.Spells, you are referencing something that may not exist. You created the list for Spells inside a var called newlist. I guess you can either remove this or make the call to the Spells list contained under Spellbook be more specific (I dunno the exact syntax, but maybe Spellbook/newlist/Spells whenever you want to add)
Of course, this may not be the problem at all, in which case, my bad Alathon wrote: Im having trouble with a list again. The way im passing spells now (or trying to..) is scribing them into a Spellbook object. But, I cant seem to call it right, or somethings wrong. Heres the scribe command which puts an object inside Spellbook, and the part where i define spellbook. |
In response to Cybergen
|
|
Actually all I need to know is how to reference to Spellbook inside usr.contents in Scribe(in here..)
Atm its Scribe(obj/O as obj in usr.contents, Spellbook in usr.contents) I know that doesnt work and I know what its saying I just dont know how to check if the user has a spellbook in that line? or do I do it later in Scribe? Im confused now :( Alathon |
In response to Alathon
|
|
Alathon wrote:
FIREking wrote: > > obj Still giving me a bad proc. The proc im calling is inside another file would that have anything to do with it? No. But if the proc you're calling is not in the top-level node of mob (defined directly under mob), then the compiler will stop you because usr could conceivably be any mob, and it doesn't know for a fact that usr will have this proc. You have two choices. One: use the : operator instead of the . Advantages: One tiny change. Disadvantages: Unless you're absolutely, positively, 100% certain that you will never, at any point in this project, have any playable mobs that don't have that proc (is this a wizards-only thing? will warriors have this proc? if all players have it, what about GMs? can they possess NPC mobs that wouldn't have this proc?), you risk getting run-time errors... which translates into bugs. Two: Declare a variable and do some type-checking. cast() if (istype(usr,/mob/player/wizard)) var/mob/player/wizard/w = usr w.fireball() else usr << "Thou artn't not, er, thou not be, er... thou be'st nary... um... you're not a wizard!" |
In response to LexyBitch
|
|
LexyBitch wrote:
Alathon wrote: > > > obj Still giving me a bad proc. The proc im calling is inside another file would that have anything to do with it? Thanks, works now :) Alathon |