Chest Script

Discussion forum for Devil Whiskey 3rd Party MODS.

Moderator: Admin

Post Reply
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

Chest Script

Post by origen »

I am having some issues with a script I am writing. It is probably something simple, so I will post it here.

I am trying to script a chest (not a guarded chest). According to the scripting tutorial, it can be done, with the command

Code: Select all

chest(eventPtr, chestType, difficulty, gold, itemList, randItemCount, text)
Which I believe I did, with this script:

Code: Select all

chest(e, 1, 20, dice(100, 4, 1), [], dice(1, 4, 1), "a chest", "treasure")
The only chests I see in the existing game are guardedchests, which look like this:

Code: Select all

    return guardedChest(e,
        "mtower1Chest",
        0x1, 0x2,
        [("Summoner", 2, 2, 40)],
        ["Wading through the gory remnants of battle, you find a chest!"],
        ["You see a chest here, that has not been disturbed recently."],
        ["As you leave, the chest is engulfed in flame and burns away!"],
         3, 20, 7000, [], dice(1, 4, 1), "a chest",
        "Treasure")
So what am I missing?
User avatar
Rickstavern
Black Claw
Posts: 109
Joined: Tue Feb 22, 2005 11:34 am
Contact:

Post by Rickstavern »

Looks like you have an extra parameter. The chest objects requires 7 and you have 8 in your script.

Code: Select all

chest(e, 1, 20, dice(100, 4, 1), [], dice(1, 4, 1), "a chest")
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

Post by origen »

I had thought that as well, but it didn't work with only 7 either. The reason the extra parameter is there is because it is in the guarded chest script, so I thought what the heck.

Maybe I can make a guardedchest, but with no fight? I know how that script works, at least. If I set the monster number to 0, that should also work. It seems more like a workaround than a solution.
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

Post by origen »

Okay, I finally got it to work.

The issue had to do with what is being imported from APIUtils. I originally had a

Code: Select all

from APIUtils import *
but had to replace it with

Code: Select all

from APIUtils import chest, dice, showMessage
for it to work. I am not sure why some work fine if you import "*", and some don't, but this is one that don't.

I also had to remove the "treasure", since it would run on and say I found a chesttreasure.

Thanks for your help.
User avatar
origen
Dark Sidhe Lord
Posts: 903
Joined: Thu Feb 10, 2005 5:54 pm
Location: Secret League of Nirulat Headquarters
Contact:

Post by origen »

Okay, one more question then. On the parameter that says chestType, where is there a list of chest types? I manually tried 1 (large spike) and 2 (choking gas on 1 person). But short of testing each one, is there a list?

Can I create my own?
User avatar
Rickstavern
Black Claw
Posts: 109
Joined: Tue Feb 22, 2005 11:34 am
Contact:

Post by Rickstavern »

Here is a script that I use for teasure.

Code: Select all

from eventAPI import *
from APIUtils import *

rtcastle2chest1 = 0

def fireEvent(e):
   global rtcastle2chest1
   rtcastle2chest1 = getTag(e, "rtcastle2chest1")
   if (rtcastle2chest1 == 1):
      return 1
   else:
      showMessage(e, ["You find a battered chest hidden behind some old barrels."])
      chest(e, 1, 5, 1623, [], dice(1, 4, 1), "")
   showMessage(e, ["The chest and it's remaining contents fade away."])
   rtcastle2chest1 = 1
   setTag(e, "rtcastle2chest1", rtcastle2chest1)
   return 1
User avatar
Rickstavern
Black Claw
Posts: 109
Joined: Tue Feb 22, 2005 11:34 am
Contact:

Post by Rickstavern »

Hmm, a double post. How unlike me.
Post Reply