Building & Scripting > Scripting Board
Advanced Scripts
Kvetch:
40. ARRAY EXAMPLES
Name: 'Random Healing Spell', VNum: [57715], RNum: [ 3668]
Trigger Intended Assignment: Rooms
Trigger Type: Speech , Numeric Arg: 100, Arg list: heal
Commands:
eval heal %random.15% -1
eval text[0] %random.5% * -10
eval text[1] %random.8% * -7
eval text[2] %random.3% * -5
eval text[3] %random.6% * -7
eval text[4] %random.2% * -3
eval text[5] %random.5% * -3
eval text[6] %random.6% * -2
eval text[7] %random.6% * -3
eval text[8] %random.1% * -1
eval text[9] %random.1% * -10
eval text[10] %random.3% * -10
eval text[11] %random.7% * -2
eval text[12] %random.4% * -8
eval text[13] %random.2% * -3
eval text[14] %random.4% * -2
set heal2 %%text[%heal%]%%
eval heal2 %heal2%
%damage% %actor% %heal2%
set heal3 -%heal2%
eval heal3 %heal3%
%send% %actor% You have been healed by %heal3% hitpoints.
This one was written by me, there a few other examples by other people such as:
Name: 'Dog Emote - 192', VNum: [ 150], RNum: [ 150]
Trigger Intended Assignment: Mobiles
Trigger Type: Random , Numeric Arg: 10, Arg list: None
Commands:
eval max %random.4%
set txt[1] sniffs at you friendlily.
set txt[2] whimpers for some attention.
set txt[3] growls menacingly at your feet.
set txt[4] watches your every movement suspiciously.
set speech %%txt[%max%]%%
eval speech %speech%
emote %speech%
Name: 'Falling Fruit', VNum: [41005], RNum: [ 3014]
Trigger Intended Assignment: Rooms
Trigger Type: Random , Numeric Arg: 25, Arg list: None
Commands:
* Random
* Falling fruity affects
* Fruit of various descriptions falls from the tree and as it strikes
* players it cast's various affects on them
eval numOne %random.8%
eval numTwo %random.6%
eval numThr %random.16%
*
set fruit[1] apple
set fruit[2] banana
set fruit[3] pear
set fruit[4] orange
set fruit[5] kiwi
set fruit[6] starfruit
set fruit[7] peach
set fruit[8] strawberry
set color[1] red
set color[2] orange
set color[3] yellow
set color[4] green
set color[5] blue
set color[6] purple
set spell[1] cure light
set spell[2] heal
set spell[3] poison
set spell[4] blind
set spell[5] curse
set spell[6] cure blind
set spell[7] armor
set spell[8] bless
set spell[9] cure light
set spell[10] invisibility
set spell[11] strength
set spell[12] sense life
set spell[13] bless
set spell[14] sleep
set spell[15] sanc
set spell[16] chill touch
*
set type %%fruit[%numOne%]%%
set desc %%color[%numTwo%]%%
set affect %%spell[%numThr%]%%
*
eval type %type%
eval desc %desc%
eval affect %affect%
eval target %random.char%
*
%send% %target% A %desc% %type% falls from the tree and hits you.
%echoaround% %target% A %desc% %type% falls from the tree and hits %target.name%
.
dg_cast '%affect%' %target%
wait 1 sec
%echo% The %type% falls to the ground and vanishes.
http://www.dgscripts.n3.net/
Name: 'bbv find pkers', VNum: [*****], RNum: [ 3931]
Trigger Intended Assignment: Objects
Trigger Type: Command, Numeric Arg: 1, Arg list: locate
Commands:
if %arg%
if %arg.omr%==mobile
if %arg.is_pc%
if %arg.canbeseen%
if %arg.is_pk%
eval rname %arg.room%
%send% %actor% As you gaze into the present. You see an image of %arg.name% in %rname.name%
else
%send% %actor% They are not PK.
end
else
%send% %actor% %arg% doesn't appear to be around.
end
else
%send% %actor% %arg% doesn't appear to be around.
end
else
%send% %actor% That is not a player.
end
%echoaround% %actor% %actor.name% peers into the present.
else
return 0
end
Name: 'Room peeker', VNum: [25617], RNum: [ 5080]
Trigger Intended Assignment: Objects
Trigger Type: Command, Numeric Arg: 3, Arg list: peek
Commands:
switch %arg.mudcommand%
case north
set arg north
break
case south
set arg south
break
case east
set arg east
break
case west
set arg west
break
case up
set arg up
break
case down
set arg down
break
default
return 0
halt
break
done
eval thatRoom %%actor.room.%arg%(vnum)%%
if %thatRoom% > 0
%send% %actor% You peek %arg%.
dg_peek %actor% %thatRoom%
else
%send% %actor% Where do you want to peek?
end
Kvetch:
if %arg%|=carvings
will return true if the arg is car, carv, carvi, carvin, carving or carvings
nop %actor.is_pregnant(on)%
will make a character pregnant
mlag <player> <1 to 300 miliseconds>
lags said player by the amount of time stated
if %self.contained_by%== vnum
checks to see if the item with this script is in the container that equals the vnum
if %findmob.21311(21332)%
checks to see if a certain mob is in a certain room.
(the first vnum is the room, the second is the mob)
so this script is looking for mob 21332 in room 21311
%actor.room.vnum%
gives you the vnum of the room the actor is in.
%actor.room.name%
gives you the name of the room the actor is in.
%actor.room.north(room).name%
gives the name of the room to the north of the actor.
%load% obj <vnum> %actor%
loads an object directly onto the player instead of having the mob have to drop the object and the player to pick it up.
%load% obj 1234 %actor% 16
allows you to load an object (12234) directly to the wear location (16-wielded) on the actor.
Note: if the actor is already wielding something, it will go to inventory.
%load% obj 1234 %actor.eq(wield)% does the same thing.
Kvetch:
if %actor.eq(wield1)%
if %actor.eq(wield2)%
set wield %actor.eq(wield2)%
if %wield%
if %wield.vnum% == 1300
%echo% yes, that actor is wielding the correct weapon!
end
end
if %actor.eq(neck1)%
if %actor.eq(neck1).vnum% == 1300
etc
For positions on a player for use in scripts with the %actor.eq(<position>)% thing.
"hold", WEAR_HOLD
"held", WEAR_HOLD
"light", WEAR_LIGHT
"wield", WEAR_WIELD
"wield2", WEAR_WIELD_2
"rfinger", WEAR_FINGER_R
"lfinger", WEAR_FINGER_L
"neck1", WEAR_NECK_1
"neck2", WEAR_NECK_2
"body", WEAR_BODY
"head", WEAR_HEAD
"legs", WEAR_LEGS
"feet", WEAR_FEET
"hands", WEAR_HANDS
"arms", WEAR_ARMS
"shield", WEAR_SHIELD
"about", WEAR_ABOUT
"waist", WEAR_WAIST
"rwrist", WEAR_WRIST_R
"lwrist", WEAR_WRIST_L
"face", WEAR_FACE
"eyes", WEAR_EYES
"hips", WEAR_HIPS
"legs2", WEAR_LEGS_2
"feet2", WEAR_FEET_2
"antenna", WEAR_ANTENNA
"tail", WEAR_TAIL
"horns", WEAR_HORNS
"focus", WEAR_FOCUS
The ones in the quote marks are what you can use, minus the quote marks as in:
if %actor.eq(hands)%
say You have something on your hands!
end
Kvetch:
as first line in the script.put an * as arg under 5, and then the line
if %cmd.mudcommand%==<mud command used>
example:
if %cmd.mudcommand%==put
as first line in the script.
Kvetch:
To load an object into a container use
%load% obj <vnum> %container%
*load container
%load% obj <obj vnum>
*save the reference to the container (so it doesnt get wiped when you load the next item)
set cont %loaded%
*then load each item you want to put in the container.
%load% obj <vnum> %cont.name%
etc etc...
Or use
%load% obj <obj vnum> <room vnum>
to load the object in a different room than the script is set on.
To load new objects at each zone reset
when you load the container the first time...
just save the %loaded% value in a global
so the next time you wanna put something in it...
you just keep using the %cont%
if !%cont%
%load% obj <cont vnum>
set cont %loaded%
global cont
%load% obj 12346 %cont%
else
%load% obj 12346 %cont%
end
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version