Author Topic: The "Tor" issue fix  (Read 10031 times)

0 Members and 1 Guest are viewing this topic.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
The "Tor" issue fix
« on: January 13, 2016, 10:10:19 am »
There has been an issue with names like Tor or Pix working in scripts due to mobs with the same start to their names: for example: torture victim, tortoise, pixie, etc.  So, there is now a way to make scripts so Tor and Pix (and anyone else with short names like that) can be affected.

Here is Roland's statement and example:

Added playeruid to scripting to make working with a player easier.
  playeruid p <name> sets the uid of the player to p. The name has to match
  completely, or p will be empty.
  Example for a mob trigger:
 
  playeruid p tor
  if %p%
    dg_cast 'shield' %p%
    if %self.room% == %p.room%
      %load% obj 3301
      give token tor
    else
      %send% %p% I wanted to give you something but you're not here.
    end
  end
 
It seemed easy enough, but obviously not easy enough for me as I tried to just put in one line to have it all work right and, of course it didn't.  So, here is the update of my voodoo doll script - originally taken from The Builder's Academy, but adapted to work on 4D.  I had to change pin to stick, because the pinch social interfered with it, but otherwise it was mostly someone else's code.  I have tested this plenty of times on Tor just to make sure it works and it does.  For those that want to know: Num Arg 2 is so it can be used in inventory - you don't have to be holding it.  Arg list: stick is the command to use to work the voodoo doll.  It also needs a victim to stick, thus the %arg% in the script.  Of course, the pain of this is, you have to use someone's FULL NAME to use it.  Celestia can not be shortened to Cel or Celest, it has to be Celestia.  I know this, I just tried it - Sorry Celestia.

Name: 'voodoo script',  VNum: [ 1286], RNum: [  350]
Trigger Intended Assignment: Objects
Trigger Type: Command , Numeric Arg: 2, Arg list: stick
Commands:
playeruid p %arg%
if !%p%
  %send% %actor% Who do you want to pin with the voodoo doll?
else
  eval dmg %p.hitp% * 100 / %p.maxhitp%
  if (%dmg% > 25)
    eval pain %random.15%
    switch %pain%
      case 1
        set hurt back
      break
      case 2
        set hurt head
      break
      case 3
        set hurt stomach
      break
      case 4
        set hurt left eye
      break
      case 5
        set hurt chest
      break
      case 6
        set hurt right eye
      break
      case 7
        set hurt left arm
      break
      case 8
        set hurt right arm
      break
      case 9
        set hurt left leg
      break
      case 10
        set hurt right leg
      break
      case 11
        set hurt groin
      break
      case 12
        set hurt left foot
      break
      case 13
        set hurt right foot
      break
      case 14
        set hurt throat
      break
      case 15
        set hurt heart
      break
      default
      break
    done
    %send% %actor% You slowly push a pin into the voodoo doll of %p.name%'s %hurt%.
    %echoaround% %actor% %actor.name% slowly pushes a pin into a voodoo doll.
    %send% %p% You suddenly feel a sharp stabbing pain in your %hurt%!
    %echoaround% %p% %p.name% suddenly screams with pain, clenching %p.hisher% %hurt%!
    %damage% %p% 10
    wait 20 s
  elseif %dmg% < 26
    set msg %random.5%
    switch %msg%
      case 1
        %send% %actor% %p.name% has suffered enough!
      break
      case 2
        %send% %actor% %p.name% can't take it anymore!
      break
      case 3
        %send% %actor% %p.name% is too weak!
      break
      case 4
        %send% %actor% %p.name% is still writhing in pain!
      break
      case 5
        %send% %actor% %p.name% won't survive another pin!
      break
      default
      break
    done
  end
end