4Dimensions Forum

Building & Scripting => Scripting Board => Topic started by: Kvetch on October 28, 2008, 10:30:55 pm

Title: How Do I???
Post 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!>
Title: Re: How Do I???
Post by: Kvetch on October 28, 2008, 10:33:02 pm
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
Title: Re: How Do I???
Post by: Mordecai on October 29, 2008, 02:01:18 am
dg_cast 'spellname' <target>

dg_cast 'acid arrow' %actor%

dg_cast 'acid arrow' %self.fighting%
Title: Re: How Do I???
Post by: Molly on October 30, 2008, 04:07:08 am
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.
Title: Re: How Do I???
Post by: Kvetch on October 30, 2008, 06:16:26 pm
worked in build port.  *blinks innocently*  Poor, poor Cati felt the wrath of that spell.
Title: Re: How Do I???
Post by: Fizban on November 01, 2008, 11:22:37 am
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%
Title: Re: How Do I???
Post by: Molly on November 11, 2008, 04:25:16 am
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.
Title: Re: How Do I???
Post by: Mordecai on November 19, 2008, 04:22:06 pm
Pic
Title: Re: How Do I???
Post by: Molly on November 21, 2008, 06:24:23 am
Pic

Huh?
Title: Re: How Do I???
Post by: Mordecai on November 21, 2008, 05:40:04 pm
Pic

Huh?
http://www.kvetch.com/
Title: Re: How Do I???
Post by: Molly on November 22, 2008, 07:43:08 am
Funny, but it doesn't answer my question. :P
Title: Re: How Do I???
Post by: Kvetch on November 22, 2008, 08:14:08 pm
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
Title: Re: How Do I???
Post by: Molly on November 24, 2008, 09:27:32 am
I understand that, Kvetch, but I had an actual question, not a complaint.
Title: Re: How Do I???
Post by: Fizban on November 25, 2008, 01:50:49 pm
I understand that, Kvetch, but I had an actual question, not a complaint.

Yes, it should most likely be self.
Title: Re: How Do I???
Post by: Molly on November 29, 2008, 05:49:42 am
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.
Title: Re: How Do I???
Post by: Mordecai on December 02, 2008, 02:33:31 pm
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.
Title: Re: How Do I???
Post by: Molly on December 03, 2008, 11:14:30 am
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%


Title: Re: How Do I???
Post by: Diandra on December 04, 2008, 12:11:07 pm
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.
Title: Re: How Do I???
Post by: Molly on December 06, 2008, 12:59:00 pm
I believe it is %actor.position(stunned)%, not %actor.pos(stunned)%
Title: Re: How Do I???
Post by: Diandra on December 07, 2008, 06:03:50 am
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.
Title: Re: How Do I???
Post by: Mordecai on December 08, 2008, 05:08:30 am
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.
Title: Re: How Do I???
Post by: Mordecai on December 08, 2008, 05:16:48 am
Quote
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
Title: Re: How Do I???
Post by: Molly on December 10, 2008, 11:17:30 am
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.).
Title: Re: How Do I???
Post by: Diandra on December 21, 2008, 05:08:26 am
So, will it be %actor.position(stunned)%, or %actor.pos(stunned) after the copyover?

Seems both work.
Title: Re: How Do I???
Post by: Kvetch on March 13, 2009, 08:18:02 pm
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
Title: Re: How Do I???
Post by: Diandra on March 14, 2009, 01:34:49 pm
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.


Title: Re: How Do I???
Post by: Kvetch on March 16, 2009, 11:03:56 am
It works!  Thanks, D.  :)

Kvetchy