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 - Kewoxxen

Pages: [1]
1
Newbie Help (Start Here) / Re: Mental Stamina & Mining
« on: May 26, 2006, 01:22:14 pm »
i highly doubt the area where you mine dictates the odds of your success, its just a roll of the dice.
so here is the part of the source code that determines your luck of finding ore. However i am not sure, that it is the very latest code used in the recent release, but as it appear luck depends on
skill, item quality (which tool you use), and the distance from the center of recource (so the place actually matters)
Good luck

 float roll = psserver->rng->Get();

    // Calculate factor for skill
    float f1 = event->dependency->GetCharacterData()->GetBaseSkill((PSSKILL)event->nr->skill->id);
    f1 /= event->nr->skill_level;

    // Calculate factor for item quality
    float f2 = event->dependency->GetCharacterData()->GetItemInSlot(PSCHARACTER_SLOT_RIGHTHAND)->GetItemQuality();
    f2 /= event->nr->item_quality;

    // Calculate factor for distance from center of resource
    csVector3 diff = event->nr->loc - event->position;
    float dist = diff.Norm();
    float f3 = 1 - (dist / event->nr->radius);

    printf("Probability:     %1.3f\n",event->nr->probability);
    printf("Skill Factor:    %1.3f\n",f1);
    printf("Quality Factor:  %1.3f\n",f2);
    printf("Distance Factor: %1.3f\n",f3);
    printf("Total Factor:    %1.3f\n",event->nr->probability * f1 * f2 * f3);
    printf("Roll:            %1.3f\n",roll);

    if (roll < event->nr->probability * f1 * f2 * f3)  // successful!

Pages: [1]