Author Topic: Advanced Scripts  (Read 40606 times)

0 Members and 2 Guests are viewing this topic.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
15. MULTIPLE RECEIVE
« Reply #15 on: October 29, 2013, 06:27:17 pm »
15. MULTIPLE RECEIVE

This is useful for Quest where a mob requires you to bring several items.

You should put some message in when he receives each item, so the player

will know that he is on the right track.

Two things are important in receive scripts:

1. To put a small delay before the actions in the script.

2. To ensure that the mob gives back any items that are not part of the

   quest.

   The loop below is one way to do this:



 else

  wait 1

  drop %object%

  say I have no use for this.

 endif



or

else

 return 0

 %echo% %self.name% refuses the gift.

endif



(In the second example, note that there is no delay before the return 0).



EXAMPLE 1

This is used for the mob to receive 6 of the same object before handing

out the reward.



Commands:

context %actor.id%

if %object.vnum% == 1411

 wait 1

 eval Bag_Count %Bag_Count% + 1

 global Bag_Count

 mpurge dust

 say Thank you. I need a total of six bags to pay you a 100 $ bill.

 if %Bag_Count% == 6

  %load% obj 3307

  wait 1

  say thank you, %actor.name%! There ya go!

  give bill %actor.name%

  set Bag_Count 0

  global Bag_Count

  unset Bag_Count

 endif

else

 wait 1

 give %object% %actor.name%

 say Sorry, I cannot accept this.

endif



EXAMPLE 2

This example will make the mob hand out a reward after receiving

three different objects. The order doesn't count. The Quest will have

to be carried out in one session. If the objects are numerous and hard

to get, it would be better to use remote flags. Be sure to remove them

from the player.id after the Quest is performed.



Commands:

if %object.vnum% == 110

 wait 1

 eval obj1 %obj1% + 1

 global obj1

 mjunk needle

 say I need two buttons and a thread too.

elseif %object.vnum% == 111

 wait 1

 eval obj2 %obj2% + 1

 global obj2

 mjunk button

 say I need a thread and a needle too.

elseif %object.vnum% == 112

 wait 1

 eval obj3 %obj3% + 1

 global obj3

 mjunk thread

 say I need two buttons and a needle too.

else

 return 0

 wait 1

 say Nice try. Wrong item

endif

if (%obj1% >= 1) && (%obj2% >= 2) && (%obj3% >= 1)

 emote deftly sows the buttons back on the coat.

 say Here, you can have my lucky thimble as thanks for the help.

 %load% obj 4114 %actor%

 %send% %actor% %self.name% gives you a thimble.

 %echoaround% %actor% %self.name% gives a thimble to %actor.name%

 unset obj1

 unset obj2

 unset obj3

endif

--

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
16. AVOID THE USE OF CHARMED MOBS IN RESTRICTED QUESTS
« Reply #16 on: October 29, 2013, 06:28:14 pm »
16. AVOID THE USE OF CHARMED MOBS IN RESTRICTED QUESTS

Use either of the following loops to avoid this mischief:



if %actor.vnum% < 0

 say Get lost, cheater!

else

 <hand out the reward, etc.>

endif



if %actor.is_pc%

 <hand out the reward, etc.>

else

 mkill %actor.master%

 mslay %actor%

endif

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
17. MULTIPLE ANSWERS
« Reply #17 on: October 29, 2013, 06:29:11 pm »
17. MULTIPLE ANSWERS

Sometimes it can be very frustrating for a player, if he is convinced

that he answered a riddle correctly, but still didn't get the reward.

Below is a script to make the mob accept multiple answers to a riddle,

where both the answers 'ring' and 'a ring' or even 'a ring ping huzzah'

should be regarded as correct.

The argument needs to be set as *



if (%speech%/=ring)

 wait 2s

 em growls fiercely at you.

 %load% obj 14642

 give ring %actor.name%

else

 whisper %actor.name% Wrong answer!  Now it's DINNER time!

 mkill %actor.name%

endif



You can also use the phrase

 

if (%speech.contains(ring)%

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
18. EXPERIENCE SCRIPT AND ONCE PER REBOOT SCRIPT
« Reply #18 on: October 29, 2013, 06:30:20 pm »
18. EXPERIENCE SCRIPT AND ONCE PER REBOOT SCRIPT

The reward for a Quest does not always have to be tokens or Quest Equip.

For all quests you should also get an amount of exp, and if the Quest

is a very large one, consisting of several parts, you should get some

exp each time you finish one of the parts.

You could also get exp for finding hidden exits or containers, for

getting to very remote places, for climbing trees, etc.

Below is a script that ensures that the same player only get this exp

once per reboot, while other players can still perform the same task

and get the exp. (This is to stop cheating with Quests by using bots).

The exp you get is also somewhat level related, so higher level players

get more exp than lower.

You can use this script on most trigger types, but NOT on mob scripts,

(at least if the mob is killable or purges itself at the end of the

script, that means the flag will be gone when the zone resets).

And NOT on RANDOM or TIMER or TIME scripts. (There has to be an %actor%).



context %actor.id%

if !%done%

  eval exp_amount %actor.level% * 10000

  *That is 500k for a level 50 player, and 100k for a level 10 player

  *Not actually that much, but the multiplyer is flexable.

  *The multiplyer always includes their level, just asa standard.

  *so as to make the quest reusable for higher level players also.

  nop %actor.exp(%exp_amount%)%

  *that just gave them the exp

  *also, if the player is under level 5.

  *You for a big quest, if you make any, you can give them a level.

  *like:

  nop %actor.exp(%actor.exp_needed%)%

  *if you want to give a player exp according to how much they need to level.

  eval ratio_exp %actor.exp_needed%/5

  nop %actor.exp(%ratio_exp%)%

  *then, lets give %done% a value

  set done 1

  global done

end

*and lets reset the context back to 0

context 0



Commands:

context %actor.id%

if !%done%

 eval am (%actor.level%*(2000+%random.200%))

 set ab %%actor.exp(%am%)%%

 eval %ab%

 eval done 1

 global done

endif

context 0



The loop:

context %actor.id%

if !%done%           *<action to be done ONCE per reboot>

 eval done 1

 global done

endif

context 0



is what sets the restriction. The rest of the script is for

calculating the amount of exp given.



To change the amount of exp gained: on a scale of 1 to 6.

[in the 'eval b (%actor.level%*<amount>)' ]

1: 2000  - use for finding hidden items

2: 4000  - use for finding start of a quest

3: 8000  - use for completing small quest tasks

4: 10000 - use for completing large quest tasks

5: 25000 - use for completing big quest.

6: (if quest can be done only once make it 50000)



You can also use the command 'nop' to set gold and exp. Sometimes it might

be logical to set negative amounts, for instance if someone enters an

obvious trap. The commands are for example:

nop %actor.gold(1000)%

nop %actor.exp(-1000)%



nop %actor.trade(10)%





Note that this script cannot be used on mobs, unless they are unkillable.

Once the mob is dead, the global flag is gone too.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
19. FOLLOWER IN RESCUE QUESTS
« Reply #19 on: October 29, 2013, 06:31:32 pm »
19. FOLLOWER IN RESCUE QUESTS

If you use the variable %actor.follower(name)% it is usually easier

to hand out the reward for a 'rescue quest' than if it's triggered by

the vnum of a certain mob entering a room. The script below also

checks if the follower actually is in the same room as the greeter,

which makes the quest pretty cheat proof.



* Note that the time delay at the start of the script is essential.

  The script won't work without it.



* Also remember that the (name) inside the ( ) is NOT the alias list,

  but the SHORT DESC of the mob.



Script type: Greet

Num arg: 100

Commands:

wait 1 s

if %actor.vnum% < 0

 if %actor.follower(Joe)% && %actor.follower_in_room(Joe)%

  <insert whatever actions you want here>

  %load% obj 3300

  give token %actor%

  drop token

  point token

  emote goes away with her child.

  %purge% Joe

  %purge% self

 else

  <insert whatever actions you want here>

 endif

endif



Here is another script that makes the follower enter portals and vehicles

after the master: It can be used for climb and descend objects too.



Script Type: Command

Num arg: 100

Arg: *

Commands:

if %cmd.mudcommand% == enter

 if %self.master% == %actor.name%

  enter %arg%

 endif

elseif %cmd.mudcommand% == climb

 if %self.master% == %actor.name%

  climb %arg%

 endif

elseif %cmd.mudcommand% == descend

 if %self.master% == %actor.name%

  descend %arg%

 endif

elseif %cmd.mudcommand% == jump

 if %self.master% == %actor.name%

  jump %arg%

 endif

elseif %cmd.mudcommand% == leave

 if %self.master% == %actor.name%

  leave

 endif

else

 return 0

endif

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
20. GOLD SCRIPT
« Reply #20 on: October 29, 2013, 06:32:24 pm »
20. GOLD SCRIPT

The following script earns you money, by stirring a goldpan. It's a

command trigger, argument 'stir'.

Should only be used with restrictions, like flags or low random success.



If %arg%/=goldpan

 %send% %actor% Hey! You're rich!

 nop %actor.gold(50000)%

else

 %send% %actor% You cant stir that!

endif

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
21. HUNT SCRIPT
« Reply #21 on: October 29, 2013, 06:33:12 pm »

21. HUNT SCRIPT

Intelligent mobs are more interesting and challenging than those that

only stand around to get themselves slaughtered. The script below

makes the mob hunt whoever enters its cave, if they are above a

certain level and hp. It doesn't bother with small fry. The second

script makes it return to its cave after having hunted the intruder

ten times.



A similar script can be used to make the mob hunt down a player after

he fled.

Be careful how you use this! Preferably set it on non-aggros, so they

only bother their original opponent. If the mob is aggro, make sure

that it is set as stay_zone. We don't want a lot of high level aggros

suddenly roaming about in zones that usually are safe for newbies.



Dragon hunt

Commands:

if %actor.vnum% < 0

   Context %actor.id%

   Growl

if %actor.hitp% > 20

  if %actor.level% > 44

    wait 1

    Tell %actor.name% How DARE you disturb me!

    Wait 4s

     If %actor.room% != %self.room%

      %send% %actor% %self.name% yells, 'I'm gonna EAT you!!!'

      eval num 1

      global num

      mhunt %actor%

   else

     growl %actor%

    end

  end

end

end



Dragon return

Commands:

if %num% == 1

 eval count 0

 while %count% < 11

 wait 45 s

 eval count %count%+1

 if %count% == 10

   eval num 0

   global num

   mhunt 0

   shout Next time, mortal! MUHAHA!

   emo wanders back to his cave.

   mgoto 6055

   rest

  end

 done

end



Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
22. FLOWER GROW
« Reply #22 on: October 29, 2013, 06:34:01 pm »
22. FLOWER GROW



A cute little script that makes a seed grow into a flower if you drop

it in a certain room. Actually the seed could also be made to grow

in any room with the words dirt, earth, soil or garden in the room

desc, by using the command line:



eval c %actor.room%

if (%c.name%/=dirt||%c.name%/=earth||%c.name%/=soil||%c.name%/=garden)



But if the reward item is any good, it would be better to restrict it

to a few rooms.



Room trigger - drop

if  (%actor.room% == 23205)||(%actor.room% == 23206)

 wait 1

 %echo% The seed falls into a small hole and you push the dirt around it.

 wait 1s

 %echo% After a moment a little sprout grows out of the ground.

 wait 2s

 %echo% The sprout quickly grows into a flower.

 %load% obj 23210

 %purge% %self%

else

 wait 1

 %echo% The little seed struggles to grow here but can't.

 %purge% %self%

end


Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
23. TWO ITEMS WORN TOGETHER BECOME STRONGER
« Reply #23 on: October 29, 2013, 06:35:41 pm »
23. TWO ITEMS WORN TOGETHER BECOME STRONGER

Now it becomes more complicated. If you wear two certain items

at the same time, they switch into something more powerful. For

this you need 6 scripts, 2 wear, 2 remove and 2 random triggers,

(THIS SCRIPT MIGHT STILL BE BUGGY!)



#23637

Set Items, Wear script 1~

1 j 100

~

if %self.vnum% == 23605

 if !%actor.varexists(itemoneworn)%

  set itemoneworn 1

  remote itemoneworn %actor.id%

  if %actor.varexists(itemtwo)%

   set itemone 1

   remote itemone %actor.id%

   %send% %actor% %self.name% shimmers as you wear it, becoming more powerful.

   otransform 23607

  else

   %send% %actor% %self.name% flickers as if seeking another of its type.

  end

 end

end

~

#23638

Set Item, wear script 2~

1 j 100

~

if %self.vnum% == 23606

 if !%actor.varexists(itemtwoworn)%

  set itemtwoworn 1

  remote itemtwoworn %actor.id%

  if %actor.varexists(itemone)%

   set itemtwo 1

   remote itemtwo %actor.id%

   %send% %actor% %self.name% shimmers as you wear it, becoming more powerful.

   otransform 23608

  else

   %send% %actor% %self.name% flickers as if seeking another of its type.

  end

 end

end

~

#23639

Set Item, remove script 1~

1 l 100

~

if %self.vnum% == 23607

 wait 1

 if %actor.varexists(itemoneworn)%

  rdelete itemoneworn %actor.id%

  if %actor.varexists(itemone)%

   rdelete itemone %actor.id%

   %send% %actor% %self.name% flickers and becomes dull once more.

   otransform 23604

  end

 end

end

~

#23640

Set Item, Remove script 2~

1 l 100

~

if %self.vnum% == 23608

 wait 1

 if %actor.varexists(itemtwoworn)%

  rdelete itemtwoworn %actor.id%

  if %actor.varexists(itemtwo)%

   rdelete itemtwo %actor.id%

   %send% %actor% %self.name% flickers and becomes dull once more.

   otransform 23606

  end

 end

end

~

#23641

Set Items, random 2~

1 b 100

~

if %self.vnum% == 23606

 if %actor.varexists(itemtwoworn)% && %actor.varexists(itemone)%

  %send% %actor% %self.name% shimmers, becoming more powerful.

  otransform 23608

 end

elseif %self.vnum% == 23608

 if %actor.varexists(itemtwoworn)% && !%actor.varexists(itemone)%

  %send% %actor% %self.name% flickers and becomes dull once more.

  otransform 23606

 end

endif

~

#23642

Set Item, Random 1~

1 b 100

~

if %self.vnum% == 23605

 if %actor.varexists(itemoneworn)% && %actor.varexists(itemtwo)%

  %send% %actor% %self.name% shimmers, becoming more powerful.

  otransform 23607

 end

elseif %self.vnum% == 23607

 if %actor.varexists(itemoneworn)% && !%actor.varexists(itemtwo)%

  %send% %actor% %self.name% flickers and becomes dull once more.

  otransform 23605

 end

end

~

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
24. DOOR SCRIPTS
« Reply #24 on: October 29, 2013, 06:36:45 pm »
24. DOOR SCRIPTS

There is often some confusion about what the DOOR triggers doo,

so here is a brief:

(NOTE! Door scripts can sometimes get screwed up if the Mud crashes at a

critical stage of the script, leaving a door open that really should be

closed. So loading a timered portal is usually a better option.)



%door% room.vnum direction field [value]



This command is used for adding, deleting, and modifying doors in room.

Direction determines which door is being changed, and can be north, south,

east, west, up, or down. If the door does not exist first, a new door can

be created.

Field is what property of the door is being changed. Valid fields are:



purge

    Removes the door completely. Value is not used.



description

    Value will be the new exit description.



flags

    Value will be the new door flags. This is a list of letters representing

    all the door flags.

    'a' EX_ISDOOR Exit has a door that can be opened and closed.

    'b' EX_CLOSED The door is closed.

    'c' EX_LOCKED The door is locked.

    'd' EX_PICKPROOF Lock can't be picked.

    'e' EX_SECRET  The door is secret.



 For example,

    %door% 13703 north room 13704

     *creates a new exit from room 13703 to room 13704

    wdoor 13703 north flags abe

     *creates a closed, secret door to the north in room 13703.

    %door% 13703 north flags ab

     *sets the door north as closed

    %door% 13703 north flags abc

     *sets the door north as closed and locked



key

   Value is the object number of the new key.



name

   Value is the new name of the door.



room

   Value is the room this door will connect to.



    For example,

    %door% 13703 north room 13704

     *creates a new door from room 13703 to room 13704

    %door% 13703 north name gate north

     *sets the name of the new door

    %door% 13703 north key 13704

     *sets the vnum of the key to the new door



A very useful option is to identify the vnums of the room the script is

set in and the room the actor just came from. Here are the command lines

for that:



eval r %self.vnum%

eval p %actor.room%



NOTE:

To create, open and close, or in any way modify a door in a room, the

script doesn't need to be set on that room. Any script, on any room, mob

or object can be set to modify a door, if the formats above are followed.



EXAMPLE 1

TYPE IN A CODE IN ONE SEQUENCE

1) Name         : code PWZ7438 ROOM

2) Intended for : rooms

3) Trigger types: Command

4) Numberic Arg : 0

5) Arguments    : PWZ7438

6) Commands:

wait 1s

*CLICK!*

%echo% The door silently slides to one side.

%door% 7551 west flags a

wait 10 s

%echo% The door silently slides shut again.

%door% 7551 west flags b



EXAMPLE 2. PRESS BUTTON

1) Name         : press button

2) Intended for : room

3) Trigger types: Command

4) Numberic Arg : 1

5) Arguments    : press

6) Commands:

if (button/%arg%)

%echo% the panel silently slides to one side, revealing an opening in the

wall.

%door% 7552 west flags a

wait 10 s

%echo% the panel silently slides shut again.

%door% 7552 west flags b

else

%send% %actor% press what?

endif



EXAMPLE 3

TYPE IN A CODE, NUMBER BY NUMBER (not quite sure if this works!)

1) Name         : open door 3674

2) Intended for : rooms

3) Trigger types: speech

4) Numberic Arg : 100

5) Arguments    : *

6) Commands:

if (3/%arg%)

 %echo% *click*

 set HCounter 1

 global HCounter

elseif (6/%arg%)

 if %HCounter% == 1

  %echo% *click*

  set HCounter 2

  global HCounter

 endif

elseif (7/%arg%)

 if %HCounter% == 2

  %echo% *click*

  set HCounter 3

  global HCounter

 endif

elseif (4/%arg%)

 if %HCounter% == 3

  %echo% *click*

  set HCounter 4

  global HCounter

 endif

endif

if %HCounter% == 4

 wait 1 s

 %echo% the door silently slides to one side.

 %door% 7552 west flags a

 wait 10 s

 %echo% the door silently slides shut again.

 %door% 7552 west flags b

endif

endif



EXAMPLE 4

REMOVE THE EXIT THE ACTOR JUST WALKED THROUGH

(Entry or greet trigger)

eval r %self.vnum%

eval p %actor.room%

if %direction% == north

 %door% %r% north purge

 %door% %r% north description There is no exit to the north.

 %door% %p% south purge

 %door% %p% south description There is no exit to the south.

 wait 1 s

 %echo% The door silently slides shut behind you.

endif

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
25. CONTAINER SCRIPTS
« Reply #25 on: October 29, 2013, 06:37:53 pm »
25. CONTAINER SCRIPTS



It is now possible for mobs to detect

1. whether a certain item is in a container, and

2. whether a certain number of that item are in a container.

This should be extremely useful in Quest scripts.

You can make it look both for vnums and alias. The variables are

if (%object.count(vnum)% == #)

if (%object.count(alias)% == #)

* 'count' will give you a value of the amount of that item.

if %object.has_in(vnum)%

if %object.has_in(alias)%

* 'has_in' will give you a value of 0 or 1



The vnum option is more exact, but the alias can be used in certain

quests, for instance if you want the mob to accept several different

objects with the alias 'sword'.



Below is an example with explanations:



EXAMPLE

eval objname %object.name%           *1)

wait 3

if %object.vnum% == 6341             *2)

 if (%object.count(6345)% == 10)     *3)

  wait 1 s

  say Thank you, %actor.name%, but you must bring that to Delinda.

  say She is in charge of the blue grapes.

  give basket %actor.name%

 elseif %object.count(6346)% == 10    *4)

  wait 1 s

  say thank you, %actor.name%.

  %purge% basket

  emote empties the basket into the bowl of the scale.

  wait 2

  %load% obj 6341

  give basket %actor.name%

  %load% obj 6349

  give brandy %actor.name%

  say There you go, now don't you drink it all at once.

  chuck

  say You can actually sell it in the ICTGs.

 else                              *5)

  wait 1 s

  say Hey! I can only take full baskets, or the weighing will be messed up.

  say All grapes have to be of the same kind too!

  wait 2 s

  give basket %actor.name%

  say You go and fill it up, and then come back again.

 endif

else                                 *6)

 say I cannot accept this.

 say You have to use our special baskets, or the grapes will be bruised.

 give %objname.car% %actor.name%      *7)

endif



*1) get the name of the object that was given

*2) is this the right container?   YES

*3) are they the right grapes?     NO

*4) do they have enough grapes?    YES

*5) only accept if they are the right ones and you have enough

*6) else give the container back

*7) ensure that the actor gets the right object back

    One reason why give scripts sometimes screw up is that many objects

    have more than one alias.

    So if you put the line 'give %object.name% %actor.name%' in a script,

    it might come out as   'give bag green' instead of 'give bag %actor%'.

    The way to avoid this error is to use the following lines:

      eval objname %object.name%

      give %objname.car% %actor.name%

    %objname.car% ensures that only the first word of the alias list is used.

    (Of course using just %object% does the same thing with the code update).


Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
26. MAKE A MOB HUNT A CERTAIN PLAYER
« Reply #26 on: October 29, 2013, 06:38:49 pm »
26. MAKE A MOB HUNT A CERTAIN PLAYER

Having a mob hunting a certain player can be very useful, and even quite

realistic. The mob will continue hunting, even after the player logs out

and on again, right until the mud reboots or either the mob or the player

is dead.

This should be used with caution, at least if the mob is high level,

since the hunter is almost impossible to get away from. It is advisable

to make a return script for the mob, where it returns to its home after

a given time, or this could turn out too irritating.



Trigger Intended Assignment: Mobiles

Trigger Type: Enter, Numeric Arg: 100, Arg list: None

Commands:

   %echo% The dog barks loudly, straining at its chain.

   wait 10 s

   %echo% The chain suddenly snaps! The dog is free!

   mhunt %actor%

   wait 2 s

   %echo% Woof! Woof! Woof...



Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
27. TIME SCRIPTS
« Reply #27 on: October 29, 2013, 06:39:35 pm »
27. TIME SCRIPTS

You can make a time script trigger any time of day, several times a day

by using time triggers with delays. The options are:

wait 1   = (almost immediate result)

wait 1s  = (1 seconds delay)

wait 1t  = (one ticks delay = 71 s)



You can also make an event occur once a day, once a week or once a year.

The options in the mud are:

hour   = 0-23

day    = 1-35

week   = 1-7

month  = 0-15

year   = 560 days

There are even names on the weekdays and months, if you want to make

things more 'realistic'.



The variables to use are:

%time.hour%

%time.day%

%time.week%

%time.month%

%time.year%



EXAMPLE 1:

%echo% Today is the %time.day%th of the %time.month%th month.



EXAMPLE 2:

if (%time.hour% == 10)&&(%time.day% == 30)&&(%time.month% == 5)

%echo% The time is now 10 am on the 30th of the 5th month of the year.

end



Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
28. NUM ARG ON OBJECT SCRIPTS
« Reply #28 on: October 29, 2013, 06:40:18 pm »
28. NUM ARG ON OBJECT SCRIPTS



The num arg is different in scripts for objects if the trigger is a

COMMAND thrigger. It is important to set this num arg correctly.

Command scripts work differently if the object is on the floor, in

inventory or worn, depending on how you set the num arg.



1 = held or worn

2 = in inventory

4 = room

3 = 1 and 2

5 = 1 and 4

6 = 2 and 4

7 = 1 and 2 and 4



so 3 will work both if the object is in the room or in the inventory,

7 will work in all positions.


Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
29. DAMAGE ACTOR IN PROPORTION TO HITPOINTS
« Reply #29 on: October 29, 2013, 06:41:15 pm »
29. DAMAGE ACTOR IN PROPORTION TO HITPOINTS

Sometimes it can be useful not to have a set damage amount, but one

that is in proportion to the actors hp. This way a newbie takes less

damage than an old player. The following lines will damage the actor

to half their hitpoint:



eval amount (%actor.hitp%/2)

%damage% %actor% %amount%