I have tried to alter the printed name of certain items in the test phase of the combat system I am designing.
While this is a small detail, it does bug me a bit and would like to get it sorted.
I have a kind of weapon which is the unarmed player. An example would be ‘bare fists’. I simply want to replace the ‘a’ before ‘bare fists’ with ‘your’, however I can’t seem to find a way to do this.
The following code simply prints ‘a bare fists’, which I expected but thought I would at least try it:
Rule for printing the name of bare fists while taking inventory:
say “your fists”.
Any help here would be much appreciated.
Are the fists listed in your inventory? Or do you want to say that you hold things in your fists?
If the fists are simply part of the player like so:
your bare fists are part of the player.
Then they wouldn’t be listed in the inventory at all. Listing your fists in inventory feels a tad strange.
Yes I had thought of this however the fists need to act exactly as every other weapon and having them as part of the player breaks their function.
I want the player to know that they have their bare fists ‘equipped’ as their default weapon if no other item is equipped.
The other option would be to simply not list ‘bare fists’ in the inventory at all but I had tried privately naming them but it didn’t seem to have any effect.
Being able to change the description in the inventory listing would be ideal though as I want the flexibility for the player to check the damage stats etc of bare fists.
Try: “the player is carrying your bare fists. They are proper-named.”
(See this bit of the docs for details).
Another solution in @DeusIrae’s link is useful as well. I have used both.
The indefinite article of "bare fists" is "your."
Going into what you’re doing, you may also be able to eliminate “bare fists” as an item entirely, but that might be down the road.
report taking inventory:
if the weapon of the player is nothing, say "You have no weapon, so you are using your bare firsts.";
Perfect, thanks. I was looking for ways to remove rather than altering the article.
Thanks for the reply.
I thought about removing unarmed combat entirely however I wanted to leave my options open and rather than making them a part of the player with their own rules, I found it much simpler to simply make them a different kind of weapon. They are automatically equipped to the player and a single command of attack will execute whichever weapon the player has equipped and will default to their bare fists if no weapon is equipped.
I would like to make the print inventory list categorised and when I do that I will have some message unique to the player having their bare fists equipped so they don’t simply appear as another held item.
For the time being the solution of proper naming and calling the weapon ‘bare fists’, allows for things to be printed before and after during printing inventory or reporting combat etc which all make sense in their specific context.
That sounds good! Yeah, simplicity in coding is a very good thing.
Here in particular there’s more than one way to do things, so certain solutions may be more simple than others based on what you’re trying to do. Inventory is one of those big things you need to twiddle a lot, and knowing stuff like “omit X” or “now Y is (not) marked for listing” is really neat stuff for once you need to move beyond the (very convenient) default behaviors.
Exactly my thought. I felt that the extra work for something that is essentially a fall back in case the player drops all weapons and finds them in a situation where they still need to be able to retaliate to being attacked. I think the ideal option would be to have a message in the inventory listing that appears in italics perhaps and states that 'you have no weapon equipped, your bare hands are ready to fight", but make sure this is the first listing in the printed list as to not have it look disjointed.
This isn’t too hard to achieve. Something like this should work, even though it’s a trifle hacky (whisking the wielded weapon off-stage temporarily to avoid listing it twice).
I’m assuming that “wielded weapon” is an object variable, which can take the value nothing (rather than modelling “your fists” as a game object). But that’s not essential.
The wielded weapon is an object that varies.
Before taking inventory:
if the wielded weapon is nothing:
say "[italic type]Warning! [We]['re] not wielding a weapon[roman type]![paragraph break]";
say "[We]['re] wielding [the wielded weapon].[paragraph break]";
now the wielded weapon is nowhere.
After taking inventory when the wielded weapon is something:
now the wielded weapon is carried by the player.
The print empty inventory rule response (A) is "[We]['re] carrying nothing[if the wielded weapon is something] else[end if]."
The print standard inventory rule response (A) is "[We]['re][if the wielded weapon is something] also[end if] carrying:[line break]";
Thanks for the response. I’ll have a look later on to see if it’s worth adjusting what I’ve currently got.
The main reason I’ve kept the bare fists or any other body part you want to include as physical item is simply to allow it to share all the same numbers and values of a weapon as the player can use their bare fists as a weapon.
I’ve simply blocked them from taking or dropping them and the player is automatically equipped with them if no other weapon is equipped.
Also whenever theyre printed, the words surrounding the description make sense. For instance the player will be described as unarmed: ‘your fists are ready for action’ (not exactly what is written but it gets the point across).
So far I’ve made this model work really well within the confines of this combat system, at least for the time being.
Yes, there are advantages to modelling them as an object. It also lets the player refer to them in commands. If I were doing that, I’d make them a part of the player, guaranteeing they can’t be dropped, etc. Letting the player carry them in inventory is asking for trouble, I think.
E.g. did you remember also to block inserting them into containers and putting them on supporters? Also throwing them at something, though there’s already an Inform rule blocking that if you haven’t overridden it.
And did you write a “does all include” rule excluding them? Otherwise the player will weirdly be told “your bare fists: you can’t drop those!” or similar whenever they “drop all”.
But none of those things need concern you if you make them part of the player. They also won’t show up in standard inventory, which is probably best. You can write rules mentioning them specially when appropriate.
Yeah I’ve only blocked the most obvious things. I’ll have to weigh up rewriting several bits of source then debugging vs blocking and creating rules around the current way it’s written. If the entire process becomes too time consuming it can simply be removed from the world model entirely as it’s not a critical feature.
At this point in time it’s flagged on my to do list and will try the path of least resistance fist before doing a full rewrite of all things pertaining to that part of the combat system.
Thanks for your feedback. It has prompted me to delve into this a bit deeper probably sooner than I was planning on it.