1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Some questions about class modding

Discussion in 'Modding Help' started by long_wood_bow, Feb 1, 2017.

  1. long_wood_bow

    long_wood_bow Bison Rider

    Messages:
    84
    I made SpearmanLogic modify KnightLogic. But script error is happen.
    It says likely missing ";" at last"}". But I can't know why. Anyone know why?

    // Spearman logic

    #include "ThrowCommon.as"
    #include "SpearmanCommon.as";
    #include "RunnerCommon.as";
    #include "Hitters.as";
    #include "ShieldCommon.as";
    #include "Knocked.as"
    #include "Help.as";
    #include "Requirements.as"


    //attacks limited to the one time per-actor before reset.

    void spearman_actorlimit_setup(CBlob@ this)
    {
    u16[] networkIDs;
    this.set("LimitedActors", networkIDs);
    }

    bool spearman_has_hit_actor(CBlob@ this, CBlob@ actor)
    {
    u16[]@ networkIDs;
    this.get("LimitedActors", @networkIDs);
    return networkIDs.find(actor.getNetworkID()) >= 0;
    }

    u32 spearman_hit_actor_count(CBlob@ this)
    {
    u16[]@ networkIDs;
    this.get("LimitedActors", @networkIDs);
    return networkIDs.length;
    }

    void spearman_add_actor_limit(CBlob@ this, CBlob@ actor)
    {
    this.push("LimitedActors", actor.getNetworkID());
    }

    void spearman_clear_actor_limits(CBlob@ this)
    {
    this.clear("LimitedActors");
    }

    void onInit(CBlob@ this)
    {
    SpearmanInfo spearman;

    spearman.state = SpearmanStates::normal;
    spearman.spearTimer = 0;
    spearman.doubleslash = false;
    spearman.doublethrow = false;
    spearman.tileDestructionLimiter = 0;

    this.set("spearmanInfo", @spearman);

    //Idea from Archer
    this.set_bool("has_spear", false);
    this.set_f32("gib health", -1.5f);
    spearman_actorlimit_setup(this);
    this.getShape().SetRotationsAllowed(false);
    this.getShape().getConsts().net_threshold_multiplier = 0.5f;
    this.Tag("player");
    this.Tag("flesh");

    //centered on inventory
    this.set_Vec2f("inventory offset", Vec2f(0.0f, 0.0f));

    //Spear melee help
    //SetHelp(this, "help self action", "knight", "$Jab$Jab $LMB$", "", 4);
    //Spear throw help
    //SetHelp(this, "help self action2", "knight", "$Shield$Shield $KEY_HOLD$$RMB$", "", 4);

    this.getCurrentScript().runFlags |= Script::tick_not_attached;
    this.getCurrentScript().removeIfTag = "dead";
    }

    void onSetPlayer(CBlob@ this, CPlayer@ player)
    {
    if (player !is null)
    {
    player.SetScoreboardVars("NewScoreboardIcons.png", 2, Vec2f(16, 16));
    }
    }


    void onTick(CBlob@ this)
    {
    u8 knocked = getKnocked(this);
    bool hasspear = spearman.has_spear;

    if (this.isInInventory())
    return;

    // spear check from ArcherLogic
    if (ismyplayer)
    {
    if ((getGameTime() + this.getNetworkID()) % 10 == 0)
    {
    hasspear = hasSpears(this);

    }

    this.set_bool("has_spear", hasspear);
    this.Sync("has_spear", false);
    }

    //knight logic stuff
    //get the vars to turn various other scripts on/off
    RunnerMoveVars@ moveVars;
    if (!this.get("moveVars", @moveVars))
    {
    return;
    }

    SpearmanInfo@ spearman;
    if (!this.get("spearmanInfo", @spearman))
    {
    return;
    }

    Vec2f pos = this.getPosition();
    Vec2f vel = this.getVelocity();
    Vec2f aimpos = this.getAimPos();
    const bool inair = (!this.isOnGround() && !this.isOnLadder());

    Vec2f vec;

    const int direction = this.getAimDirection(vec);
    const f32 side = (this.isFacingLeft() ? 1.0f : -1.0f);

    bool spearState = isSpearState(spearman.state);
    bool pressed_a1 = this.isKeyPressed(key_action1);
    bool pressed_a2 = this.isKeyPressed(key_action2);
    bool walking = (this.isKeyPressed(key_left) || this.isKeyPressed(key_right));

    const bool myplayer = this.isMyPlayer();

    //with the code about menus and myplayer you can slash-cancel;
    //we'll see if knights dmging stuff while in menus is a real issue and go from there
    if (knocked > 0)// || myplayer && getHUD().hasMenus())
    {
    spearman.state = SpearmanStates::normal; //cancel any attacks or shielding
    spearman.spearTimer = 0;
    spearman.doubleslash = false;
    spearman.doublethrow = false;


    pressed_a1 = false;
    pressed_a2 = false;
    walking = false;

    }
    //Knight has shield script below. Aren't you?
    else if ((pressed_a1 || pressed_a2 || spearState) && !moveVars.wallsliding) //no attacking during a slide
    {
    if (getNet().isClient())
    {
    if (spearman.spearTimer == SpearmanVars::slash_charge_level2)
    {
    Sound::Play("AnimeSword.ogg", pos, myplayer ? 1.3f : 0.7f);
    }
    else if (spearman.spearTimer == SpearmanVars::slash_charge)
    {
    Sound::Play("SwordSheath.ogg", pos, myplayer ? 1.3f : 0.7f);
    }
    }

    if (spearman.spearTimer >= SpearmanVars::slash_charge_limit)
    {
    Sound::Play("/Stun", pos, 1.0f, this.getSexNum() == 0 ? 1.0f : 2.0f);
    SetKnocked(this, 15);
    }

    bool strong = (spearman.spearTimer > SpearmanVars::slash_charge_level2);
    moveVars.jumpFactor *= (strong ? 0.6f : 0.8f);
    moveVars.walkFactor *= (strong ? 0.8f : 0.9f);

    if (!inair)
    {
    this.AddForce(Vec2f(vel.x * -5.0, 0.0f)); //horizontal slowing force (prevents SANICS)
    }

    if (spearman.state == SpearmanStates::normal ||
    this.isKeyJustPressed(key_action1) &&
    (!inMiddleOfAttack(spearman.state)))
    {
    spearman.state = SpearmanStates::spear_drawn;
    spearman.spearTimer = 0;
    }

    //throw drawn. need to separate because of animation when player press left and right.
    if (spearman.state == SpearmanStates::normal ||
    this.isKeyJustPressed(key_action2) &&
    (!inMiddleOfAttack(spearman.state)))
    {
    spearman.state = SpearmanStates::spear_drawn_throw;
    spearman.spearTimer = 0;
    }

    if (spearman.state == SpearmanStates::spear_drawn && getNet().isServer())
    {
    spearman_clear_actor_limits(this);
    }

    //responding to releases/noaction
    s32 delta = spearman.spearTimer;
    if (spearman.spearTimer < 128)
    spearman.spearTimer++;

    if (spearman.state == SpearmanStates::spear_drawn && !pressed_a1 &&
    !this.isKeyJustReleased(key_action1) && delta > SpearmanVars::resheath_time)
    {
    spearman.state = SpearmanStates::normal;
    }
    if (spearman.state == SpearmanStates::spear_drawn_throw && !pressed_a2 &&
    !this.isKeyJustReleased(key_action2) && delta > SpearmanVars::resheath_time)
    {
    spearman.state = SpearmanStates::normal;
    }
    else if (this.isKeyJustReleased(key_action1) && spearman.state == SpearmanStates::spear_drawn)
    {
    spearman.spearTimer = 0;
    //Can I use this as a power attack direction script?
    if (delta < SpearmanVars::slash_charge)
    {
    if (direction == -1)
    {
    spearman.state = SpearmanStates::spear_cut_up;
    }
    else if (direction == 0)
    {
    if (aimpos.y < pos.y)
    {
    spearman.state = SpearmanStates::spear_cut_mid;
    }
    else
    {
    spearman.state = SpearmanStates::spear_cut_mid_down;
    }
    }
    else
    {
    spearman.state = SpearmanStates::spear_cut_down;
    }
    }
    else if (delta < SpearmanVars::slash_charge_level2)
    {
    spearman.state = SpearmanStates::spear_power;//1/29 ここまで
    Vec2f aiming_direction = vel;
    aiming_direction.y *= 2;
    aiming_direction.Normalize();
    spearman.slash_direction = aiming_direction;
    }
    else if (delta < SpearmanVars::slash_charge_limit)
    {
    spearman.state = SpearmanStates::spear_power_super;
    Vec2f aiming_direction = vel;
    aiming_direction.y *= 2;
    aiming_direction.Normalize();
    spearman.slash_direction = aiming_direction;
    }
    else
    {
    //knock?
    }
    }
    //Spear throw
    else if (this.isKeyJustReleased(key_action2) && spearman.state == SpearmanStates::spear_drawn_throw)
    {
    spearman.spearTimer = 0;
    if (delta < SpearmanVars::slash_charge)
    {
    if (direction == -1)
    {
    spearman.state = SpearmanStates::spear_cut_up;
    }
    else if (direction == 0)
    {
    if (aimpos.y < pos.y)
    {
    spearman.state = SpearmanStates::spear_cut_mid;
    }
    else
    {
    spearman.state = SpearmanStates::spear_cut_mid_down;
    }
    }
    else
    {
    spearman.state = SpearmanStates::spear_cut_down;
    }
    }
    else if (delta < SpearmanVars::slash_charge_level2)
    {
    spearman.state = SpearmanStates::spear_throw;
    Vec2f aiming_direction = vel;
    aiming_direction.y *= 2;
    aiming_direction.Normalize();
    spearman.slash_direction = aiming_direction;
    }
    else if (delta < SpearmanVars::slash_charge_limit)
    {
    spearman.state = SpearmanStates::spear_throw_super;
    Vec2f aiming_direction = vel;
    aiming_direction.y *= 2;
    aiming_direction.Normalize();
    spearman.slash_direction = aiming_direction;
    }
    else
    {
    //knock?
    }
    }
    else if (spearman.state >= SpearmanStates::spear_cut_mid &&
    spearman.state <= SpearmanStates::spear_cut_down) // cut state
    {
    if (delta == DELTA_BEGIN_ATTACK)
    {
    Sound::Play("/SwordSlash", this.getPosition());
    }

    if (delta > DELTA_BEGIN_ATTACK && delta < DELTA_END_ATTACK)
    {
    f32 attackarc = 90.0f;
    f32 attackAngle = getCutAngle(this, spearman.state);

    if (spearman.state == SpearmanStates::spear_cut_down)
    {
    attackarc *= 0.9f;
    }

    DoAttack(this, 1.0f, attackAngle, attackarc, Hitters::spear, delta, spearman);
    }
    else if (delta >= 9)
    {
    spearman.spearTimer = 0;
    spearman.state = SpearmanStates::spear_drawn;
    }
    }
    else if (spearman.state == SpearmanStates::spear_power ||
    spearman.state == SpearmanStates::spear_power_super)
    {
    //setting double
    if (spearman.state == SpearmanStates::spear_power_super &&
    this.isKeyJustPressed(key_action1))
    {
    spearman.doubleslash = true;
    }

    //attacking + noises
    if (delta == 2)
    {
    Sound::Play("/ArgLong", this.getPosition());
    Sound::Play("/SwordSlash", this.getPosition());
    }
    else if (delta > DELTA_BEGIN_ATTACK && delta < 10)
    {
    DoAttack(this, 2.0f, -(vec.Angle()), 120.0f, Hitters::spear, delta, spearman);
    }
    else if (delta >= SpearmanVars::slash_time ||
    (spearman.doubleslash && delta >= SpearmanVars::double_slash_time))
    {
    spearman.spearTimer = 0;

    if (spearman.doubleslash)
    {
    spearman_clear_actor_limits(this);
    spearman.doubleslash = false;
    spearman.state = SpearmanStates::spear_power;
    }
    else
    {
    spearman.state = SpearmanStates::spear_drawn;
    }
    }
    }
    else if (spearman.state == SpearmanStates::spear_throw ||
    spearman.state == SpearmanStates::spear_throw_super)
    {
    //setting double
    if (spearman.state == SpearmanStates::spear_throw_super &&
    this.isKeyJustPressed(key_action2))
    {
    spearman.doublethrow = true;
    }

    //noises is in CreateSpear
    if (delta == 2)
    {
    Sound::Play("/ArgLong", this.getPosition());
    }
    else if (delta > DELTA_BEGIN_ATTACK && delta < 10)
    {
    if(!hasspear)
    {
    Sound::Play("Entities/Characters/Sounds/NoAmmo.ogg");
    }

    ClientFire(this, hasspear);

    }
    else if (delta >= SpearmanVars::slash_time ||
    (spearman.doubleslash && delta >= SpearmanVars::double_slash_time))
    {
    spearman.spearTimer = 0;

    if (spearman.doublethrow)
    {
    spearman_clear_actor_limits(this);
    spearman.doublethrow = false;
    spearman.state = SpearmanStates::spear_throw;
    }
    else
    {
    spearman.state = SpearmanStates::spear_drawn;
    }
    }
    }

    //special slash movement

    if ((spearman.state == SpearmanStates::spear_power ||
    spearman.state == SpearmanStates::spear_power_super) &&
    delta < SpearmanVars::slash_move_time)
    {

    if (Maths::Abs(vel.x) < SpearmanVars::slash_move_max_speed &&
    vel.y > -SpearmanVars::slash_move_max_speed)
    {
    Vec2f slash_vel = spearman.slash_direction * this.getMass();//Not x0.5f for Spearman
    this.AddForce(slash_vel);
    }
    }

    moveVars.canVault = false;

    }
    //what is this?
    else if (this.isKeyJustReleased(key_action2) || this.isKeyJustReleased(key_action1) || this.get_u32("spearman_timer") <= getGameTime())
    {
    spearman.state = SpearmanStates::normal;
    }

    //not throwing bombs for spearman

    if (myplayer)
    {
    // help

    if (this.isKeyJustPressed(key_action1) && getGameTime() > 150)
    {
    //SetHelp(this, "help self action", "knight", "$Slash$ Slash! $KEY_HOLD$$LMB$", "", 13);
    }
    }

    //shield script is below

    if (spearState && getNet().isServer())
    {
    spearman_clear_actor_limits(this);
    }
    }

    void onCommand(CBlob@ this, u8 cmd, CBitStream @params)
    {
    //from archerlogic
    if (cmd == this.getCommandID("shoot spear"))
    {
    Vec2f spearPos = params.read_Vec2f();
    Vec2f spearVel = params.read_Vec2f();

    SpearmanInfo@ spearman;
    if (!this.get("spearmanInfo", @spearman))
    {
    return;
    }

    // return to normal arrow - server didnt have this synced
    if (!hasSpears(this))
    {
    return;
    }

    if (getNet().isServer())
    {
    CreateSpear(this, spearPos, spearVel,);
    }

    this.getSprite().PlaySound("Entities/Characters/Knight/SwordSlash.ogg");
    this.TakeBlob("mat_spears", 1);
    }

    //some scripts from ArcherLogic
    void ClientFire(CBlob@ this, const bool hasspear)
    {
    //time to fire!
    if (hasspear && canSend(this)) // client-logic
    {
    ShootSpear(this, this.getPosition() + Vec2f(0.0f, -2.0f), this.getAimPos() + Vec2f(0.0f, -2.0f), SpearmanVars::throw_max_vel);
    }
    }

    void ShootSpear(CBlob @this, Vec2f spearPos, Vec2f aimpos f32 spearspeed)
    {
    if (canSend(this))
    {

    Vec2f spearVel = (aimpos - spearPos);
    spearVel.Normalize();
    spearVel *= spearspeed;
    CBitStream params;
    params.write_Vec2f(spearPos);
    params.write_Vec2f(spearVel);

    this.SendCommand(this.getCommandID("shoot spear"), params);
    }
    }

    // from CreateArrow

    CBlob@ CreateSpear(CBlob@ this, Vec2f spearPos, Vec2f spearVel,)
    {
    CBlob@ spear = server_CreateBlobNoInit("spear");
    if (spear !is null)
    {
    spear.SetDamageOwnerPlayer(this.getPlayer());
    spear.Init();

    spear.IgnoreCollisionWhileOverlapped(this);
    spear.server_setTeamNum(this.getTeamNum());
    spear.setPosition(spearPos);
    spear.setVelocity(spearVel);
    }
    return spear;
    }
     
  2. long_wood_bow

    long_wood_bow Bison Rider

    Messages:
    84
    f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitterBlob, u8 customData)
    {
    // play cling sound if other knight attacked us
    // dmg could be taken out here if we ever want to
    // add this scripts for spearman

    if (hitterBlob.getPosition().x < this.getPosition().x && (hitterBlob.getName() == "knight" || hitterBlob.getName() == "spearman")) // knight and the left one (to play only once)
    {
    CSprite@ sprite = this.getSprite();
    CSprite@ hsprite = hitterBlob.getSprite();

    if (hsprite.isAnimation("strike_power_ready") || hsprite.isAnimation("strike_mid") ||
    hsprite.isAnimation("strike_mid_down") || hsprite.isAnimation("strike_up") ||
    hsprite.isAnimation("strike_down") || hsprite.isAnimation("strike_up"))
    {
    if (sprite.isAnimation("strike_power_ready") || sprite.isAnimation("strike_mid") ||
    sprite.isAnimation("strike_mid_down") || sprite.isAnimation("strike_up") ||
    sprite.isAnimation("strike_down") || sprite.isAnimation("strike_up"))
    {
    this.getSprite().PlaySound("SwordCling");
    }
    }
    }

    return damage; //no block, damage goes through
    }

    /////////////////////////////////////////////////

    bool isJab(f32 damage)
    {
    return damage < 1.5f;
    }

    void DoAttack(CBlob@ this, f32 damage, f32 aimangle, f32 arcdegrees, u8 type, int deltaInt, SpearmanInfo@ info)
    {
    if (!getNet().isServer())
    {
    return;
    }

    if (aimangle < 0.0f)
    {
    aimangle += 360.0f;
    }

    Vec2f blobPos = this.getPosition();
    Vec2f vel = this.getVelocity();
    Vec2f thinghy(1, 0);
    thinghy.RotateBy(aimangle);
    Vec2f pos = blobPos - thinghy * 6.0f + vel + Vec2f(0, -2);
    vel.Normalize();

    f32 attack_distance = Maths::Min(DEFAULT_ATTACK_DISTANCE + Maths::Max(0.0f, 1.75f * this.getShape().vellen * (vel * thinghy)), MAX_ATTACK_DISTANCE);

    f32 radius = this.getRadius();
    CMap@ map = this.getMap();
    bool dontHitMore = false;
    bool dontHitMoreMap = false;
    const bool jab = isJab(damage);

    //get the actual aim angle
    f32 exact_aimangle = (this.getAimPos() - blobPos).Angle();

    // this gathers HitInfo objects which contain blob or tile hit information
    HitInfo@[] hitInfos;
    if (map.getHitInfosFromArc(pos, aimangle, arcdegrees, radius + attack_distance, this, @hitInfos))
    {
    //HitInfo objects are sorted, first come closest hits
    for (uint i = 0; i < hitInfos.length; i++)
    {
    HitInfo@ hi = hitInfos;
    CBlob@ b = hi.blob;
    if (b !is null && !dontHitMore) // blob
    {
    if (b.hasTag("ignore sword")) continue;

    //big things block attacks
    const bool large = b.hasTag("blocks sword") && !b.isAttached() && b.isCollidable();

    if (!canHit(this, b))
    {
    // no TK
    if (large)
    dontHitMore = true;

    continue;
    }

    if (spearman_has_hit_actor(this, b))
    {
    if (large)
    dontHitMore = true;

    continue;
    }

    spearman_add_actor_limit(this, b);
    if (!dontHitMore)
    {
    Vec2f velocity = b.getPosition() - pos;
    this.server_Hit(b, hi.hitpos, velocity, damage, type, true); // server_Hit() is server-side only

    // end hitting if we hit something solid, don't if its flesh
    if (large)
    {
    dontHitMore = true;
    }
    }
    }
    else // hitmap
    if (!dontHitMoreMap && (deltaInt == DELTA_BEGIN_ATTACK + 1))
    {
    bool ground = map.isTileGround(hi.tile);
    bool dirt_stone = map.isTileStone(hi.tile);
    bool gold = map.isTileGold(hi.tile);
    bool wood = map.isTileWood(hi.tile);
    if (ground || wood || dirt_stone || gold)
    {
    Vec2f tpos = map.getTileWorldPosition(hi.tileOffset) + Vec2f(4, 4);
    Vec2f offset = (tpos - blobPos);
    f32 tileangle = offset.Angle();
    f32 dif = Maths::Abs(exact_aimangle - tileangle);
    if (dif > 180)
    dif -= 360;
    if (dif < -180)
    dif += 360;

    dif = Maths::Abs(dif);
    //print("dif: "+dif);

    if (dif < 20.0f)
    {
    //detect corner

    int check_x = -(offset.x > 0 ? -1 : 1);
    int check_y = -(offset.y > 0 ? -1 : 1);
    if (map.isTileSolid(hi.hitpos - Vec2f(map.tilesize * check_x, 0)) &&
    map.isTileSolid(hi.hitpos - Vec2f(0, map.tilesize * check_y)))
    continue;

    bool canhit = true; //default true if not jab
    if (jab) //fake damage
    {
    info.tileDestructionLimiter++;
    canhit = ((info.tileDestructionLimiter % ((wood || dirt_stone) ? 3 : 2)) == 0);
    }
    else //reset fake dmg for next time
    {
    info.tileDestructionLimiter = 0;
    }

    //dont dig through no build zones
    canhit = canhit && map.getSectorAtPosition(tpos, "no build") is null;

    dontHitMoreMap = true;
    if (canhit)
    {
    map.server_DestroyTile(hi.hitpos, 0.1f, this);
    }
    }
    }
    }
    }
    }

    // destroy grass

    if (((aimangle >= 0.0f && aimangle <= 180.0f) || damage > 1.0f) && // aiming down or slash
    (deltaInt == DELTA_BEGIN_ATTACK + 1)) // hit only once
    {
    f32 tilesize = map.tilesize;
    int steps = Maths::Ceil(2 * radius / tilesize);
    int sign = this.isFacingLeft() ? -1 : 1;

    for (int y = 0; y < steps; y++)
    for (int x = 0; x < steps; x++)
    {
    Vec2f tilepos = blobPos + Vec2f(x * tilesize * sign, y * tilesize);
    TileType tile = map.getTile(tilepos).type;

    if (map.isTileGrass(tile))
    {
    map.server_DestroyTile(tilepos, damage, this);

    if (damage <= 1.0f)
    {
    return;
    }
    }
    }
    }
    }

    // no shieldbash for spearman(onCollision)

    //a little push forward
    //where is it used in?

    void pushForward(CBlob@ this, f32 normalForce, f32 pushingForce, f32 verticalForce)
    {
    f32 facing_sign = this.isFacingLeft() ? -1.0f : 1.0f ;
    bool pushing_in_facing_direction =
    (facing_sign < 0.0f && this.isKeyPressed(key_left)) ||
    (facing_sign > 0.0f && this.isKeyPressed(key_right));
    f32 force = normalForce;

    if (pushing_in_facing_direction)
    {
    force = pushingForce;
    }

    this.AddForce(Vec2f(force * facing_sign , verticalForce));
    }

    void onHitBlob(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitBlob, u8 customData)
    {
    SpearmanInfo@ spearman;
    if (!this.get("SpearmanInfo", @spearman))
    {
    return;
    }

    if (customData == Hitters::sword || Hitters::spear &&
    ( //is a jab - note we dont have the dmg in here at the moment :/
    spearman.state == SpearmanStates::spear_cut_mid ||
    spearman.state == SpearmanStates::spear_cut_mid_down ||
    spearman.state == SpearmanStates::spear_cut_up ||
    spearman.state == SpearmanStates::spear_cut_down
    )
    && blockAttack(hitBlob, velocity, 0.0f))
    {
    this.getSprite().PlaySound("/Stun", 1.0f, this.getSexNum() == 0 ? 1.0f : 2.0f);
    SetKnocked(this, 30);
    }

    if (customData == Hitters::shield)
    {
    SetKnocked(hitBlob, 20);
    this.getSprite().PlaySound("/Stun", 1.0f, this.getSexNum() == 0 ? 1.0f : 2.0f);
    }
    }

    // don't need onCreateInventoryMenu
    // do I need onAttach?

    void onAddToInventory(CBlob@ this, CBlob@ blob)
    {
    //need some scripts?
    }

    // don't need SetFirstAvailableBomb

    // Blame Fuzzle.
    bool canHit(CBlob@ this, CBlob@ b)
    {

    if (b.hasTag("invincible"))
    return false;

    // Don't hit temp blobs and items carried by teammates.
    if (b.isAttached())
    {

    CBlob@ carrier = b.getCarriedBlob();

    if (carrier !is null)
    if (carrier.hasTag("player")
    && (this.getTeamNum() == carrier.getTeamNum() || b.hasTag("temp blob")))
    return false;

    }

    if (b.hasTag("dead"))
    return true;

    return b.getTeamNum() != this.getTeamNum();

    }
     
  3. 8x

    8x Elimination Et Choix Traduisant la Realité Forum Moderator Staff Alumni Tester
    1. The Young Blood Collective - [YB]

    Messages:
    1,325
    IIRC that might happen because of a modified INCLUDED script too, making the error report a bit of a lie.
     
  4. long_wood_bow

    long_wood_bow Bison Rider

    Messages:
    84
    Oh sorry, I know why.
    I'm missing"}" in "onCommand".
    --- Double Post Merged, Feb 2, 2017, Original Post Date: Feb 2, 2017 ---
    And now, many problem is happen. But should I make more thread or ask question in this thread?
     
  5. 8x

    8x Elimination Et Choix Traduisant la Realité Forum Moderator Staff Alumni Tester
    1. The Young Blood Collective - [YB]

    Messages:
    1,325
    go on asking your questions here, in the future a forum moderator could change your thread title too to something more generic regarding your mods.
     
  6. ParaLogia

    ParaLogia tired Administrator Global Moderator Forum Moderator Tester Official Server Admin

    Messages:
    1,133
    I don't know if you caught it, but this might be a problem
     
  7. Verrazano

    Verrazano Flat Chested Haggy Old Souless Witchy Witch Witch THD Team Global Moderator Forum Moderator Tester
    1. Practitioners of War Extreme Revolution - POWER

    Messages:
    477
    semi colons on includes are completely optional
     
    Osmal likes this.
  8. long_wood_bow

    long_wood_bow Bison Rider

    Messages:
    84
    I finished to make spearman, but it's too buggy. Always knock when press left or right click, and back spears(like archer's quiver) don't update texture and not rotate 105°.
    But it's because of only lack of study, so I'll fix it without many questions.

    And now I have 3 questions. Sorry if it's written in some manuals.
    First, what script file gives some coins for player that damage the enemies?
    For example, archer get 5 coins when shoot enemy with arrows.
    Second, what script manages resupplies? I want to give resupplies to new classes.
    Last,what script manages kill messages?
     
  9. 8x

    8x Elimination Et Choix Traduisant la Realité Forum Moderator Staff Alumni Tester
    1. The Young Blood Collective - [YB]

    Messages:
    1,325
    The coins thingy, for CTF, is inside a script called CTF_Trading.as /Base/Rules/CTF/Scripts;

    the resupplies should be on each game mode Rules too,
    the 3rd message, no idea
     
  10. long_wood_bow

    long_wood_bow Bison Rider

    Messages:
    84
    Well, thank you everyone.
    Well, can you understand if I say "KillfeedIcons"?
    I want to use my kill icons when my classes kill someone.
     
  11. 8x

    8x Elimination Et Choix Traduisant la Realité Forum Moderator Staff Alumni Tester
    1. The Young Blood Collective - [YB]

    Messages:
    1,325
    I meant I don't know where to find them, I understood it. It should be somewhere on the GUI scripts.
     
  12. long_wood_bow

    long_wood_bow Bison Rider

    Messages:
    84
    Oh, I's so sorry.
    I found a script that I searched. It's "killMessages.as" in Base\Rules\CommonScripts.
    --- Double Post Merged, Feb 5, 2017, Original Post Date: Feb 4, 2017 ---
    Now I trying to fix bugs. So I modifying KnightLogic.
    I add a script that play sound when swordTimer is 0 in line 118(after declare KnightInfo). swordTimer looks be increased only when press left click(line 327 swordTimer++). So I thought sound will be played when press nothing.
    But sound is played only when after plessed right click, start of sword drawn, start and end of attack, and knocked.
    It looks something increase swordTimer when, but It looks to be disturbed by line 300(be knocked when limit of swordTimer).
    Anyone know about it?I understood. swordstate is drawn after sword attack.
    --- Double Post Merged, Feb 5, 2017 ---
    And, I add script to KnightLogic and SpearmanLogic.
    if(knight.doubleslash)//spearman.doubleslash in SpearmanLogic
    {
    knight.doubleslash = false;
    Sound::Play("/SwordSlash", this.getPosition());
    }
    else
    {
    knight.doubleslash = true;
    Sound::Play("/ArgLong", this.getPosition());
    }
    Knight play sounds both of them, but Spearman sounds only SwordSlash. doubleslash is false in onInit. And the value is changed only in onTick if plessed left or right click.
    Why is it happen?