Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - petriomelony

Pages: 1 [2] 3
16
Dead Souls Support / Re: mobs giving items
« on: November 15, 2007, 09:22:36 AM »
hmm, i will give that a shot, thanks! :)

17
Dead Souls Support / Re: LIB_SENTIENT
« on: November 13, 2007, 08:04:13 AM »
ahh, interesting!  the mud i usually play on only has one language (generally speaking) so it never even crossed my mind that it might be that, wow

yes, i've mostly been using a manual editor as opposed to the QCS anyways :) i think i might just set english only and then be done with it.  thanks a lot, Crat :)

18
Dead Souls Support / Re: LIB_SENTIENT
« on: November 12, 2007, 07:51:44 PM »
well, Crat:

i did read the sentient thing, no worries, and i programmed a sentient.  but here's what i want (perhaps my question was not clear):

right now, i can do this:
Code: [Select]
ask ollivader what's a wand?
You ask, "Ollivader what's a wand?"
Ollivander asks in English, "Do you want me to explain wands?"
but i can't do this:
Code: [Select]
say what's a wand?
You ask in Common, "What's a wand?"
** nothing happens**

... and i totally just realized my mistake!! wow.  ok, i thought "ask ollivander" was a part of the syntax, when it was really just "ask" that triggers the talk response! gah

is there a way to make it work with say as well?  because saying with a question transforms to asking, but yet it doesn't trigger a response.

19
Dead Souls Support / Re: Rebuild/refresh player object
« on: November 12, 2007, 10:58:00 AM »
when i did this, i simply copied over a new race (called humantest) and modified that... then, when i MADE SURE it was working with a test character, i switched my admin character over with a
Code: [Select]
call me->SetRace("humantest")

or something like that.

20
Dead Souls Support / Re: verb help, please?
« on: November 12, 2007, 10:55:59 AM »
heya Amylase,

yep! sure i can do that :) sorry i didn't respond on the weekend, i didn't check the forums.

when i get home though, of course.  i am currently at work (though to be honest, i think most of my mud coding has been done here so far :P)

21
Dead Souls Support / Re: LIB_SENTIENT
« on: November 12, 2007, 09:50:27 AM »
is there a way to set a talk response that works off "say" as opposed to "ask <mob>"?

22
Dead Souls Support / Re: mobs giving items
« on: November 12, 2007, 09:49:34 AM »
well, i meant like... most objects to be destoyed completely on reboot, so each time the mud starts up all items in the game would be erased and players would have to re-equip (by killing mobs/buying from shops, etc).  inventories would basically be cleared of all items except for special pieces of equipment, such as wands, and money of course.  things like armor and more powerful weapons or torches and such would have to be re-gotten.

23
Dead Souls Support / Re: mobs giving items
« on: November 09, 2007, 12:41:05 PM »
hmm.. cuz let's say i have 5 different types of wood, 5 different lengths, 3 different textures, 3 different flexibilities and 3 different cores:

5 * 5 * 3 * 3 * 3 = 675 different combinations?  or am i totally off.  that's a lot of manual coding and a lot of files... when there is probably some way to randomly generate them instead :( sigh

24
Dead Souls Support / Re: mobs giving items
« on: November 09, 2007, 09:21:32 AM »
the thing about that, detah... wouldn't the wands change every time?  i eventually want all items to be destroyed on reboot, but wands in particular to be permanent (along with things like money and such, of course), and if the instances were destroyed and regenerated, they would be different if i used an array of choices, right?

i was thinking i could use different wandx.c items, but doesn't that take up a lot of unnecessary space?  and there's still the issue of making it personalized for the player.

25
Dead Souls Support / Re: mobs giving items
« on: November 09, 2007, 08:27:44 AM »
thanks a lot for all the input, people :)

it would definitely be pretty good to have the attributes/whether they bought a wand or not stored in the player file, but how exactly should i go about doing this?  is there a particular chapter or FAQ question that could help me out?  i don't think i ever saw anything like it.

there's still the issue of the item itself then... would it just be a generic wand that changes based on who holds it?  the problem with this now is that if you managed to acquire someone elses' wand, it'd look just like yours if it referenced the file of the player who is holding it for the attributes and posessive name and such.

26
Dead Souls Support / Re: mobs giving items
« on: November 08, 2007, 02:48:38 PM »
bah, isn't there any way to edit posts?

27
Dead Souls Support / mobs giving items
« on: November 08, 2007, 02:46:24 PM »
hey all! i've just begun to dip my toes into programming sentients.  i wanted to make a kind of interactive shop keeper, and i've done ok, but there's two things i would really love to add in... and i would appreciate any help with them.

here's the code for the vendor:

Code: [Select]
#include <lib.h>


inherit LIB_SENTIENT;



int WandSpeech();
int SellWand(object who, string verb, string wand);
static void create() {
    sentient::create();
    SetKeyName("ollivander");
    SetId( ({ "ollivander", "wizard", "wand maker", "wand-maker", "old man", "man" }) );
    SetShort("Mr. Ollivander the Wand-Maker");
    SetLong("Standing before you is Mr. Ollivander, an old man with wispy white "
          "hair.  He looks a little tired, but his bright blue eyes convey a "
          "hidden energy.  He twirls a thin wand in his hands as he looks you "
          "up and down, as if he knew you were coming.");
    SetLevel(25);
    SetRace("humantest");
    SetClass("mage");
    SetGender("male");
    SetAction(25, ({
"Mr. Ollivander says, \"%^BOLD%^%^CYAN%^Tis the wand that chooses the wizard, you know.%^RESET%^\"",
"Mr. Ollivander rummages about the shelves idly.", "Mr. Ollivander twirls his wand between his fingers.",
"Mr. Ollivander looks you up and down.",
"Mr. Ollivander says, \"%^BOLD%^%^CYAN%^Just starting up at Hogwarts then, eh?%^RESET%^\"",
"Mr. Ollivander says, \"%^BOLD%^CYAN%^Your spells will always be better when performed with your own wand.%^RESET%^\"",
"Mr. Ollivander says, \"%^BOLD%^CYAN%^I remember every wand I've ever sold...%^RESET%^\"",
"Mr. Ollivander says, \"%^BOLD%^CYAN%^Don't settle for anything less than Ollivander's!  There ain't no place better.%^RESET%^\"",
"Mr. Ollivander says, \"%^BOLD%^CYAN%^Almost gored me with his horn, that one unicorn...%^RESET%^\"",
"Mr. Ollivander says, \"%^BOLD%^CYAN%^All my wands are hand-made with the finest Phoenix Tailfeathers, Unicorn Hairs, and Dragon Heart-Strings.%^RESET%^\"",
      }));
    SetTalkResponses( ([
        "wand" : "Do you want me to explain wands?",
        "wands" : "Do you want me to explain wands?",
        ]) );
    SetCommandResponses( ([
"explain": (: WandSpeech :),
"sell" : (: SellWand :),
      ]) );
   
}
int WandSpeech(string what){
    eventForce("say The magic wand is the source of a wizard or witch's power. "
               "Without one, incantations would be ineffectual, curses would "
               "be casual chatter, and hexes about as harmful as hedgehogs.  "
               "Indeed, the wand makes or breaks the wizard.  However, it is "
               "worthwhile to note that the wand chooses the wizard, and that "
               "your spells will never be as powerful with another wizard's wand.");
    eventForce("emote pauses for a moment, looking you up and down.");
    eventForce("say Now, if you would like me to sell you a wand, just ask!");
    eventForce("smile");
    return 1;
}
int SellWand(object who, string verb, string wand) {
    int cost, onhand;
    if(wand != "me a wand"){
    eventForce("say You want me to sell you a what?");
    return 1;
    }
    cost = 6;
    onhand = who->GetCurrency("galleons");
    if(onhand < cost) {
    eventForce("say It looks like you don't have enough galleons for a wand.");
    eventForce("say A wand costs 6 galleons.  But mind you, you only get the finest wands here!");
    return 1;
    }
    environment(this_object())->eventPrint("Mr. Ollivander gives "+ who->GetName() +" multiple wands to try, without luck. "
                                 "Finally, after about " + random(100) + " tries, " + who->GetName() + " causes "
                                 "gold sparks to shoot out of the wand with a simple wave.", ({who}));
    who->eventPrint("Mr. Ollivander gives you multiple wands to try, without luck.  After about " + random(100)
                   +" different wands, you grasp the next one wearily, but suddenly feel a surge of warmth and "
                    "energy flow through you from the wand.  Smiling to yourself, you give the wand a simple flick, "
                    "causing gold sparks to shoot impressively out of the end.");
    environment(this_object())->eventPrint("Mr. Ollivander says, \"OH! Well done, " + who->GetName() + "!  Well done indeed. "
                                 "Well, here is your wand, take good care of it!\"");
    this_object()->eventGiveWand(who);
    who->AddCurrency("galleons", -cost);
    who->eventPrint("You hand Mr. Ollivander 6 galleons, and he thanks you.");
    return 1;
}
int eventGiveWand(object player) {
    new("/domains/town/weap/carving_knife")->eventMove(this_object());
    if(player && environment(this_object()) == environment(player)) {
eventForce("give wand to "+player->GetName());
    }
    return 1;
}
void init(){
::init();
}

basically, what i want to do is perhaps have a check of the player's inventory to see if they already have a wand, and then stop the selling function... i'm thinking i can use GetInventory for this, but i'm not sure how.  i'm going to maybe try playing around with it when i get home, with something like

Code: [Select]
object *tmp = GetInventory(player);
for(int i = 0, i < sizeof(tmp), i++) {
    if(tmp[i]->GetweaponType = "wand"){
    ** have the guy say something **;
    return 1;
}

ok, the 2nd thing is... i want the wands to be unique to every player, and for only that player... like, to modify the short desc to be "player's wand", and have the player's name in the long desc, as well as randomize the features of the wand, like...

Code: [Select]
string determine_wood();
switch(random(4)){
case 0 : return "holly";
case 1 : return "oak";
case 2 : return "maple";
case 3 : return "walnut";
}
[code]

and have one of those for each attribute, sort of thing, and include those strings in the long desc of the item.  i know an alternative would be to just have multiple wand#.c files, and then maybe do a random() before cloning the wand into the NPC, but that would take up a lot of space and is inefficient, right?  and then i'd still have the issue of making the wand personalized for the player...

so yea :) any help is appreciated!
[/code]

28
Dead Souls Support / Re: verb help, please?
« on: November 07, 2007, 08:25:20 AM »
hooray! thank you guys, all 3 pieces of advice were extremely helpful.

i managed to get the skill working, and then worked on tweaking success rate and damage, and now it seems good to go, except for the fact that it's a spammable spell :P  gotta work on that.

i had to add the semicolon (of course), then i added the direct_ applies into the living.c file, and thennn i changed target-> or caster-> to just the function and (args).  and now it works :)

i wonder if i could use the same initial function (the one that determines success) in other skills so that i don't have to add a new direct_ apply to the living.c file every time i want to code a new skill?  like if i called eventSpell in a different spell and then made that one instance of eventSpell call eventExpelliarmus, for instance?

and now Crat's words of EXPERIMENT come back to me... perhaps i will just try it out :)

29
Dead Souls Support / verb help, please?
« on: November 06, 2007, 01:56:02 PM »
hey guys, so i'm trying to write a new verb, and i'm basing it on backstab...

basically, i don't want it to take up a combat round like backstab does (or like spells do), and i've attributed it to stats and skills that aren't yet in the lib, so i've commented those out for now.  also i tried getting it to work with tigwyk's skill delay code, but that wouldn't work either, so i've commented that bit out.

i've also changed the header file around to match, but still nothing.

here's the code... i get

Code: [Select]
/verbs/players/sectumsempra.c line 157: syntax error
when i try to update it, and when i comment out that last eventPrintDamage section, it turns out ok except whenever i try to use it it says "You can't sectumsempra that." even if it is living... it gives the correct messages for no target and a non-living target, though.

here's sectumsempra.c
Code: [Select]
#include <lib.h>
#include <position.h>
#include "damage_types.h"
#include "include/sectumsempra.h"

inherit LIB_VERB;

static void create() {
    verb::create();
    SetVerb("sectumsempra");
    SetRules("LIV");
    SetErrorMessage("Who do you want to cast that on?");
    SetHelp("Syntax: sectumsempra LIVING\n\n"
      "This dark spell inflicts terrible wounds on your opponent.");
}

mixed can_sectumsempra_liv() {
    if( !environment(this_player()) ) return 0;
    else if( this_player()->GetParalyzed() ) {   
    return "You cannot do anything.";
}
    else return this_player()->CanManipulate();
}

mixed do_sectumsempra_liv(object ob) {
    object env;
   
    if(!(env = environment(this_player()))) return 0;
    if( (int)this_player()->GetPosition() != POSITION_STANDING )
    this_player()->eventStand();
    if(!ob || !present(ob, env)) {
    this_player()->eventPrint("Your target is not here.");
    return 1;
    }
    this_player()->eventPrint("You shout: %^RED%^SECTUMSEMPRA!!%^RESET%^");
    this_player()->eventSpell(this_player(), ob);
    return 1;
}

int eventSpell(object caster, object target) {
    object env;
    float tmp;
    int success;
    object *weapons;
    int numberOfWeapons;
    int i;
    weapons = caster->GetWielded();
   
    if(!caster || !(env = environment(caster))) return 0;
    if(!target || !present(target, env)) {
    caster->eventPrint("Your target is not here.");
    return 1;
    }

   
    //tmp = caster->GetSkillLevel("sectumsempra")*1.5;
    //tmp += caster->GetStatLevel("mindpower")/2.0;
    tmp = caster->GetStatLevel("wisdom")*1.5;
    tmp += caster->GetStatLevel("luck")/2.0;
    tmp += caster->GetStatLevel("intelligence")/1.0;
    tmp += caster->GetStatLevel("agility")/2.0;
    tmp -= target->GetStatLevel("luck")/3.0;
    tmp -= target->GetStatLevel("agility")/3.0;
    tmp *= 1.0;
    if(tmp < 1.0) tmp = 1.0;
    success = to_int(tmp);

   
    //caster->AddSkillPoints("sectumsempra", to_int(success * 3.0));
    //caster->SetSkillDelay(6);
   
    moral_act(caster, target, -30);
   
    if(success < random(50) || !present(target, environment(caster))) {
    caster->eventPrint("%^RED%^" + target->GetName()
    + " dodges your spell!%^RESET%^");
    target->eventPrint("%^RED%^ You leap out of the way of " + caster->GetName() + "'s spell!%^RESET%^");
    environment(caster)->eventPrint("%^RED%^" + target->GetName() + " leaps away from " + caster->GetName() + "'s jet of red light!%^RESET%^",
    ({caster, target}));
    return 1;
    }
   
    caster->eventSectumsempra(caster, target, weapons);
   
    caster->eventExecuteAttack(target);
    return 1;
}

int eventSectumsempra(object caster, object target, object weapon) {
    int damage;
    float x;
    int percentDamage;
    float adjustment;
    string weaponType = weapon->GetWeaponType();
    int numberOfWeapons;
   
    x = weapon->GetClass() * 5.0;
    //x += caster->GetSkillLevel("sectumsempra")/1.0;
    //x += caster->GetStatLevel("mindpower")/2.0;
    x += caster->GetStatLevel("wisdom")/2.0;
    x += caster->GetStatLevel("intelligence")/2.0;
    x += caster->GetStatLevel("luck")/3.0;
    x += random(10);
    if(x < 1.0) x = 0.0;
   
    if(!numberOfWeapons || weaponType != "wand") {
    caster->eventPrint("Where's your wand?!");
    return 1;
    }
   
    damage = (int)target->eventReceiveDamage(caster,
     weapon->GetDamageType(), to_int(x), 0, target->GetTorso());
    if(damage > 0) {
    percentDamage = damage * 100 / target->GetMaxHealthPoints();
    if(percentDamage < 1) percentDamage = 0;
    }
    else percentDamage = 0;
    eventPrintDamage(caster, target, weapon, percentDamage);
    //caster->AddSkillPoints("Sectumsempra", 7 + damage/10);
    return 1;
}

int eventPrintDamage(object caster, object target, object weapon, int percentDamage) {
    string wounds;
    string colour;
   
    if(!percentDamage) {
    caster->eventPrint("%^RED%^Your spell fizzles.%^RESET%^");
    environment(caster)->eventPrint("%^RED%^" + caster->GetName()
    + " shouts, 'SECTUMSEMPRA!!' but nothing happens.%^RESET%^",
    ({caster, target}));
    return 1;
    }
   
    if(percentDamage < 15) {
    wounds = "light scratches ";
    colour = "dim red ";
    }
    else if(percentDamage < 30) {
    wounds = "deep cuts ";
    colour = "red ";
    }
    else {
    wounds = "grevious wounds ";
    colour = "blood red ";
    }
   
    caster->eventPrint("%^RED%^Your "+colour+"jet of light inflicts " + wounds
    + "on "+ target->GetName() +".");
    target->eventPrint("%^RED%^You feel "+ caster->GetName() +"'s jet of " + colour + "light inflicting " + wounds
    + "on your chest.%^RESET%^");
    environment(caster)->eventPrint("%^RED%^" + caster->GetName() + "'s jet of " + colour +"light causes " + wounds
    + "on " + target->GetName() + "'s chest!%^RESET%^", ({caster, target}));
   
    return 1
}

thanks for your time :)

30
Dead Souls Support / Re: body.c
« on: November 02, 2007, 07:13:23 PM »
gah! how did i miss that?!

thanks Crat <3

and yea, i tried using the code tag, but it was too long so the /code got cut off.

Pages: 1 [2] 3