AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   eW | Variable isn't returning function ( switch case ). (https://forums.alliedmods.net/showthread.php?t=221696)

iBrazilian 07-25-2013 07:17

eW | Variable isn't returning function ( switch case ).
 
I've currently got two files, skill.inl which calls the function and bug.inl which the function is currently loaded there.
The issue I'm having is that new SKILL:iSkillReturn isn't returning any values at all, I'm not sure why, I've spend quite some time and I resort to forum helpers.

Do I need to do anything else with SKILL:Absorb(id, skill, prop)?

SKILL.INL:
Code:

#include "bug.inl"

enum
{
    SKILL_1,
    SKILL_2,
};

stock DelayedCallSkill(Float:time, id, skill, prop)
{
    new parm[3];
    parm[0] = id;
    parm[1] = skill;
    parm[2] = prop;
    set_task(time, "task_CallSkill", SKILLCALL_TASK + (skill * MAX_PLAYERS) + id, parm, 3);
}

public task_CallSkill( parm[] ){
    CallSkill( parm[0], parm[1], parm[2] );
}

CallSkill(id, skill, prop)
{
    new SKILL:iSkillReturn;
    switch(skill)
    {
        case SKILL_1:            iSkillReturn = Absorb(id, skill, prop);
        case SKILL_2:            iSkillReturn = Acid(id, skill, prop);
    }
   
    if ( ValidPlayer(id) )
    {   
        switch ( iSkillReturn )
        {
            case SKILL_USED, SKILL_READY:
            {
                if( prop & SI_BIND )
                    bind_used( id, skill );
                else {
                    #if ONE_SKILL_USE == 0
                    parm[0] = id;
                    parm[1] = skill;
                    set_task(0.0, "delayed_bind_used", 0, parm, 2);
                    #else
                    bind_used( id, skill );
                    #endif
                }
            }
        }
    }
    return iSkillReturn;
}

BUG.INL:
Code:

SKILL:Absorb(id, skill, prop)
{
    new victim = PokeSkillTarget(id)

    if( !ValidPlayer(victim) || !Pokemod_Alive(victim) )
        return SKILL_READY;

    new armor = get_user_armor(victim)
    new level = SkillLevel(id, skill)
    new totake = (armor*level)/(TotalLevels+1)

    if(level < armor)
        clamp(totake, level, armor)
    else
        totake = armor

    Pokemod_Repair(id, totake)
    set_user_armor(victim, armor-totake)

    sound_hit(id)
    sound_hit(victim)

    MakeLine_Ent(0,id,victim,SPRITE_INDEX[SPR_ROPE],1,1,10,5,10,0,255,200,255,0)
    return SKILL_USED;
}


UchihaSkills 07-27-2013 13:48

Re: eW | Variable isn't returning function ( switch case ).
 
Wtf is
PHP Code:

 set_task(0.0"delayed_bind_used"0parm2); 

http://www4.pown.it/flash/1681.swf

Black Rose 07-27-2013 18:48

Re: eW | Variable isn't returning function ( switch case ).
 
What's the defenition of SKILL and SKILL_USED?

Now I'm not sure at all about this but since you're returning a "SKILL:" value, I believe the function should be prefixed with SKILL aswell. "SKILL:CallSkill(id, skill, prop)". I don't know if it would cause a problem though. That depends on what SKILL is defined as.

This is what happens when you complicate things that could've been simple.


All times are GMT -4. The time now is 06:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.