Welcome to the Builder Academy

Question Scripting Question

More
15 Jul 2012 07:50 #372 by Papaya Pete
There is a small problem that I ran into when I created a light spell the other day. It's not really a coding issue, as I got that part to work, it's the scripting on the light object created.

In order to use it, you need a rod with a glass globe. The idea behind this is you put some power into the glass globe, which makes it glow and provide the light. So, on casting 'create light,' I used mag_materials to consume the required component (rod with glass globe) and create the light source (rod with a glowing glass globe).

I figured that I could just put a timer on this object. When the timer goes off, I used a timer script to set off something like this...
Code:
%echo% The light within the glass globe flickers then goes out. %load% obj 105 %actor% inv %purge% %self%

This goes off without a hitch, except for one snag: the object is just dropped into the room. I'm wanting to have it at least remain in the player's inventory, otherwise it gets annoying having to worry about dropping it for some reason when the light goes out. Any ideas on how to tackle this?

Another idea I had, though this is more of a coding solution, is a combination of using %transform%, otimer, and a second mag_materials call to check for the rod with a glowing globe (it wouldn't look like it, after being transformed into a normal, non-glowing rod, but have the same vnum).

Anyways, thanks again for all the great help here. I'd be lost without it!

Please Log in or Create an account to join the conversation.

More
15 Jul 2012 12:37 - 15 Jul 2012 12:37 #373 by Rumble
Replied by Rumble on topic Re: Scripting Question
You probably just need to define the actor, but make sure they are wearing it first:
Code:
if %self.worn_by% set actor %self.worn_by% ... end

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com
Last edit: 15 Jul 2012 12:37 by Rumble.

Please Log in or Create an account to join the conversation.

More
15 Jul 2012 16:38 #374 by Papaya Pete
Replied by Papaya Pete on topic Re: Scripting Question
Hmm! I'll have to check to see if it is in someone's inventory too. Thanks again, funny how simple these problems are to solve at times. :P

Please Log in or Create an account to join the conversation.

More
16 Jul 2012 11:59 #380 by Fizban
Replied by Fizban on topic Re: Scripting Question
Guessing you probably got it working, but the entire script to check for both parts should be:
Code:
if %self.worn_by% set actor %self.worn_by% elseif %self.carried_by% set actor %self.carried_by% else halt end %echo% The light within the glass globe flickers then goes out. %load% obj 105 %actor% inv %purge% %self%

Please Log in or Create an account to join the conversation.

More
17 Jul 2012 20:38 #387 by Papaya Pete
Replied by Papaya Pete on topic Re: Scripting Question
Nah I just got around to taking care of that now. I was working on getting some of the work done on the rest of the classes.

Yeah that works out pretty well. The only problem that I saw was the 'halt' after the else. I needed it to return to being obj 105 even if it is not in someone's inventory.

Works perfectly otherwise, thanks! :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.185 seconds