Building & Scripting > Scripting Board
Advanced Scripts
Kvetch:
10. OBJECT TRANSFORM
This can be used to make it appear as if an object breaks when it is
dropped, or to magically change into something new when you wear it
or remove it.
EXAMPLES:
1. Wear trigger:
if %self.vnum% == 23603
%send% %actor% You put a spider on your nose!
%echoaround% %actor% puts a spider on their nose. YUK!
%echo% The Spider spins its web over its new home!
otransform 23604
end
-----
2. Rem trigger:
if %self.vnum% ==23604
return 0
%send% %actor% You struggle but just cannot get the sticky web off your
face.
%echoaround% %actor% struggles but just cannot get the sticky web off their
face.
otransform 23603
end
-----
Drop trigger, object 230:
if %self.vnum% == 230
wait 1
%echo% As the vial hits the floor, it shatters into tiny fragments.
%echo% A pool of red fluid spreads on the floor.
%transform% 231
end
----
(231 is a pool of liquid with glass shards, with no take flag)
When an object transforms to a new vnum, the scripts set on the
original object will follow over to the new vnum. To avoid this, and
to make sure that the right scripts are attached to the new object,
you use the commands dg_attach and dg_detach:
dg_attach <vnum of trigger> <id of object to attach it to>
dg_detach <vnum of trigger> <id of object to remove it from>
Kvetch:
11. ROOM SWITCH
This is a neat trick, a player with a certain flag is taken to a different
room than everybody else when he enters a certain room. The new room can
have an identical desc, but contain a reward, or perhaps an entrance to a
part of the zone that you cannot get to without the flag. Since there are
no messages it's hard for the players to figure out what happens.
Make two different rooms and use an Enter trigger:
if %actor.varexists(whatever)%
eval r %actor.room%
%door% %r% %direction% door <vnum of second room>
wait 1
%door% %r% %direction% door <vnum of first room>
end
EXAMPLE
if %actor.varexits(NewRoom)%
eval r %actor.room%
%door% %r% east door 1220
wait 1
%door% %r% east door 1221
end
Kvetch:
12. ENTER RESTRICTION
This simple loop on an Enter script can stop the actor from entering the
room, unless he's got a certain flag. You can put in a message, but it is
even more frustrating without. The exit east is there, but nothing happens
when you type east.
EXAMPLE:
if !%actor.varexists(whatever)%
return 0
%send% %actor% Alas, you cannot go that way...
end
Kvetch:
13. RANDOM LOAD MOBS
Sometimes it can be useful to make a mob load in random rooms,
when the zone resets. If nothing else it makes for more variation
and makes the mob a bit harder to find. (The mob only appears in
a new room if it is killed before the zone resets).
For: mobiles
type:load
narg: 100
commands:
set num1 <first.room.in.zone.vnum>
eval room (%num1%+%random.<total.number.of.rooms.in.zone>%)
if (%room.name%!=0)||("%room.name%"!="")
*this makes sure the room exists
mgoto %room%
end
Kvetch:
14. RANDOM LOAD OBJECTS
Making objects load in random rooms is a bit trickier. You have
to make a mob that teleports around and drops them. Make the mob
purge itself after it dropped the object, if you want a new object
to appear every time the zone resets. Otherwise the object only
appears if the mob is killed before the reset. Both principles
can be equally useful.
The script below will make the mob drop a given number of the
item randomly in any of the rooms of the zone each time he is
loaded after a reboot or getting killed.
for: mobiles
type: load
narg: 100
arg:
commands:
set num1 <first.room.of.zone.vnum>
set total <total.amount.of.items.to.be.randomly.distributed>
set what <vnum.of.item.to.be.distributed>
set count 0
while (%count%<%total%)
eval count (%count+1)
%load% obj %what%
eval room (%num1%+%random.<total.number.of.rooms.in.zone>%)
mat %room% drop <name.of.the.item>
done
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version