Builder:Scripting

From Wormhole MUD Wiki
Jump to: navigation, search
m
m (Loading stuff)
Line 74: Line 74:
 
   * Note: 'cloak' and 'belt' must be in the namelist of objects 3456 and 3457
 
   * Note: 'cloak' and 'belt' must be in the namelist of objects 3456 and 3457
  
 +
On Arrakis, when I wanted Fremen to jump down from the back of a sandworm and attack, it wasn't enough to just load the Fremen mobiles, since they would have been naked. Each one has a script that executes whenever the mobile is loaded, and it looks a lot like the one above: it loads a mass of items and forces them to wear and wield. Because I didn't want the player to be spammed with a mass of
 +
 +
  eval rga %random.50%
 +
  %self.gold(%rga%)%%load% obj 6223
 +
  eval spawnroom %self.room%
 +
  mteleport %self% 6300
 +
  %load% obj 6223
 +
  %load% obj 6224
 +
  %load% obj 6225
 +
  %load% obj 6226
 +
  %load% obj 6227
 +
  %load% obj 6228
 +
  %load% obj 6135
 +
  if %random.4% == 1
 +
    %load% obj 6412
 +
    %load% obj 6412
 +
  end
 +
  wear all
 +
  wield multi
 +
  mteleport %self% %spawnroom%
 +
 +
Notes: the first two lines decide upon and add a random amount of money to the mobile... because having a mass of mobs who all carry exactly the same cash makes them seem cultish and creepy. (IMHO.)
 +
 +
"eval spawnroom %self.room%" stores the room where the mobile loaded. We're about to leave it.
 +
 +
"mteleport %self% 6300" sends the mobile to the zone immroom, so the player can't see what happens next, where the script causes each mobile to wear a mass of clothing.
 +
 +
There's a one in four chance that the mobile also gets a couple of grenades (item 6412), again to make the mobiles seem more varied and interesting.
 +
 +
Note that the mobile doesn't need to "get" any of these items - mobile triggers load the items straight to inventory.
 +
 +
Finally, "mteleport %self% %spawnroom%" brings the newly-loaded mobile back to where he was loaded... with no time elapsed.
  
 
== Tidying up ==
 
== Tidying up ==

Revision as of 14:40, 28 November 2013

Personal tools
Namespaces

Variants
Actions
Navigation
Player Resources
Builder Resources
Toolbox