how to write a business paper writing essays for ielts essay on can money buy happiness cosmetology research paper

can an object in a container get the actor.id?

  • hurin
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
2 months 2 weeks ago #8725 by hurin
So I have an object that when the timer expires it removes variables from the player before it may transform/purge/load something else

Now its easy of course if the object is on a player or carried by a player

if %self.worn_by%
set actor %self.worn_by%
elseif %self.carried_by%
set actor %self.carried_by%

What if the player has the object in a container?
Is there a way to set the actor for something like that
elseif ??self.carried_incontainer_by??

Any help would be appreciated,
Hurin

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

More
2 months 2 weeks ago - 2 months 2 weeks ago #8726 by Rumble
Good question, probably more than one way to do this. I would use %has.item% or maybe %has.in%. If that doesn't work try to model the below example. Please let us know the results, looks like I need to update those helpfiles and examples.
Name: 'Mob Checks Player Inventory',  VNum: [   32], RNum: [   32]
Trigger Intended Assignment: Mobiles
Trigger Type: Greet , Numeric Arg: 100, Arg list: None
Commands:
* By Rumble of The Builder Academy    tbamud.com 9091
* This trigger has been replaced by the has_item variable. But this is still a
* good example. if %actor.has_item(1300)% does the same thing.
if %actor.eq(wield)%
  eval wep %actor.eq(wield)%
  if %wep.vnum%==1300
    set has_it 1
  end
end
* Checks the actors inventory if not wielding it.
if !%has_it%
  eval i %actor.inventory%
  while %i%
    set next %i.next_in_list%
    if %i.vnum%==1300
      set has_it 1
      break
    end
    * checks inside containers
    if %i.type% == CONTAINER
      while %i.contents%
        if %i.contents.vnum%==1300
          set has_it 1
          break
        end
      done
    end
    set i %next%
  done
end
*
if %has_it%
  say %actor.name% has that special item.
else
  say %actor.name% doesnt have that crappy item.
end

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 2 months 2 weeks ago by Rumble.

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

  • hurin
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 1 week ago - 1 month 1 week ago #8799 by hurin
Thanks for the response!

Been busy and haven't had a chance to get back into this until today.

When I first started this I tried to use examples like the above but could not get it to work as the object is already being carried by the player and I could not figure out how to get it to check the actors container as in the above example.

So my object has a timer and when the timer expires it deletes a variable on the player and then loads a new object in its place. When the new object is loaded it sets a new variable to the character.

uniqueid - objects are tagged with a generation time and a Unique ID. These never change over the life of the object. They are always saved and remain upon login.

Now what I am trying to do is tie both the good item and the bad item
to a specific character using our muds uniqueid. These items are not meant to be used by any other character.
This is done with another trigger that randomly checks to see if the variables match. If they don't it does some bad things to the player.

The below trigger is not the final trigger but has echos and stuff that I was using to try and figure it out.

Trigger Intended Assignment: Objects
Trigger Type: Timer , Numeric Arg: 100, Arg list: None
Commands:
* by hurin so probably a better way to do it
*on purge check who is carrying it or wearing it and remove variable
if %self.worn_by%
eval actorid %self.worn_by%
%echo% actorid wearing this is %self.worn_by%
%echo% %actorid.mask_uniqueid%
if %actorid.varexists(mask_uniqueid)%
rdelete mask_uniqueid %actorid.id%
%echo% Its about time to stop using this mask.
%load% obj 8202 %actorid% inv
%purge% %self%
else
%transform% 8202
%echo% i transformed but didnt remove the variable on who is wearing me
end
elseif %self.carried_by%
eval actorid %self.carried_by%
%echo% actorid carrying this is %self.carried_by%
%echo% %actorid.mask_uniqueid%
if %actorid.varexists(mask_uniqueid)%
rdelete mask_uniqueid %actorid.id%
%echo% Its about time to stop using this mask.
%load% obj 8202 %actorid% inv
%purge% %self%
else
%transform% 8202
%echo% i transformed but didnt remove the variable on who is carrying me
end
*
*this next part catches items in a container and transforms them into the
*bad object - but it doesn't remove the old variable from the character and
*when the new object is created on transform I can't set the new variable
*this is where I'm trying to figure out how the item can check who is *carrying it in a container and then
* rdelete/set/remote a new variable to *the character
*
else
%transform% 8202
%echo% I transformed as a last resort
end

when the new object is loaded this is what I am looking to do

if %self.worn_by%
set mask_uniqueid %self.uniqueid%
remote mask_uniqueid %actorid.id%
elseif %self.carried_by%
set mask_uniqueid %self.uniqueid%
remote mask_uniqueid %actorid.id%
** cant figure the below part out
elseif I am in a container carried by %actor.id%
set mask_uniqueid %self.uniqueid%
remote mask_uniqueid %actorid.id%


Am I totally missing how to use your example to get this to work?
Last edit: 1 month 1 week ago by hurin.

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

More
1 month 1 week ago #8800 by Parnassus
Replied by Parnassus on topic can an object in a container get the actor.id?
I think this may be a bit harder than it seems. The problem that I'm seeing is that you want the object to do something no matter where it is. I'm thinking that you cannot load an object into a container although it's possible that I'm thinking of different code since I play with various codes and get easily confused. You could purge it in a container but I don't think you could replace or transform it.

It may be possible to simplify. You probably want this mask to do something until a certain time and after that time to do something else. As a mask, you probably want this to happen while it is being worn. Why not put a timer on it to set a variable after whatever time. Then check to see if it is being worn. If it is being worn, hmm, I dunno if you could silently switch it.

Okay, I tested this and, yes, it will transform silently. It amused me to use a food item as the transformation and to see my test character was wearing a chestnut on her head. However, the trigger will exist on the new object. You can get around that with a vnum ifcheck. The trigger did not work if the item was in a container.

If the item is not being worn, run the trigger when someone puts the mask on since you probably didn't want to do anything with your mask until then. Check for the timer variable and switch or don't switch, depending.

Your trigger is probably totally different than what I'm thinking and this has nothing to do with the question but this may provide a jumping off place for you.

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

More
1 month 21 hours ago #8808 by cunning
hurin is one of my admin team, he has been busy as hell lately. I am sure he will use this as an example. He was referencing the uniqueID/Generation Time code I donated a few weeks ago.

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

Time to create page: 0.142 seconds