10 Aug, 2011, Lodrien wrote in the 1st comment:
Votes: 0
Ok, I am wanting to make a new skill. It would be a warrior class skill and racial specific. The skill would be to create only some weapons, Stalves, Maces, Spears. It also would create some equipment, leg, wrist, chest,head. The items made would only last for like 90 ticks then disappear. Once items are created, they would then be bound to the person who made them, and not able to be given to others. I can really use some help please. Oh it is on a Rom 2.4 MUD
10 Aug, 2011, Ssolvarain wrote in the 2nd comment:
Votes: 0
If I were to try that, which I might some day, I would look at the outfit command, or one of the 'create' spells. Then I'd look at the skills themselves, and figure out how to merge outfit/create into a new skill. After that, it's just a matter of tweaking. I'd try to get everything else right before the timer, because that looks a little tricky to pick out how it works.
10 Aug, 2011, Lodrien wrote in the 3rd comment:
Votes: 0
Awesome, thanks. I will look at that and see how it rolls from there. Its funny because coding has never been my strong suit.
10 Aug, 2011, plamzi wrote in the 4th comment:
Votes: 0
Ssolvarain said:
If I were to try that, which I might some day, I would look at the outfit command, or one of the 'create' spells. Then I'd look at the skills themselves, and figure out how to merge outfit/create into a new skill. After that, it's just a matter of tweaking. I'd try to get everything else right before the timer, because that looks a little tricky to pick out how it works.


There's got to be a place in your code where all items in the world get checked and their timers are decremented (usually, only if they're left to rot on the ground). You may want to define a new item type which decays regardless of where it is, and handle the extraction there, in a manner analogous to normally decaying items. As Ssolvarain said, the best way to get started on coding something new is to find a similar bit of existing code and re-purpose it.
11 Aug, 2011, Rarva.Riendf wrote in the 5th comment:
Votes: 0
Quote
Once items are created, they would then be bound to the person who made them, and not able to be given to others. I can really use some help please. Oh it is on a Rom 2.4 MUD

An example of how you can code this (I have mine plugged in get_obj and do_give) (this is to prevent object that have been looted to be transferre to a npk, but you can change / add test for anything you want
bool_t can_give_obj(OBJ_DATA *obj, CHAR_DATA *ch, CHAR_DATA *victim) {
//if is is a pk looted object or a container containing a pk looted object
if (obj->item_type == ITEM_CONTAINER) {
bool_t found = FALSE;
OBJ_DATA *objInContainer;
for (objInContainer = obj->contains;objInContainer;objInContainer = objInContainer->next_content)
if (( !victim ? !IS_PK(ch) : !IS_PK(victim)) && IS_SET(objInContainer->extra2_flags, ITEM2_PK_LOOTED)) {
found = TRUE;
break;
}
}
if (found) {
chprintf(ch, "You cannot %s %s without removing %s from it\n\r", !victim ? "get" : "give",
obj->short_descr, objInContainer->short_descr);
send_to_char("as it has been cursed by the gods and cannot be touched by a non PK.\n\r", ch);
return FALSE;
}
}
else {
if (( !victim ? !IS_PK(ch) : !IS_PK(victim)) && IS_SET(obj->extra2_flags, ITEM2_PK_LOOTED)) {
send_to_char("This item has been cursed by the gods, only a PK can touch it\n\r", ch);
return FALSE;
}
}
return TRUE;
}


for the decaying part, look in obj_update in update.c just need to put a timer on it basically


and for item creation just look at create_food (or any spell that creates one)

then it is up to you to set the values you want (that is the real hard part, keeping balance when you introduce crafting of any kind)
11 Aug, 2011, Ssolvarain wrote in the 6th comment:
Votes: 0
Could just set the "inventory" flag and leave it at that, too. Looting conjured items seems silly anyways :3
12 Aug, 2011, Rarva.Riendf wrote in the 7th comment:
Votes: 0
Ssolvarain said:
Could just set the "inventory" flag and leave it at that, too. Looting conjured items seems silly anyways :3

Good catch. And thx for telling what this flag is supposed to do. In the code I took over, only the flag definition remained :)
13 Aug, 2011, Ssolvarain wrote in the 8th comment:
Votes: 0
All I know is that the flagged item will disappear whenever the carrier dies.
13 Aug, 2011, Rarva.Riendf wrote in the 9th comment:
Votes: 0
Ssolvarain said:
All I know is that the flagged item will disappear whenever the carrier dies.

Hmm this one is rot_death or..should be.
13 Aug, 2011, Sharmair wrote in the 10th comment:
Votes: 0
The real intended use of the inventory flag is for the objects that shops sell that have no
limit to the number that can be sold. The effects are purge on death of the shopkeeper
to disallow getting objects that way, and also to tell the code to create a new object
to actualy give to the buyer (as opposed to just giving the object directly to the player).
On some (if not all) systems, the flag is a system managed flag that the system will set
on resets to shops, and is not set on the object's index. If you were to have objects with
the flag that players could have, you could open yourself up to an exploit where they
give the object to a shopkeeper and are able to buy as many copies as they like.
13 Aug, 2011, Ssolvarain wrote in the 11th comment:
Votes: 0
Rarva.Riendf said:
Ssolvarain said:
All I know is that the flagged item will disappear whenever the carrier dies.

Hmm this one is rot_death or..should be.

Rot_death is the one I was going to suggest, but I think you're able to interrupt the rot timer by just bagging it (which your bit covers, I think).

And I guess scratch the inventory flag. Sharmair is completely right in how it can be exploited.
0.0/11