Building & Scripting > Scripting Board

Script Help, please.

(1/2) > >>

Tocharaeh:
I'd like to put in my smaller zone asap. I'm a scripting dunce when it comes to things that are complicated. The only reason my zones aren't pouring into 4D GP is because I can't script past very simple things.

Anywho. This is what I need.

I need a special lever script that will do the following:

Player 1 pulls LeverA, script will prompt the player now and then to ensure that they continue to hold down on the Lever. Main door script will acknowledge that requirement 1 has been met (until the player looses grip, or lets go).

Player 2 will pull LeverB, and hold. Main door script will acknowledge that requirement 2 has been met.

Player 3 will pull LeverC, and hold. Main door will open. Player 1 will now be able to release his/her lever, and cross into the next room, and pull a switch that will LOCK the door in place, thus allowing the other two players to also release their levers without risk of the door closing.

There is no order to the levers as long as all three are pulled, and held so that player 1 can lock the door in place.

Door can be opened from the other side should it close, so that players can try again should one accidentally release the lever before the switch is thrown. Door will of course be closed and locked until they restart and complete the process.

Could someone PLEASE OH PLEASE with smaller PRETTY PLEASE sprinkles on top help me with this? LH was supposed to a long time ago, and abandoned me, and I most certainly cannot script such a thing.

Prometheus:
I would say yuor best bet would be to talk to Thotter or Fizban since they are out resident script gods :)

Prometheus

Tocharaeh:
Dang. Both of them have abandoned me completely in the past too. This is why I don't have zones published.

Molly:
One thing that I don't quite understand with your setup is how the script would know if a player released the lever. There is no command to actively 'release'. 'lose grip' or 'let go of' something like a lever, so I doubt any player would type in such a command, they'd just leave, when they tired of it. Consequently the only thing I can think of is to check if all three players are still present in the room when the last lever is pulled.

One way to check this would be to make a  separate LEAVE trigger to unset the global flag if they leave the room in any way. There is probably a more elegant way to check if a certain player is in the room, but I cannot find any in the files right now. Maybe one of the script experts can help with that part?

Anyhow, for the main door script work you need to make two checks; A. if all three players each pulled a lever and B. if all three of them are still in the room. Something like the script below: (substitute PlayerA etc. for the real names of the players)

eval player_name %actor.name%
if %actor.name% == <PlayerA>
  if !PlayerA
   eval PlayerA 1
   global PlayerA
   %send% %actor% You grab a lever and hold it.
   %echoaround% %actor% %actor.name% grabs a lever and holds it.
  else
   %send% %actor% You are already holding a lever, that's all you can handle.
  end
elseif %actor.name% == <PlayerB>
  if !PlayerB
   eval PlayerB 1
   global PlayerB
   %send% %actor% You grab a lever and hold it.
   %echoaround% %actor% %actor.name% grabs a lever and holds it.
  else
   %send% %actor% You are already holding a lever, that's all you can handle.
  end
elseif %actor.name% == <PlayerC>
  if !PlayerC
   eval PlayerC 1
   global PlayerC
   %send% %actor% You grab a lever and hold it.
   %echoaround% %actor% %actor.name% grabs a lever and holds it.
  else
   %send% %actor% You are already holding a lever, that's all you can handle.
  end
endif
wait 3 s
if (%PlayerA% == 1) && (%PlayerB% == 1) && (%PlayerC% == 1)
 %door% 7551 west flags a
 %echo% The door silently slides open.
 %send% PlayerA Great! Your buddies are holding the door open so you can let go of your lever.
 %send% PlayerA Now you can go to the next room to lock the door in an open position.
endif

It's not much more than a first outline, and I'm not sure about the first line. In any case what you want is rather complex, you'll need separate scripts for locking the door, and for checking that all players remain in the room until the door is open. But I really haven't got the time for scripting right now, since the kids are still out of daycare. I'll hopefully have more time for the mud again in a month, when we get back from our trip to Italy.

It would be nice to finally see your zone in the Gameport, but getting Diandra, Thotter or Fizban to help would probably be quicker than waiting me out.

Diandra:
I'd prefer to finish updating a zone I haven't worked on for over a year before I throw myself on other projects again, otherwise the update will never finish. So I'm sorry Toch but this will have to wait a bit if you want me to look at this. And even then it's no promess, as Molly already said it's a complex thing, but what she posted here is already a start. Of course it doesn't help that certain situations in RL are taking all my energy either...

Navigation

[0] Message Index

[#] Next page

Go to full version