Raised This Month: $51 Target: $400
 12% 

eW | Variable isn't returning function ( switch case ).


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iBrazilian
Senior Member
Join Date: May 2011
Old 07-25-2013 , 07:17   eW | Variable isn't returning function ( switch case ).
Reply With Quote #1

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;
}
__________________
Pokemod Season 5 [ |||||||||| Complete]

Last edited by iBrazilian; 07-25-2013 at 07:31.
iBrazilian is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-27-2013 , 13:48   Re: eW | Variable isn't returning function ( switch case ).
Reply With Quote #2

Wtf is
PHP Code:
 set_task(0.0"delayed_bind_used"0parm2); 
http://www4.pown.it/flash/1681.swf

Last edited by UchihaSkills; 07-27-2013 at 14:16.
UchihaSkills is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-27-2013 , 18:48   Re: eW | Variable isn't returning function ( switch case ).
Reply With Quote #3

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.
__________________

Last edited by Black Rose; 07-27-2013 at 18:50.
Black Rose is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:23.


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