Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4273324
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:41:51+00:00 2026-05-21T07:41:51+00:00

struct stVitals // Entity vitals { int str; int xp; int batk; }; int

  • 0
struct stVitals                       // Entity vitals
{
    int str;
    int xp;
    int batk;
};

int doAttack(stVitals Aggressor, stVitals Defender)    // Calculate attack results
{
    doHit(getATK(Aggressor), getDEF(Defender), getDDG(Defender), getLVL(Aggressor), getLVL(Defender));
}

int doHit([...]                       // Calculate damage

int getATK(stVitals sourcemob)        // Calculate attack value
{
    int output = ((sourcemob.str * getLVL(sourcemob.xp)) * 0.1) + sourcemob.batk;
    return output;
}

int getLVL(int xp)                    // Return level from XP
{
    return (xp * 0.001);
}

Gives the following error:

ERROR: Conversion from 'int' to non-scalar type 'stVitals' requested

I work with ints within various stVital instances all around my program in this manner with no problems… what’s going on here that I’m missing?

edit: It is hollering about the first line inside of getATK

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:41:52+00:00Added an answer on May 21, 2026 at 7:41 am

    What’s missing here is the code in which you call getATK. Presumably, you’re incorrectly passing an int argument rather than an stVitals argument when you call that function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

struct str { uint8_t *data; }; int main() { struct str *buffer; free(buffer->data); }
struct elem { int i; char k; }; elem user; // compile error! struct
struct TimerEvent { event Event; timeval TimeOut; static void HandleTimer(int Fd, short Event, void
struct { char a; int b; } x; Why would one define a struct
struct SomeStruct { int a; int b; }; SomeStruct someFn( int init ) {
struct Div { int i; int j; }; class A { public: A(); Div&
struct struct0 { int a; }; struct struct1 { struct struct0 structure0; int b;
struct Drink { public string Name { get; private set; } public int Popularity
struct Record_node* Sequential_search(struct Record_node *List, int target) { struct Record_node *cur; cur = List->head
struct person { int age; char name[100]; struct person *next; }; void delfirst(struct person

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.