Welcome to the Builder Academy

Question global vars

More
01 Jul 2022 04:40 - 01 Jul 2022 14:45 #10093 by aegon
global vars was created by aegon
I've got four trigs, when combined, are designed to send a reaper hunting a vis 30lev pc in the zone and then he returns if defeated or kills his target.

- one is a room trig that detects pc entry and reports the target:

Name: 'dont fear the reaper',  VNum: [35050], RNum: [  748]
Trigger Intended Assignment: Rooms
Trigger Type: Enter , Numeric Arg: 100, Arg list: None
Commands:
*
* 061222 Aegon 350 Ice Fortress
*
context 350
*
if %actor.is_pc%
  if %actor.canbeseen% && %actor.level% == 30
    eval reaper_target %actor%
    set reaper_hunting 0
    global reaper_target
    global reaper_hunting
    %zoneecho% %self.vnum% Tsarkaza, Ice Reaper of the Avatar, is hunting %reaper_target.name%!
  end
end

I have a mob waiting in a holding room "listening" for a target from the first trig so when his random trigger fires:

Name: 'the grim reaper',  VNum: [35134], RNum: [  763]
Trigger Intended Assignment: Mobiles
Trigger Type: Random , Numeric Arg: 10, Arg list: None
Commands:
*
* 060922 Aegon 350 Ice Fortress
*
context 350
*
set inroom %self.room%
%zoneecho% %inroom.vnum% A soul-piercing wail rises up through the frozen mists and fills you with a shaking fear.
if ! %reaper_hunting%
  if %reaper_target%
    if %reaper_target.has_item(35104)%
      %send% %reaper_target% A faint voice, perhaps just a sursurration of the wind hisses, "%reaper_target.name%, savor your last breath."
    else
      %send% %reaper_target% A faint voice, perhaps just a sursurration of the wind hisses, "%reaper_target.name%, Ur-ash gha-ool tragh or-tazask dag."
    end
    wait 60 s
    mgoto 35029
    set inroom %self.room%
    %zoneecho% %inroom.vnum% A darkness, a shadow is moving through the frozen chambers, searching ...
    eval reaper_hunting 1
    global reaper_hunting
    mhunt %reaper_target%
  else
    %zoneecho% %inroom.vnum% An ancient memory, not your own, of agony and gore overwhelms you and is gone.
  end
else
  %zoneecho% %inroom.vnum% A chill wind mounts, deep cold swirling through the air about you, as the walls of this room frost suddenly with ice.
end

another is a defeated msg:

Name: 'the room that time forgot',  VNum: [35135], RNum: [  764]
Trigger Intended Assignment: Mobiles
Trigger Type: Death , Numeric Arg: 100, Arg list: None
Commands:
*
* 063022 Aegon 350 Ice Fortress
*
set inroom %self.room%
%zoneecho% %inroom.vnum% A great howling, cold and forlorn, twists and climbs, rising in pitch until it passes beyond hearing ...
%echo% The walls of ice shed a layer of frost, slick cold returning as the shadow passes on.
return 0

and finally, if the reaper kills the pc, he returns to his cubby:

Name: 'you got reaped!',  VNum: [35136], RNum: [  765]
Trigger Intended Assignment: Mobiles
Trigger Type: Act , Numeric Arg: 0, Arg list: Your blood freezes as you hear
Commands:
*
* 063022  Aegon 350 Ice Fortress
*
context 350
*
if %actor.is_pc%
  if %actor% == %reaper_target%
    set inroom %self.room%
    %echoaround% %actor% The Reaper bends over the corpse of %actor.name% and reaches through %actor.hisher% armor and into %actor.hisher% chest
    %echoaround% %actor% searches through cracking ribs, and withdraws a still beating heart.
    %send% %actor% As you die, and all thought drifts away, your life passing in seconds before you, the limitless void of Death takes you.
    %zoneecho% %inroom.vnum% A chilling laugh fills the ice halls, marking the reaping of another soul!
    mgoto 35103
  else
    %echoaround% %actor% The Reaper smirks, uninterested in an unmarked soul.
  end
end

Thing is, the global var isn't working.  I place debug echoes in the receiver trig on the Reaper mob and the reaper_target shows up null so the Reaper never responds to a valid target.

Would appreciate any advice!

Aegon
Last edit: 01 Jul 2022 14:45 by aegon.

Please Log in or Create an account to join the conversation.

More
03 Jul 2022 23:25 #10094 by Parnassus
Replied by Parnassus on topic global vars
I'm thinking that it's something like this:
tbamud.com/forum/3-building/531-question...context-actor-id#533
I'm not understanding the context 350 thing. If I change the context to %actor.name% I can see that my character is the target when I stat the room. (Yes, ID is better but name is easier to see when I'm testing.)

I'm not around much any more and I'm always easily confused anyway so I'm not really the answer person. I just keep poking until it does what I want or it doesn't. As you can see from this post:
tbamud.com/forum/3-building/3742-trigger...arna-s-elevator#4587
Krell and I don't think that it's possible to access a global from somewhere else, so, yeah, I can get the room to recognize my character is the target but I'm not sure your reaper can know that.  Is there a reason you don't remote it to the player file and have your reaper go to the room and check players for remote? You can cycle through any player in the room using, well, I always use the rabbit at tstat 1398 or tstat 24 but if you want to see one online here, you can check out the grenade:
tbamud.com/forum/3-building/3778-trigger...-damage-example#4711


 

Please Log in or Create an account to join the conversation.

More
05 Jul 2022 07:45 #10098 by aegon
Replied by aegon on topic global vars
since context can be any arbitrary number, i'm using the area number to keep non pc actor contexts sorted.

anway, i like your solution if there is no way to push a global into a shared memory space dynamically. maybe contexts only work across like trigger types, like object -- object or mobile -- mobile. running a room to a mob might be the ultimate issue (or a bug)

i want the thing to hunt -- right like give the target a chance to flee the zone so they can retreat before being attacked ... the thought of being stalked is kinda frightening.

i'll figure a work-around. thanks for the examples!

Please Log in or Create an account to join the conversation.

More
06 Jul 2022 03:43 #10100 by Parnassus
Replied by Parnassus on topic global vars
I thought of something that would amuse me. Find out where your target is and capture the name of the room. Wait a few minutes, goto that room and send to the target something like: I see that you've been in <room name>, <target name>! I've almost caught you now!.

Re: your context - still not seeing how a mob saving his zone number is useful but that's okay because I often don't understand the things that other people do and most people don't understand why I do things the way I do. However, you might find this thread interesting:
tbamud.com/forum/3-building/4325-trigger...he-day-advanced#7567

It uses one of Detta's triggers and her triggers are amazing! It also describes what I call the Fizban Fix which is so useful. In one mud where I played there was a mob that stood in a room where we often stood and talked. This mob triggered to the word "king". This meant that if anyone said anything like: "Oh, I was working this weekend", he'd start talking away. In fact, you couldn't even say, "Hey, that mob interrupted me while I was talking!" because off he'd go again.

You'll notice that when she remotes information to a players file, she identifies it with the zone and a codeword to describe the trigger. This is one of the reasons I love Detta's triggers :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.187 seconds