4Dimensions Forum
Building & Scripting => Scripting Board => Topic started by: Kvetch on October 28, 2008, 10:30:55 pm
-
I thought I'd just create this topic for people like me that are trying to figure out how to do one small thing and have no clue... so.. yeah, like me. <FIZZY!!! WHY WON'T IT WORK!>
-
Ok, I started this for a reason...
How do I... get a mob to cast spells? I understand that he needs mana, but how do I in effect GIVE him mana? And, why in gods name do I have to anyway? Shouldn't they come with mana just like players do? It's not like I'm asking him to destroy the world or anything (though knowing the way I script, that may happen anyway).
Kvetchy
-
dg_cast 'spellname' <target>
dg_cast 'acid arrow' %actor%
dg_cast 'acid arrow' %self.fighting%
-
From what I've seen dg_cast doesn't work at all, and returns a syserr when you try to use it in a script.
Probably a code issue.
-
worked in build port. *blinks innocently* Poor, poor Cati felt the wrath of that spell.
-
From what I've seen dg_cast doesn't work at all, and returns a syserr when you try to use it in a script.
Probably a code issue.
I suspect it'd because I've seen numerous times it used as:
dg_cast %actor% 'fireball'
instead of the correct syntax of
dg_cast 'fireball' %actor%
-
One of the scripts I frequently see erroring has the line
dg_cast 'heal' %self%
So should it be self instead of %self%?
Or maybe just dg_cast 'heal', since that should land the spell on self by default?
In my opinion, all three options ought to work.
-
Pic
-
Pic
Huh?
-
Pic
Huh?
http://www.kvetch.com/
-
Funny, but it doesn't answer my question. :P
-
Perhaps the definition of Kvetch would help out:
Kvetch
to complain habitually : gripe
So basically that site is people complaining about whatever they want to.
Kvetchy
-
I understand that, Kvetch, but I had an actual question, not a complaint.
-
I understand that, Kvetch, but I had an actual question, not a complaint.
Yes, it should most likely be self.
-
Yes, it should most likely be self.
Umm, no.
I tried both, and both give almost identical errors,
either:
[ Trigger: enrico receive ring, VNum 7528. dg_cast: target not found (dg_cast 'heal' %self%) ]
or
[ Trigger: enrico receive ring, VNum 7528. dg_cast: target not found (dg_cast 'heal' self) ]
Also it seems all spells using DG_cast work very erratically, and mostly not at all.
I am not so sure about DG_affect either.
I recently tried to forcibly put a player to sleep for a few minutes with a script, trying both DG_cast, DG_affect and delay. Neither worked. In the end we had to set up the script with a variable to get it work the intended way.
Plus that context still is bugged.
Is there really no one who could fix those issues? They affect a large number of quest scripts.
As it is two players cannot work on the same quest, and as far as I know context always worked fine in the past.
-
Making someone sleep or awake, or resting can be done using the position variable, whch you won't have known about.
nop %actor.pos(sleeping)%
nop %actor.pos(resting)%
nop %actor.pos(sitting)%
nop %actor.pos(standing)%
nop %actor.pos(stunned)%
nop %actor.pos(dead)%
dg_cast spells are prone to being blocked by the actors spell defenses if they are aggressive, and some spells have a low chance of success in any case, and the dg_cast mob (yes, an actual mob casts the spells), has a chance of failing the spells too.
dg_affect however always works, no chance of failing.
But I would hope you would test out what the affect is going to be.
Such as, the AFFECT sleep, causes people not to wake up.
The SPELL sleep puts them to sleep.
-
Hmm, to make sure that I've got this right:
What I want to do is to force a player to sleep and then transfer them to another room, and not being able to wake up on their own, until another script does it in the new room.
So the procedure would be to have the first script do:
dg_affect %actor% sleep
and then the second script could be a greet trigger, doing:
nop %actor.pos(sitting)%
Is that how the forced sleep - wake could work?
As for the other script, the mob is casting heal on itself. That cannot really be blocked by any defensive spells, but the script still doesn't work.
I don't suppose there is a way for a mob to heal itself with dg_affect?
Or should I do this instead?
eval heal %self.maxhitp%
%damage% %self% -%heal%
-
And it seems that using the position variable isn't the solution either as the code doesn't even recognize the field.
[ Trigger: Something, VNum xxxx. unknown char field: 'pos' ]
Is all you get when you try
nop %actor.pos(stunned)%
or
nop %actor.pos(sitting)%
in a script.
-
I believe it is %actor.position(stunned)%, not %actor.pos(stunned)%
-
Nope, doesn't work either.
Using 'position' doesn't give an error but the position of the %actor% doesn't change either.
So either way, it seems that nor %actor.position(stunned)% nor %actor.pos(stunned)% is working.
-
You are so right, my appologies.
That code was in the TBA codebase not ours.
I have added it to ours now in all 3 ports, they just need a copyover.
-
So the procedure would be to have the first script do:
dg_affect %actor% sleep
dg_affect needs :
dg_affect <target> <property> <value> <duration>
So to do SLEEP, where duration is in seconds:
dg_affect %actor% sleep on 300
To remove sleep:
dg_affect %actor% sleep off
-
So, will it be %actor.position(stunned)%, or %actor.pos(stunned) after the copyover?
And here's another question on the topic How do I???:
Is there a way to make a script set Award Points on a player?
I have an idea about adding that to the reward of a couple of the quests with an IC plot. (Especially since our RP Leaders aren't exactly active.).
-
So, will it be %actor.position(stunned)%, or %actor.pos(stunned) after the copyover?
Seems both work.
-
Ok, a new "How do I?"
How do I: make something load inside something else during particular times?
Note: zedit will let me load things inside other things, but it's there on all reboots/what not.
note: I can load containers at particular times, but what about the stuff inside the containers?
How it will be used:
I want a script that loads baskets of bread, plates of cheese and other things, but only during "dining hours" at other times the table should be empty. Currently I have a script that loads the bread to the table - but that only allows 1 piece of bread to be taken before there is no more, same for the others and it does it during the times I want. I've created the baskets and plates and what not, but have come to the stumbling block of loading the objects into the containers. So... how do I do it?
I do have a solution that I'd rather not do and that is this:
A wizinvis mob that loads the objects and puts them in the containers at said time. Let me know if there is any other way.
Thanks,
Kvetchy
-
If the basket and plates are made as containers, try adding the following to the working script you already have.
Though depending on the scripttype there's a chance it won't load where it should be, so I'm not sure this is what you're looking for.
* load container
%load% obj vnum-basket
* saves the reference of the container in 'cont'
set cont %loaded%
* load each item in the container
%load% obj vnum-bread %cont.name%
%load% obj vnum-bread %cont.name%
%load% obj vnum-bread %cont.name%
%load% obj vnum-bread %cont.name%
* the above will have loaded 4 breads in the basket
* load a new container
%load% obj vnum-plate
* store the reference from the new container in 'cont' (or use something else)
set cont %loaded%
%load% obj vnum-cheese %cont.name%
%load% obj vnum-cheese %cont.name%
%load% obj vnum-cheese %cont.name%
%load% obj vnum-cheese %cont.name%
* the above will have loaded 4 cheeses on the plate
Anyway hope this can help you out.
-
It works! Thanks, D. :)
Kvetchy