Author Topic: Generating Random Treasure  (Read 1016 times)

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Generating Random Treasure
« on: July 20, 2011, 11:37:49 pm »


               I'm trying to generate a new set of random treasure and-or items from a placable every time the pc enters the area - i figured out how to rand gen a new set of schmucks from an encounter every time, but i can't find anything in the manuals or lexicon about treasure.
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
Generating Random Treasure
« Reply #1 on: July 21, 2011, 11:19:58 am »


               treasure is just another word for shiny loot. all you need is a onexit script that clear the player flag, and a loot generating onused script that set the flag.

the major pita with loot system is to make the item list/ or setup the creation process for generating items on the fly. Premade items gives the best result if you have the time and energy to make enough of it. random item has a tendensy to not make much sense.
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
Generating Random Treasure
« Reply #2 on: July 21, 2011, 02:25:42 pm »


               There are almost as many methods for making loot appear as there are scripters. :-)

Some people use a box in an inacessable spot filled with the loot which they want to appear somewhere, then a script copies some or all of the items to the creature (or to the creature's treasure chest) when the creature dies.

The standard Bioware system creates the loot on the creature as part of the OnSpawn event.  This can be dangerous for balancing since some creatures may have the proficiency to equip and use the items you gave them (but never intended them to use).

The method I prefer is to run a script on death which uses a table of items and selects an item at random from the table.  You can call the script multiple times for more than one item.  You can make more than one script to handle different monsters and different loot.

If you're talking about loot appearing in containers, I prefer to use a script as above linked to the OnOpen event for the container, to create the loot.

If it's a single-player game, the OnOpen script needs to set a variable to prevent more loot from being created and check the variable before creating loot.

If it's a multi-player game, the script needs to set up a delayed command which will delete the variable after an amount of time has elapsed so that following players can get loot.
               
               

               


                     Modifié par Melkior_King, 21 juillet 2011 - 01:31 .
                     
                  


            

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Generating Random Treasure
« Reply #3 on: July 21, 2011, 09:05:06 pm »


               I have an encounter in a house with a container - it's a generic for any of the houses in the town - for low level characters to get experience - the creatures are a random spawn every time the area is entered - onopen sounds right but I don't know how do it.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Generating Random Treasure
« Reply #4 on: July 22, 2011, 01:30:59 am »


               Just drop in one of the pre-made scripts like: nw_o2_classhig or any of the other ones.
One method is to make a bunch of chests, useable, with inventories, and then put a different treasure generation script in their on open.  Then you can just randomly spawn, or place the chests.  Personally I have a treasure map system that leads to buried treasure, which adds a bit of spice.
               
               

               
            

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Generating Random Treasure
« Reply #5 on: July 22, 2011, 06:39:14 am »


               Thanks man - it works - I want the chest to keep spawning treasure so i'll do it on the heartbeat as well - i hope this doesn't cause problems with the que.
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
Generating Random Treasure
« Reply #6 on: July 22, 2011, 07:17:46 am »


               don't. you module will get wrecked. infinite treasure in multiple chest will not only lag your module it will wreck the whole money system. it's better to keep using the onopen but without safety check. but that is bad design. you should earn your loot. and infinity of anything is bad design imo.

if you clean out a house and then go back in and it's full of monsters again. that would be like playing a game from the 80's on NES. it wouldn't live up to todays standards. it could still be fun but not because of this.
               
               

               
            

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Generating Random Treasure
« Reply #7 on: July 22, 2011, 07:31:26 am »


               That's what I want - I want door-kicking experience for low-level characters - like Bard's Tale (Commodore 64) - there is an if=then in the script--I don't really understand it, but it looks like it is checking to see if the container is empty.
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
Generating Random Treasure
« Reply #8 on: July 22, 2011, 01:58:38 pm »


               well in that case you should reset it each time the player enter the room, not have the chest spawn treasure without atleast a room worth of fight come inbetween the player and the chest.otherwise the player will just stand near the chest open it take the loot, close it and then open it again and get more loot. (exploit warning) then the player drack it all back to the shop and sell it. Which mean that you either can't have good gear in the shops or you can simply give it to them directly.

the onheartbeat would cause the chest to filling up to its limit even when the player isn't there. That's the major don't. Independent on your module game style you should never use a heartbeat for this kind of tasks..
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Generating Random Treasure
« Reply #9 on: July 22, 2011, 08:36:47 pm »


               Yeah CID-78 is right.  I was going to mention that, but considered you would discover for yourself, or already knew not to do it that way.  What I do is set an int on the chest when it has been opened and if that int is set like looted 1.  Then you return, do not fire the loot script.  Then you can set a random delay to reload the chest or use the onenter or some other method to reload the chest.  Though if the players realise that by simply leaving the room they can reload the chest by entering the room again, you might have trouble there too.  That's why I use a random delay of say between 200 and 400 seconds, though there are other methods.  Like there is more than one way to skin a cat.
               
               

               
            

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Generating Random Treasure
« Reply #10 on: July 22, 2011, 09:06:13 pm »


               The chest doesn't really matter - my goal is to give treasure for killin monsters.
               
               

               
            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
Generating Random Treasure
« Reply #11 on: July 22, 2011, 09:12:34 pm »


               Use the treasure spawn systme that SoU, and HotU have. it works for containers, and for creatures. look under (standard, placeables), treasure, for the area, and mod containers, the how to set up, is in the comments of the properties. good luck!
               
               

               
            

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Generating Random Treasure
« Reply #12 on: July 22, 2011, 09:27:47 pm »


               I dont' have those. Lame. I know

How do you do it onenter?
               
               

               
            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
Generating Random Treasure
« Reply #13 on: July 22, 2011, 10:00:23 pm »


               if your goal is getting treasure for killing enemies you should have the loot on the enemy. that way there is no risk for exploit. you need to kill it to get the loot. otherwise you can allways dodge the enemies and get the treasure.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Generating Random Treasure
« Reply #14 on: July 23, 2011, 02:59:13 am »


               A bit of a messy way to do what you want would be to increment a local int on each PC that killed a monster and then add those together and put them on the party leader.  Then if the local int was high enough say they have to kill five enemies and that local matches the required int on the chest, in this case 5 then the chest would spawn treasure.  Doable but a bit messy.
So on the monsters on death the process would be to get the last killer and then increment the local on the leader, skipping the step of incrmenting on the actual killer, unless they are the party leader.  A bit complicated but it could be done.  Then after the chest was looted the local on the party leader, the only one who should open the chest, would be deleted.  The party would want their rogue to be the party leader with this approach, for if the the chest were opened by another nothing would happen.  Of course the rogue could simply unlock and detrap the chest but the party leader would have to open it.  Also you might want to make the party aware of this approach by use of a seer or some other npc who tells them how to get at the treasure.