mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-20 17:44:05 +00:00
fixed weapRange for creatures/startcombat script(?)
This commit is contained in:
parent
a11a6b616b
commit
df4df5b094
2 changed files with 12 additions and 2 deletions
|
@ -151,6 +151,11 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
weapRange *= 100.0f;
|
weapRange *= 100.0f;
|
||||||
}
|
}
|
||||||
|
else //is creature
|
||||||
|
{
|
||||||
|
weaptype = WeapType_HandToHand; //doesn't matter, should only reflect if it is melee or distant weapon
|
||||||
|
weapRange = 100; //TODO: use true attack range (the same problem in Creature::hit)
|
||||||
|
}
|
||||||
|
|
||||||
//MWWorld::Class::get(actor).getCreatureStats(actor).setAttackingOrSpell(false);
|
//MWWorld::Class::get(actor).getCreatureStats(actor).setAttackingOrSpell(false);
|
||||||
|
|
||||||
|
@ -381,6 +386,7 @@ void chooseBestAttack(const ESM::Weapon* weapon, MWMechanics::Movement &movement
|
||||||
|
|
||||||
if (weapon == NULL)
|
if (weapon == NULL)
|
||||||
{
|
{
|
||||||
|
//hand-to-hand and creatures' attacks handled here
|
||||||
//hand-to-hand deals equal damage
|
//hand-to-hand deals equal damage
|
||||||
float roll = static_cast<float>(rand())/RAND_MAX;
|
float roll = static_cast<float>(rand())/RAND_MAX;
|
||||||
if(roll <= 0.333f) //side punch
|
if(roll <= 0.333f) //side punch
|
||||||
|
|
|
@ -435,10 +435,14 @@ namespace MWScript
|
||||||
std::string actorID = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string actorID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(actor).getCreatureStats(actor);
|
MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor);
|
||||||
creatureStats.getAiSequence().stack(MWMechanics::AiCombat(actor));
|
|
||||||
if (actorID == "player")
|
if (actorID == "player")
|
||||||
|
{
|
||||||
creatureStats.setHostile(true);
|
creatureStats.setHostile(true);
|
||||||
|
creatureStats.getAiSequence().stack(
|
||||||
|
MWMechanics::AiCombat(MWBase::Environment::get().getWorld()->getPtr(actorID,true)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue