The John Smith Asks Questions Thread
- John Smith
- Posts: 29
- Joined: Sat Dec 22, 2012 5:28 am
The John Smith Asks Questions Thread
I was wondering what line of code I would use in a lua script to reassign a different name to an item. An example would be a longsword in an alcove would be renamed "John's Longsword". Adding onto that, if you can change the name then surely you can change the description as well.
Last edited by John Smith on Wed Dec 26, 2012 12:42 am, edited 2 times in total.
My personal website: 38chan.net
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
-
Ixnatifual
Re: Renaming Items
Edit the items.lua in your scripts folder and add a clone that uses the regular longsword as a base.
Example:
When you clone the item, all the stuff you don't specify remains the same as per the original item.
For more details, check the item section here.
Example:
Code: Select all
cloneObject {
name = "cracked_short_bow",
baseObject = "short_bow",
uiName = "Cracked Short Bow",
attackPower = 9,
description = "While retaining some basic functionality, this weapon has seen better days. Perhaps you can find a similar bow in better condition."
}
For more details, check the item section here.
- John Smith
- Posts: 29
- Joined: Sat Dec 22, 2012 5:28 am
Re: Renaming Items
Awesome. Thank you for the help.Ixnatifual wrote:Edit the items.lua in your scripts folder and add a clone that uses the regular longsword as a base.
Example:When you clone the item, all the stuff you don't specify remains the same as per the original item.Code: Select all
cloneObject { name = "cracked_short_bow", baseObject = "short_bow", uiName = "Cracked Short Bow", attackPower = 9, description = "While retaining some basic functionality, this weapon has seen better days. Perhaps you can find a similar bow in better condition." }
For more details, check the item section here.
My personal website: 38chan.net
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
- John Smith
- Posts: 29
- Joined: Sat Dec 22, 2012 5:28 am
Re: The John Smith Asks Questions Thread
I want a player to enter a room where once they step in they are locked inside until they kill all of the monsters. How would I go about having a lua script check to see if all the monsters in that room are dead? I would think it goes a little something like this:
Only the door will be open before players get to that part of the dungeon when it should have been closed. The variable for the monster health must be off. How would I define a dead monster?
Code: Select all
if
crowern_4:getHealth(0) and
crowern_5:getHealth(0) and
crowern_6:getHealth(0) and
crowern_7:getHealth(0) and
crowern_8:getHealth(0) and
crowern_9:getHealth(0) then
dungeon_door_wooden_5:open()
else
dungeon_door_wooden_5:closed()
end
My personal website: 38chan.net
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
Re: The John Smith Asks Questions Thread
a couple things:
close() not closed()
getHealth() == 0 not getHealth(0)
close() not closed()
getHealth() == 0 not getHealth(0)
Finished Dungeons - complete mods to play
- John Smith
- Posts: 29
- Joined: Sat Dec 22, 2012 5:28 am
Re: The John Smith Asks Questions Thread
Oh. Silly mistakes. Thank you.Komag wrote:a couple things:
close() not closed()
getHealth() == 0 not getHealth(0)
My personal website: 38chan.net
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
- John Smith
- Posts: 29
- Joined: Sat Dec 22, 2012 5:28 am
Re: The John Smith Asks Questions Thread
Huh. I made the fixes but the door still doesn't seem to open, even when I kill the crowerns.

You're meant to hit the wall button to open the door, you step on the invisible pleasure plate and the door closes behind you. When all the monsters die the door should open.

You're meant to hit the wall button to open the door, you step on the invisible pleasure plate and the door closes behind you. When all the monsters die the door should open.
My personal website: 38chan.net
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
I am the writer for H.O.T.D.Abridged. You can check it out by clicking there.
Re: The John Smith Asks Questions Thread
hmm, I didn't really think this through, just corrected those small errors. The real problem is that those monsters no longer exist after you have killed them, so any script can't find any monster to get the health from in the first place. You'll need to check for the existence of the monsters. If you want the door to open at the death of the last monster, it might be easiest to set up a custom monster (clone) with an onDie hook to run the script, and have the script work only if it never finds the monsters (only returns nil)
Finished Dungeons - complete mods to play
Re: The John Smith Asks Questions Thread
I think it'd be easier to place a counter, have ondie hooks that reference the counter, have the counter open the door when it reaches 0.
Each monster could decrement the counter on it's death.
Each monster could decrement the counter on it's death.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: The John Smith Asks Questions Thread
viewtopic.php?p=31998#p31998John Smith wrote:Huh. I made the fixes but the door still doesn't seem to open, even when I kill the crowerns.
You're meant to hit the wall button to open the door, you step on the invisible pleasure plate and the door closes behind you. When all the monsters die the door should open.
I think in this link, Shroom wanted to do almost exactly what you're doing. Might be a good starting point.
Replace "snail" with "crowern" and that should just about get you there. xMin/xMax and yMin/yMax will define a box around your room. Then replace his door name with your own.
*edit: alternative idea...
might also try:
Code: Select all
if crowern_x == nil
and crowern_y == nil
and crowern_z == nil
then door_foo:open()
end
