otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.58k stars 1.05k forks source link

Revscript monster does not apply shootEffect #3878

Open Znote opened 2 years ago

Znote commented 2 years ago

Before creating an issue, please ensure:

Steps to reproduce (include any configuration/script required to reproduce)

  1. Create file data/monster/lua/testhunter.lua:

    local mType = Game.createMonsterType("Test hunter")
    local monster = {}
    monster.description = "a Test hunter"
    monster.experience = 150
    monster.outfit = {
    lookType = 129,
    lookHead = 95,
    lookBody = 116,
    lookLegs = 121,
    lookFeet = 115,
    lookAddons = 0,
    lookMount = 0
    }
    monster.raceId = 11
    monster.health = 150
    monster.maxHealth = 150
    monster.race = "blood"
    monster.corpse = 20419
    monster.speed = 210
    monster.manaCost = 530
    monster.maxSummons = 0
    monster.strategiesTarget = {
    nearest = 100,
    }
    monster.flags = {
    summonable = true,
    attackable = true,
    hostile = true,
    convinceable = true,
    pushable = false,
    rewardBoss = false,
    illusionable = true,
    canPushItems = true,
    canPushCreatures = false,
    staticAttackChance = 90,
    targetDistance = 4,
    runHealth = 10,
    healthHidden = false,
    isBlockable = false,
    canWalkOnEnergy = false,
    canWalkOnFire = false,
    canWalkOnPoison = false,
    pet = false
    }
    monster.attacks = {
    {
        name ="combat", 
        interval = 1000, 
        chance = 100, 
        type = COMBAT_PHYSICALDAMAGE, 
        minDamage = -1, 
        maxDamage = -10, 
        range = 7, 
        shootEffect = CONST_ANI_ARROW, 
        target = false
    }
    }
    mType:register(monster)
  2. Login on GM, perform the talkactions/spells: /m test hunter and utevo res "test hunter

  3. Attack the monster spawned with /m

Expected behaviour

The two test creatures should start shooting arrows at each other

Actual behaviour

No shooting effect testhunter

Environment

TFS 1.5 master (27. december), default datapack, Ubuntu 20.04

Cesar525 commented 2 years ago

The effects are showing to me. They probably fixed who knows hunter .

ArturKnopik commented 2 years ago

The effects are showing to me. They probably fixed who knows hunter .

you use monster form xml, Znote test in revscript, bug is here

ArturKnopik commented 2 years ago

@Znote target = false break this

Znote commented 2 years ago

testhunter2

Toggling target to true fixed this indeed. Weird... What does actually the target flag do? I mean it targets the creature when I attack someone anyway? I guess it forces Combat execution variant type 3(position) instead of 1(creature) in the combat? Shouldn't it still perform shootEffect?

EPuncker commented 2 years ago

Shouldn't it still perform shootEffect?

if there is no target, there is no "need" for a shootEffect to be executed, because the code was made to be executed on self and not on target

IMO we should give a warning to any combat that uses range but sets target to false, to prevent this.