[ACE] Script Help?

heyo!

Someone awhile back posted a pretty nice f2u script for making screen tints affect the player/events/followers, however, it seems like it's broken or I'm simply doing something wrong! I'm unfamiliar with scripting fully myself, so I'm hoping someone on here will be able to let me know if this is beyond help or is a simple fix;

KRaNi3L.png


this seems to be the main error message I'm getting out of this(ablight messy) script:

Code:
class Game_CharacterBase alias shaz_vp_init_private_members init_private_members def init_private_members shaz_vp_init_private_members @viewport = 1 end def set_viewport(value=1) @viewport = value if value.between?(1,3) end def viewport @viewport ? @viewport : 1 endendclass Spriteset_Map alias shaz_vp_update_characters update_characters def update_characters shaz_vp_update_characters @character_sprites.each {|sprite| sprite.viewport = [@viewport1, @viewport2, @viewport3][sprite.character.viewport - 1] } endend
​
It's suppose to act upon a script call event, an event id dictating where the screentint is(?) I believe, and what viewport(i.e player etc) to apply it to(?)

edit: here's also the script call meant to enable the script itself:
Code:
$game_map.event[2].set_viewport(1)

thanks for any help on this!

I've moved this thread to RGSSx Script Support. Thank you.

The script formatting is messed, guess that happened when they changed the site's forum system.
Seen other scripts messed like that too. I edited it so it works.
Spoiler: Script
Code:
class Game_CharacterBase
  alias shaz_vp_init_private_members init_private_members
 
  def init_private_members
    shaz_vp_init_private_members
    @viewport = 1
  end
 
  def set_viewport(value=1)
    @viewport = value if value.between?(1,3)
  end
 
  def viewport
    @viewport ? @viewport : 1
  end
end

class Spriteset_Map
  alias shaz_vp_update_characters update_characters
 
  def update_characters
    shaz_vp_update_characters
    @character_sprites.each {|sprite| sprite.viewport = [@viewport1, @viewport2, @viewport3][sprite.character.viewport - 1] }
  end
 
end
What I saw it does is that a event character remains unafected by the screen's tint. But you must set that character to viewport 2 or viewport 3. Use one of those script calls:
$game_map.events[2].set_viewport(2)
$game_map.events[2].set_viewport(3)
Any other value would be as if you set it to 1 - the sptires visibility gonna be affected by the screen's tint.

Edit: fixed the script calls. Didn't looked carefully too when wrote here, sorry about it.
all of that looks fantastic, thank you! I threw the script in and ran the game with that baby in no problem, however, as soon as I put an event down for the script call, this occurred:

yXNB7gj.png


I just copied the very first call into it, put it as parallel on the map in question so it'll run, but I'm 99% sure this isn't the script being funky but possibly my own mistake. 😔
Please show your script call. Game_Interpreter line 1411 is the script call, and it's saying you've done something incorrect in the call.

You didn't do $game_map.event(...) instead of $game_map.event[...] did you?
Spoiler
8UKn9yw.png

This is an exact copy&paste from above. I also tried changing the trigger and that didn't change anything, unfortunately.
I don't think it's coming from that event. The error message is saying it's looking for a method called event for the game map, which means somewhere, you have a script call that does $game_map.event(). Do you have any others with script calls on that same map (or it could be a common event)?

Also, you want to do an Erase Event after that command - parallel processes repeat, and you don't need it changing the event to use viewport 2 on every frame.
hm, odd. The only other script call I actively use is for character dynamic shadows, but it doesn't use the $game_map.event() call:

Spoiler
ie5dCl2.png

Could this still be the one causing the issue? I can probably live without the shadow script on this map in particular, though in others it may become more iffy if there's conflicts. These would be the only two scripts I use that utilize calls, so it's rather odd.
You don't use "event", but instead go use "events" with s 😛
You don't use "event", but instead go use "events" with s

oops - yep, that's right. $game_map.events[2].

wonder why it thought it was a method when it has [] instead of ()
wonder why it thought it was a method when it has [] instead of ()
attr_reader :events is indeed a method. Basically, anything after the dot is considered as a method.
The content is
Code:
def events
  return @events
end
So it's a method that returns a hash, so you could technically write this
Code:
$game_map.events()[id]
But the () part is unnecessary that you could omit it.
As soon as you first replied with events, I tested out, and it seems to be working perfectly! thank you guys sm! 😊

Original thread: https://forums.rpgmakerweb.com/threads/ace-script-help.101950/