Author Topic: [XP] Heretic's Collection of Art and 100% Compatible Scripts  (Read 43117 times)

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #120 on: January 14, 2018, 11:45:11 PM »
If it is that important to him, I'll work on fixing it.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Jaiden

  • Awakened Visionist
  • **
  • Posts: 82
  • LV: 4
  • Gender: Female
  • Local Karen
    • View Profile
    • Legends of Astravia
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #121 on: February 17, 2018, 09:07:08 PM »
Awesome stuff Heretic, I've been using a majority of your scripts from this bundle in my project so far and love them.

Just a heads up, it seems there is a bug when trying to position a message window over an enemy, I was getting "can't convert Fixnum into String" on line 1489, since it was checking for "abcd" first. Looks like a line in the def reposition method:
Code: [Select]
 
def reposition
    if $game_temp.in_battle
      if "abcd".include?(@float_id) # must be between a and d
        @float_id = @float_id[0] - 97 # a = 0, b = 1, c = 2, d = 3
        if $scene.spriteset.actor_sprites[@float_id] == nil
          @tail.visible = false
          return
        end
        sprite = $scene.spriteset.actor_sprites[@float_id]
      else
        @float_id -= 1 # account for, e.g., player entering 1 for index 0
        if $scene.spriteset.enemy_sprites[@float_id] == nil
          @tail.visible = false
          return
        end
        sprite = $scene.spriteset.enemy_sprites[@float_id]
      end
#def reposition continues below...

The fix was to replace the line:
Code: [Select]
if "abcd".include?(@float_id) # must be between a and d
with:
Code: [Select]
if "abcd".include?(@float_id.to_s) # must be between a and d
« Last Edit: January 23, 2019, 10:16:30 PM by Jaiden »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #122 on: February 27, 2018, 04:54:49 AM »
Im glad you got it figured out.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline mobiusclimber

  • Trained Member
  • *
  • Posts: 14
  • LV: 0
  • Mayor of Roron
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #123 on: May 21, 2018, 09:31:53 PM »
I found a bug in the demo. On the Cat_To_Player map (the one about followers and orienting characters when moving between maps, and pathfinder), when I talked to the kid who wanted me to help him find his momma, he doesn't follow me and I could go to the map to the left and talk to people (who said things like "I wanna go to the cave, but you already have a follower"). When I went back to the other map and talked to people, they all said and did their stuff. The professor looking person showed the orient caterpillar thing, but I had no one following me so it didn't really make sense ( I mean, it did, I knew what the effect was, but I couldn't see it cuz no one was following me). After that, I could not walk off to other maps bc a message would pop up saying I can't leave without my party. When I tried to talk to the boy again, he didn't say anything. So I was just stuck on that small map.

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #124 on: November 13, 2018, 03:57:29 PM »
Much thanks Heretic86! I appreciate the effort you put into this awesome collection. Definitely going to use the Dynamic Lighting in my game.

One question: is there a way to make Dynamic Lighting work in conjunction with Super Event Sensor?

Namely, standing in the light should make you easier to spot in the dark. I can't make it work with "in_light?" (switching pages will reset move route), nor does SES have options like lit_range.
« Last Edit: November 13, 2018, 04:04:13 PM by Helios »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #125 on: November 13, 2018, 11:31:17 PM »
Yes, you can make Dynamic Lighting an Super Event Sensor work together!

Keep in mind that the "magic" behind Super Event Sensor really is only a ultra fancy way of changing Event Pages, there are other scripts that you can use to do that too, to achieve your Sensor Light goal!

The simplest form of a Sensor is this:
Code: [Select]
Sensor_Config
range=3

To make just the Sensor there work, put a check in Self Switch D (by default).  Keep in mind this is WITHOUT LIGHTING.

Now, to add Light Detection, I wrote another seemingly unrelated script called Unlimited Page Conditions.  This allows you to use SCRIPTS or CODE for ANY CONDITION.  It is mostly intended for those with some familiarity with scripting.  Thus, you are no longer limited to Switches or Variables, but quite literally any code you can write!  So if you wanted a Page Condition to be Player X at exactly one coordinate, you can write it out as this:
Code: [Select]
Condition: $game_player.x == 12
I did have the foresight to put some Light Detection into the Dynamic Lighting code.  It also appears I lacked the foresight to Document the method I wrote specifically for it!  All Characters (Player and Event) have a method to check to see if they are Illuminated by running the method "in_light?(Event_ID, Tolerance)".

Code: [Select]
  #--------------------------------------------------------------------------
  # * In Light? - Game_Character
  #  - Returns true when Character's Center is in a Light
  #          arg : can be an Event ID (or 0 for Player), Character, or nil
  #    tolerance : Percent to Add so Light registers as false if in tolerance
  #--------------------------------------------------------------------------

To make the code for "in_light?" work with Super Event Sensor, make sure you also have Unlimited Page Conditions too!  It is in the Collection.  That script was not gone over very heavily, but in hindsight, I probably should have given it more focus as it is Extremely Powerful.  So, the trick here is to add "in_light?" as a Page Condition, as well as Sensor Switches!

Code: [Select]
Comment: Condition: in_light?(0,0)
The "in_light?(Id, Tolerance)" code can be used either as "Condition: $game_player.in_light?" or "Condition: in_light?(0, 10)".  First argument is an Event ID.  You can use the number 0 for Game Player, since Events start at 1.  The Tolerance is also useful for decreasing the In Light Sensitivity, which is due to the fact we dont use pitch black very often.  The higher the Tolerance, the LESS SENSITIVE the Light Detection will be.

To make this all work, the Page Setup will be that of a standard Sensor.  To keep it simple, lets assume one Non Moving Sensor Guard.  Remember, simple, so just the Range and he can "see" or "hear" anything in his range.  Also remember, Sensor Configs go on Page 1 no matter what, and the Comment Conditions go ONLY on the page you want a New Condition for.

Event Page 1:
Code: [Select]
Comment: Sensor_Config
range=4

Now, if you recall, the ORDER that pages are checked in is RIGHT TO LEFT.  The pages that should be active when the Player triggers them go all the way to the RIGHT, and default states should be on the LEFT.  Page 1 has Sensor_Config and is the default state that just stands there.  Page 2 is the "Attack the Player" page.  Set Move Route to Approach, so it will approach the player.  Make the Page 2 Condition Self Switch to D, which is the default.  Then make a comment also on Page 2, and say either "Condition: $game_player.in_light?(0,0)" or "Condition: in_light(0,0)".  Only use one, but both code will check to see if the player is illuminated.

=============================

tl;dr

Use this script (check to see if it is already in your scripts tho):

(click to show/hide)

Next, simply edit your Sensor Event, go to the "Attack" page, or what ever page you want or how its labeled, and put a Comment that says "Condition: in_light?(0, 0)" and that page will ONLY come on if the Player is illuminated! 
« Last Edit: November 13, 2018, 11:36:31 PM by Heretic86 »
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #126 on: November 14, 2018, 03:04:45 AM »
Thanks for your very detailed reply, Heretic86! I probably should describe my problem in more detail.

What I envisioned is something like a third "layer" of range for SES, like the listen range which is different fron view range. The "lit range" would be longer than the view range, but only active if "in light".

Because the guard should be able to see you, in light or not. In light simply makes you easier to be seen. With the method you described ("in_light?" as a second condition), it means unless you are in light, the guard can't see you at all, even if you are hugging him in the face!

Come to think of it, maybe I could use a conical light to mark the vision range of guards, giving player a visual reference of their actual view range, a feature which I believe scripts like SES really should have.

Edit: Ah, I get it. The solution is to make the guard have longer view range than his own light range, so if the player is outside of his own light but in other enviromental lights, they would be seen too. Thanks again Heretic86! You are great! :clap:
« Last Edit: November 14, 2018, 03:12:06 AM by Helios »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #127 on: November 14, 2018, 09:47:59 AM »
Thanks for your very detailed reply, Heretic86! I probably should describe my problem in more detail.

What I envisioned is something like a third "layer" of range for SES, like the listen range which is different fron view range. The "lit range" would be longer than the view range, but only active if "in light".

Because the guard should be able to see you, in light or not. In light simply makes you easier to be seen. With the method you described ("in_light?" as a second condition), it means unless you are in light, the guard can't see you at all, even if you are hugging him in the face!

Come to think of it, maybe I could use a conical light to mark the vision range of guards, giving player a visual reference of their actual view range, a feature which I believe scripts like SES really should have.

Edit: Ah, I get it. The solution is to make the guard have longer view range than his own light range, so if the player is outside of his own light but in other enviromental lights, they would be seen too. Thanks again Heretic86! You are great! :clap:

Thanks a ton!  And those ideas are fantastic as well!  The idea that the Player illuminating themselves is a dead giveaway is a suggestion for them to put out their torches / lights, and use the Guard as a Lightsource!  Mostly all it should take is just adjusting some switches, and if you do want to change the view range, you should be able to do that on the fly also!  Scripting, even if its one line of code, can be extremely powerful stuff!

You can also think outside the box.  The Unlimited Page Conditions script has plenty of rooms for YOU to exploit!  I left that wide open as to provide more functionality instead of locking it down.  Thus, you can run Scripts in the Condition.  As long as the final code evaluates to true / false, the code will still run!  Thus, you could run something like "@sensor.range = ($game_player.light.enabled) ? 5 : 4" and change the range on the fly!

Im glad the examples helped!  If you need anything else, feel free to ask!
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #128 on: November 14, 2018, 11:16:36 PM »
Sadly, after messing around for about two hours, I still can't get it to work.

I tried putting "Condition: $game_player.in_light?" on page 2 (Guards Trigger Battle). This causes strange behavior, as the guard switch to page 2, his facing (and directional light) is also switched to the default facing of page 2. If page 2 facing is different than page 1, the player would not be lit by the directional light, failing the "in_light" Condition, causing the guard to immediately switch back to page 1, fulfilling the "in_light" Condition again, thus rapidly switching between the two pages without ever approching the player.

Also, with "Condition: $game_player.in_light?" on page 2, if the player approch the guard from behind while not "in_light", the game hangs up, similar to an autorun event that doesn't end.

Btw I'm using a moving guard to test all this. You simply must have some moving guards in a stealth based game, you know, and if a moving guard doesn't cause any problem, so shouldn't a stationary guard.

Quote
"@sensor.range = ($game_player.light.enabled) ? 5 : 4"

This seems to be exactly what I needed, changing the guard's range without switching pages or adding conditions. I changed "$game_player.light.enabled" to "$game_player.in_light?", it should work in theory. When I run it, It says stynax error. My comments on page 1 looks like this:

Code: [Select]
\light[ForwardLight.png]
\light_match_direction
\light_offset_xy[0, -24]
Condition:
@sensor.range=($game_player.in_light?)? 6:4
Sensor_Config
range=4 listen=3 on_range=6 view=6 on_view=0
listen_range=5 listen_view=5
listen_switch=listener
wall listen_wall=true on_wall=false inter

I also tested my idea of having guard's view range longer than his own light, by putting "Condition: $game_player.in_light?" on page 1. This causes the guard to disappear when the player is not in light. Duplicating page 1 (with "Condition: $game_player.in_light?" on the second page 1) to prevent the guard from disappearing also doesn't work, causing the same "switching back and forth" problem described above.

Speak of which, is there a way to maintain previous facing when switching pages?
« Last Edit: November 14, 2018, 11:38:04 PM by Helios »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #129 on: November 14, 2018, 11:58:10 PM »
I will have to mess around with this a bit to dig deeper into achieving what you want.  Im sure its possible, but I did end up using a lot of scripts in move routes themselves.

As far as @sensor, there are several ways to do this.  First, basically, anything in the "Condition:" comment must evaluate to true / false, but, you can run other code there before returning the true / false.  Second, the Sensor should be accessible from anywhere, so you can also do stuff like this:

Code: [Select]
Condition: e = $game_map.events[14]
# l player is in light or not, its a return value also
l = in_light?(0, 0)
# Adjust Range of Sensor Sight
e.sensor.range = (l) ? 5 : 4
# Return stored instead of running code again (faster)
return l

And yes, Comments should work fine in Condition Code also.  I will have to dig into your issue a bit later since it seems I broke something and need to fix that first.  Other thing to note is since you can access $game_map.events[14].sensor from anywhere, one event can change the Range of other events, or anything else inside the Sensor object.

---

EDIT: Lol, ok, apparently all I needed was a reboot. 

Agreed, Guards should not be stationary.  To get the Guard to maintain facing the same direction is quite tricky.  I always had trouble with that also.  So I dont have a definitive solution at this time.  I will see what I can put together when I get some time to dig in deep. 

I tested it for a few minutes, and also got Syntax Error.  It may be necessary to write a custom method to run in the Condition box, which isnt as difficult as it sounds.  Its been a while since Ive played with this, but I'll dig into it.
« Last Edit: November 15, 2018, 12:27:16 AM by Heretic86 »
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #130 on: November 15, 2018, 02:08:30 AM »
Many thanks, Heretic86. I'm not in any hurry, so take your time.

Also, please try to make the guard events self-contained, if possible. Using other events or event number like" $game_map.events[14]" to control guard behavior is rather counter-productive in larger scale, because you have to manually setup every guard. I hope this is not too much to ask. :)
« Last Edit: November 15, 2018, 02:10:37 AM by Helios »

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #131 on: November 15, 2018, 11:05:35 AM »
Many thanks, Heretic86. I'm not in any hurry, so take your time.

Also, please try to make the guard events self-contained, if possible. Using other events or event number like" $game_map.events[14]" to control guard behavior is rather counter-productive in larger scale, because you have to manually setup every guard. I hope this is not too much to ask. :)

Agreed.  I will set something up as a Template so you can copy and paste.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #132 on: November 20, 2018, 11:45:57 AM »
Ok, I have a version for you to TEST out.  I believe this is stable.  It didnt take too much work.

SUPER EVENT SENSOR Version 1.1 - LIGHT SENSITIVITY FEATURE ADDED (click me)

I didn't do a template because this should be REALLY EASY to add Light Detection.  Remember, you can have MORE THAN ONE Sensor_Config comment if you need additional room.

Code: [Select]
Sensor_Config
light=true listen_light=true on_light=true
light_tol=34.5

Please let me know if this does the job for you before I publish a Final Version of it.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #133 on: November 29, 2018, 03:21:35 PM »
Ok, I have a version for you to TEST out.  I believe this is stable.  It didnt take too much work.

SUPER EVENT SENSOR Version 1.1 - LIGHT SENSITIVITY FEATURE ADDED (click me)

I didn't do a template because this should be REALLY EASY to add Light Detection.  Remember, you can have MORE THAN ONE Sensor_Config comment if you need additional room.

Code: [Select]
Sensor_Config
light=true listen_light=true on_light=true
light_tol=34.5

Please let me know if this does the job for you before I publish a Final Version of it.

Thanks!

I've tested it, with mixed results. Namely, it still suffers from the same "rapidly switching back and forth" problem, when the player is in range but not lit.

And sometimes, if the player is lit and in range, the guard would not rapidly switch pages, but still does not work properly. I have that "guards_can_see?" addon from earlier, and made a UI with that condition, which display a yellow warning sign when not "seen", and switch to a red sign when "seen". Some times when the player is lit, the guard would just sit there watching, while the warning sign rapidly switching between yellow and red. Cause unknown, needs further testing.

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #134 on: November 30, 2018, 01:33:24 AM »
Hmm, ok.

I used one of the Forest Bees as a Template, then just edited that to update, and just added the "light" stuff to the Config.  I'll have to experiment with the Guard...
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #135 on: November 30, 2018, 12:34:02 PM »
In case you couldn't reproduce the problem, here are some details:

SENSOR_READ_LINES = 12 (with the flashlight code added, the default 10 is not enough)

The guard is standing 10 grids away from player, walking towards the player.

The player is lit by a street light:
Code: [Select]
\light[Lamp Glow.png]
\light_flicker_opacity[224, 255, 7]
\light_offset_xy[0, -32]

the guard's settings:
Code: [Select]
\light[ForwardLight.png]
\light_match_direction
\light_offset_xy[0, -24]
Sensor_Config
range=8 listen=3 on_range=6 view=6 on_view=0
listen_range=5 listen_view=5
listen_switch=listener
wall listen_wall=true on_wall=false inter
Sensor_Config
light=true listen_light=true on_light=true
light_tol=34.5

Upon seeing the player, the guard would appear to be standing still. If you use "guards_can_see?" conditional branch to display 2 different pictures, indicating detection status, you would see the two pictures rapidly flashing. I could provide a demo if you need it.

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #136 on: November 30, 2018, 02:34:34 PM »
Yes, please post a demo and I can try coding in that to see whats happening.  Sorry, just been rather busy, I will jump on this as soon as I get a chance.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #137 on: December 01, 2018, 03:24:12 AM »
Here you go. Just wait for the guard to approch. The warning sign to the right indicates detection.

https://mega.nz/#!pJ1jiQbA!PrYCac1Qr9-g3oIsfIfPMOgtyUzE5Lkn4dJsUrcOf4c

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 33
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #138 on: December 02, 2018, 01:53:58 AM »
Ok, I think I figured it out.

Sensor_Config
range=8 listen=3 on_range=6 view=6 on_view=0

Take a look at the bold parts.

What appears to be happening is the ON Range is Less than the Range.  Each time the Sensor gets triggered, ON takes over and ON Range is used.  Since the ON range is less than the Range, it says "nope, the target is out of range so cant see it" then it disables and changes Event Pages, then the next frame it says "yep, the target is in range so yep I can see it", changes Event Pages again, and it just goes back and forth.

Basically, with any Range, it should increase as awareness increases also.

For example

range=5
listen_range=6
on_range=7

If the Increased "Awareness" is less than default awareness, you'll end up with that toggling like you are seeing.  That was my intent anyway...  When I changed that one setting in your Sensor_Config, it looks like it was working as intended without any script changes.  Its definitely an easy thing to miss, so dont blame yourself!  And now we have a better idea of where to look if things start doing that back and forth page triggering!

Try using this:

Sensor_Config
range=6 listen=4 on_range=8 view=6 on_view=0
listen_range=7 listen_view=5
listen_switch=listener
wall listen_wall=true on_wall=false inter

NOTE: Bolded numbers are what I changed.

---

Also, and Im figuring this is just for the Demo, but I saw that the command_355 bug was also present.

    # Evaluation
    result = eval(script)
    # If return value is false
    if result == false
      # End
      return false
    end
    # Continue
    return true

Need to get rid of the "return false" line.  If the bug still exists, if you make a Script Call like $game_player.light.enabled = false, then the game will just hang.  It wasnt your script that broke it, it was a bug in command_355.
« Last Edit: December 02, 2018, 01:55:20 AM by Heretic86 »
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Helios

  • Trained Member
  • *
  • Posts: 39
  • LV: 1
    • View Profile
Re: [XP] Heretic's Collection of Art and 100% Compatible Scripts
« Reply #139 on: December 02, 2018, 03:55:54 AM »
Oops, that's just me being stupid :^_^\':

Usually I run with range=4, changed it to 8 for testing purpose but forgot about the other range settings. After correcting the settings it works smoothly.

And yeah, I started a new project for the demo, so that command_355 bug was left in. In the working version it was fixed.

Thanks again!
« Last Edit: December 02, 2018, 05:13:00 AM by Helios »