Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Resolved] Modded Stealth Script

Started by Countdown, December 28, 2010, 01:46:38 AM

0 Members and 1 Guest are viewing this topic.

Countdown

Hey, as the title says, I need to have a script modified so that It will work the way I want it. It's a great script by Cmpsr2000 that I found on RPGRevolution, but it doesn't work perfectly like I would like.

Before I get to the request, here's the link to the script.
http://www.rpgrevolution.com/forums/index.php?showtopic=15208&st=0&p=168130&#entry168130

It uses 2 scripts, and here are the links to just the text of them.
Redefinitions: http://www.rpgrevolution.com/forums/index.php?act=attach&type=post&id=1178
Game_Stealth: http://www.rpgrevolution.com/forums/index.php?act=attach&type=post&id=1170

So, what it does right now is has it so that when a guard (or whatever) sees you, it will either give you a game over, send you to jail, call a common event, or have the guard go investigate.

What I'd like it to do, instead of call a common event, turn Self Switch B on.

How I have the events set up is the first page calls the script and turns Self Switch A on, which is the page where the guard is looking for the player. If it could turn Self Switch B on instead of a Common Event, then I could call a battle and have him die when it's over, or game over. And have it so that if you press Enter on the guard while he is facing away from you, it would turn Self Switch C on so that I could do a cool assassination (using http://www.rpgrevolution.com/forums/index.php?showtopic=41873 for that), and if the Guard isn't facing away from the have it turn Self Switch B on as well. Self Switch D would be the page where the guard is dead and no longer appears on the map.

Did that make sense?

I've hit a wall and cannot continue without this script working the way I need it to. So, any help would be great.

kirinelf

So basically what you'd like is the ability to turn a self switch on and off, is that correct?

Countdown

Yeah, the script triggers a common event. I want it to turn a Self Switch on instead as well as have that extra feature to turn on a different Self Switch if you press enter on the event when it is facing away from you.

kirinelf

Then I can help. I think. To turn off an event's self switch from another event/a common event, this is what you need:

$game_self_switches[[event's map id, event id, "switch"]] = true/false

event's map id is the map id where the event is, while event id is the event's id. Switch is the available self switch slots ranging from 'A' to 'D'. Put it in a string, a.k.a. with quotation marks. true/false is the flag. True means on, false means off. Refresh the map afterwards with this:

$game_map.refresh

Does that help?

Edit: To clarify, you need to use a script call, which you should already know. I've heard that there're problems with using it, but I've never had any happen before in my projects. So it's more of a 'use at your own risk' type of thing. Good luck with it.

Countdown

Yeah, I'm not a total noob at RMVX, I'm just not good at coding scripts and such.

That would work, however, the script when triggered calls one single common event, so I'd need many events per map to use that same common event, and by the looks of it, the call script segment you just posted only turns self switch on for one event on one map unless I am mistaken?

+rep for the effort though. If you have any other way of getting me past this brick wall, let me know.

Countdown


Deity

Hay DarkCodeZero.
Sry that I wasn't able to end your request earlier, I was just to busy. :(
Try this out:
class Game_Stealth
  def doCommonEvent
    key = [$game_map.map_id, @detectingEvent.id, "B"]
    $game_self_switches[key] = true
    @detectingEvent.refresh
  end
end
class Game_Player
  alias check_action_event_assination check_action_event unless $@
  def check_action_event
    front_x = $game_map.x_with_direction(@x, @direction)
    front_y = $game_map.y_with_direction(@y, @direction)
    for event in $game_map.events_xy(front_x, front_y)
      if event.isAware
        if event.direction == @direction
          key = [$game_map.map_id, event.id, "C"]
          $game_self_switches[key] = true
          event.refresh
        else
          key = [$game_map.map_id, event.id, "B"]
          $game_self_switches[key] = true
          event.refresh
        end
      end
    end
    check_action_event_assination
  end
end


I hope it's like you wished. :P

Deity
Greetings
DigiDeity


├Work┤
├Contact┤


Countdown

#7
Deity, the first part works wonders and makes life much easier for me. But the second part, I can't test, because he keeps finding me when I touch him. There's got to be a part somewhere else in the beginning script that's making that do that?

EDIT: I found what was wrong, and fixed it. Deity, thank you so much for a perfectly working amazing script!

Deity

I'm glad you like it. ;)
And sry again that I wasn't able to finish it earlier. ^^

Deity
Greetings
DigiDeity


├Work┤
├Contact┤