System is not recognizing individual actor IDs.

Status
Not open for further replies.

Stucco42

Villager
Member
Joined
Dec 18, 2013
Messages
7
Reaction score
0
First Language
English
Primarily Uses
Hello;

I'm using a modified version of Yanfly Engine Ace - Ace Status Menu v1.02, in which i'm trying to change the properties section which display hit rate and other data for one that displays variable numbers on a character by character basis. The section i'm modifying looks like this at the moment (I cut out all the redundant copies, because i just want to get the base script functioning before i paste it a bunch of times.)

  def draw_property(property, dx, dy, dw)

    fmt = "%1.2f%%"

    case property[0]

    #---

    when :hit

      if @actor=$data_actors[1]

         value = $game_variables[1]

       else value = $game_variables[21]

         end

    #---

    else; return dy

    end

    colour = Color.new(0, 0, 0, translucent_alpha/2)

    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)

    contents.fill_rect(rect, colour)

    change_color(system_color)

    draw_text(dx+4, dy, dw-8, line_height, property[1], 0)

    change_color(normal_color)

    draw_text(dx+4, dy, dw-8, line_height, value, 2)

    return dy + line_height

  end

 

The script runs without error, but it shows all characters as meeting the criteria for displaying variable 1. How do i make a script differentiate between actor IDs?

  

 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
= is assignment, so by saying @actor = $data_actors[1], you're SETTING @actor to $data_actors[1], and that's always going to make the if true. THIS is why everyone is showing variable 1. Instead, you should say this: if @actor.id == 1 (== is comparison).


Next time you need help with a script and you have a snippet to post, put your code into code tags, which makes it much easier to read. :)
 

Stucco42

Villager
Member
Joined
Dec 18, 2013
Messages
7
Reaction score
0
First Language
English
Primarily Uses
Utter perfection. Thank you! I expected nothing less from a blue squirrel n_n

Also, how do i put a snippet in a code tag?  I apologize for being new.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Also, how do i put a snippet in a code tag?  I apologize for being new.
You write the opening code tag at the beginning and the closing code tag after the script.The dot inside the following lines needs to be removed, because if I write the correct tags, they would vanish and be replaced by the code frame.

[co.de]

write code here

[/co.de]

will turn into

Code:
write code here
if you write it without the dots.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
If you use the full (GUI) editor, there's also a code button that you can use to create the opening/closing tags.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top