• ✨ ARCHIVE MODE ✨
    The forum has now been set to read-only mode, no new posts, resources, replies etc will not be possible.
    We recommend you join our Discord server to get real-time response: Discord Invite Link

its not very efective... but it failed

Status
Not open for further replies.

snoe

Active Member
Dream eater should only activate if a user is asleep.
Since this isnt the case it seems to be trying to do damage anyways
and because of that will only do minimal damage.

DracoHouston
What do you make of this
 

DracoHouston

Kolben Developer
Contributor
Dream eater should only activate if a user is asleep.
Since this isnt the case it seems to be trying to do damage anyways
and because of that will only do minimal damage.

DracoHouston
What do you make of this
iunno nils probably didnt fix something? the script i wrote works perfectly with the code i gave him weeks ago
 

snoe

Active Member
Dream eater should only activate if a user is asleep.
Since this isnt the case it seems to be trying to do damage anyways
and because of that will only do minimal damage.

DracoHouston
What do you make of this
iunno nils probably didnt fix something? the script i wrote works perfectly with the code i gave him weeks ago
Code:
SetAttackBaseDamage(138,100)
SetAttackMaxPP(138,15)
SetAttackCategory(138,1)
SetAttackContestCategory(138,1)
SetAttackType(138,13)
SetAttackPriority(138,0)
SetAttackAccuracy(138,255)
SetAttackAttackCategory(138, 2)
SetAttackSpecialAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL")
SetAttackPreAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK")
would the probelm be the seperate attackcatergory's?
 

DracoHouston

Kolben Developer
Contributor
iunno nils probably didnt fix something? the script i wrote works perfectly with the code i gave him weeks ago
Code:
SetAttackBaseDamage(138,100)
SetAttackMaxPP(138,15)
SetAttackCategory(138,1)
SetAttackContestCategory(138,1)
SetAttackType(138,13)
SetAttackPriority(138,0)
SetAttackAccuracy(138,255)
SetAttackAttackCategory(138, 2)
SetAttackSpecialAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL")
SetAttackPreAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK")
would the probelm be the seperate attackcatergory's?
no, that is special category, specialdamage attack category. the problem is preattack either isnt happening, the function that checks status effect isn't working, or absolute damage isn't working. the pre attack checks for target for sleep, if the target is not asleep it sets the store string to 0 or 1, it also sets absolute damage to 0 if the target is not asleep, sets it to -1 if it is (-1 means no absolute damage, calculate damage off power, STAB, type, etc)
 

snoe

Active Member
Code:
function ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK()
    -- we set the absolute damage and store to tell the battle and special how this check turned out
    if Attacks_GetTargetStatusEffect("target") ~= "asleep" then
        Attacks_SetStore("0")
        -- make it do no damage but still attack, so special attack can trigger
        Attacks_SetAbsoluteDamage(0)
    else
        -- if absolute damage is set to -1 it goes back to calculating based on type, STAB, crit, power etc
        Attacks_SetAbsoluteDamage(-1)
        Attacks_SetStore("1")
    end
end
isnt it supposed to be = = not ~=

or

should the SetStore("1")
come before the SetAbsoluteDamage
 

DracoHouston

Kolben Developer
Contributor
Code:
function ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK()
    -- we set the absolute damage and store to tell the battle and special how this check turned out
    if Attacks_GetTargetStatusEffect("target") ~= "asleep" then
        Attacks_SetStore("0")
        -- make it do no damage but still attack, so special attack can trigger
        Attacks_SetAbsoluteDamage(0)
    else
        -- if absolute damage is set to -1 it goes back to calculating based on type, STAB, crit, power etc
        Attacks_SetAbsoluteDamage(-1)
        Attacks_SetStore("1")
    end
end
isnt it supposed to be = = not ~=

or

should the SetStore("1")
come before the SetAbsoluteDamage
those would make no difference. ~= means 'not equal' in LUA, <> in BASIC and != in most other things
 

snoe

Active Member
Code:
function ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK()
    -- we set the absolute damage and store to tell the battle and special how this check turned out
    if Attacks_GetTargetStatusEffect("target") ~= "asleep" then
        Attacks_SetStore("0")
        -- make it do no damage but still attack, so special attack can trigger
        Attacks_SetAbsoluteDamage(0)
    else
        -- if absolute damage is set to -1 it goes back to calculating based on type, STAB, crit, power etc
        Attacks_SetAbsoluteDamage(-1)
        Attacks_SetStore("1")
    end
end
isnt it supposed to be = = not ~=

or

should the SetStore("1")
come before the SetAbsoluteDamage
those would make no difference. ~= means 'not equal' in LUA, <> in BASIC and != in most other things
Code:
SetAttackBaseDamage(138,100)
SetAttackMaxPP(138,15)
SetAttackCategory(138,1)
SetAttackContestCategory(138,1)
SetAttackType(138,13)
SetAttackPriority(138,0)
SetAttackAccuracy(138,255)
SetAttackAttackCategory(138, 2)
SetAttackSpecialAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL")
SetAttackPreAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK")
shouldnt pre attack come before the special?
 

DracoHouston

Kolben Developer
Contributor
those would make no difference. ~= means 'not equal' in LUA, <> in BASIC and != in most other things
Code:
SetAttackBaseDamage(138,100)
SetAttackMaxPP(138,15)
SetAttackCategory(138,1)
SetAttackContestCategory(138,1)
SetAttackType(138,13)
SetAttackPriority(138,0)
SetAttackAccuracy(138,255)
SetAttackAttackCategory(138, 2)
SetAttackSpecialAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL")
SetAttackPreAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK")
shouldnt pre attack come before the special?
no difference, it could go anywhere
 

snoe

Active Member
Code:
SetAttackBaseDamage(138,100)
SetAttackMaxPP(138,15)
SetAttackCategory(138,1)
SetAttackContestCategory(138,1)
SetAttackType(138,13)
SetAttackPriority(138,0)
SetAttackAccuracy(138,255)
SetAttackAttackCategory(138, 2)
SetAttackSpecialAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL")
SetAttackPreAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK")
shouldnt pre attack come before the special?
no difference, it could go anywhere
gahhhhhh! i want to learn how to pick up on these things so i can better help people.
please just show me where it goes wrong and why

Code:
SetAttackBaseDamage(138,100)
SetAttackMaxPP(138,15)
SetAttackCategory(138,1)
SetAttackContestCategory(138,1)
SetAttackType(138,13)
SetAttackPriority(138,0)
SetAttackAccuracy(138,255)
SetAttackAttackCategory(138, 2)
SetAttackSpecialAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL")
SetAttackPreAttackDelegate(138, "ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK")
 
function ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK()
    -- we set the absolute damage and store to tell the battle and special how this check turned out
    if Attacks_GetTargetStatusEffect("target") ~= "asleep" then
        Attacks_SetStore("0")
        -- make it do no damage but still attack, so special attack can trigger
        Attacks_SetAbsoluteDamage(0)
    else
        -- if absolute damage is set to -1 it goes back to calculating based on type, STAB, crit, power etc
        Attacks_SetAbsoluteDamage(-1)
        Attacks_SetStore("1")
    end
end
 
function ATTACKS_PSYCHIC_DREAM_EATER_SPECIAL()
    if Attacks_Store == "1" then
        --the target was asleep, drain
        local restore = math.floor(Attacks_DamageDealt / 2)
        if restore <= 0 then
            restore = 1
        end
        Attacks_AddBattleStep("GainHP", Attacks_TargetString .. "|" .. tostring(restore))
        Attacks_AddBattleStep("Message", Attacks_PrimaryTargetName .. " dream was eaten!")
    else
        --the target is awake, do nothing. it also would not have done damage
        Attacks_AddBattleStep("Message", "But it failed...")
    end
end
 

DracoHouston

Kolben Developer
Contributor
Code:
function ATTACKS_PSYCHIC_DREAM_EATER_PRE_ATTACK()
--THIS IF MIGHT NOT BE WORKING
 -- we set the absolute damage and store to tell the battle and special how this check turned out
    if Attacks_GetTargetStatusEffect("target") ~= "asleep" then
--THIS SEEMS TO WORK I THINK
 Attacks_SetStore("0")
        -- make it do no damage but still attack, so special attack can trigger
--THIS MIGHT NOT BE WORKING
 Attacks_SetAbsoluteDamage(0)
    else
        -- if absolute damage is set to -1 it goes back to calculating based on type, STAB, crit, power etc
        Attacks_SetAbsoluteDamage(-1)
        Attacks_SetStore("1")
    end
end
 

leeloozete

Active Member
Trusted Support
ok its just a minor bug dont fight no kay?
lolololololololo
but it shouldnt giv damage and it should appear just "But it failed..."
not "its not very efective" am i right?
 

DracoHouston

Kolben Developer
Contributor
snoe nils finally got me a copy of his current code and pre attack is being fed the wrong target string, this makes dream eater check the user for sleep. does not explain why it is doing damage, will keep looking
 

DracoHouston

Kolben Developer
Contributor
we used to have a function that did the player's strike then the ai opponent's strike, with slightly different code, this was merged into a single function that just executes a move, (ai and input related stuff went elsewhere). this function knows both the target string for the target, and the user, pre attack is being fed the user, but this means theres a nice way for me to give a scripter the user's target string instead of just inverting the target string. will make it easier to keep the attacks working when double battles are brought in. if i make any changes to the api i'll try and get it into the patch notes
 

DracoHouston

Kolben Developer
Contributor
the damage being done (1) is actually not related to the script at all
Code:
If target0 = "0" Then
                    If IsTrainerBattle = False And Basic.Player.DifficultyMode = 0 Then
                        damage += 1
                    End If
                Else
                    If IsTrainerBattle = False And Basic.Player.DifficultyMode = 0 Then
                        damage -= 1
                    End If
                End If
this happens after damage is calculated, on easy even 0 damage becomes 1. i will make sure it checks to see if the attack is being forced to do no damage by the script.

the rest of the script is working fine, it does not regen unless the preattack says it should, and in 0.29 it never will, because YOU have to be asleep for it to work and if you are you can't use it. i'll get nils to fix up that bad function call and add some checks for absolute damage to stop that stuff doing 1 damage and triggering other messages
 
Status
Not open for further replies.
Top