PDA

View Full Version : Script Help Please


dean1012
04-03-2008, 02:37 AM
Hello,

I have extensive programming knowledge, and am an academic Computer Science student. I have decided to take up RPG Maker II for fun and have decided to learn it as I do programming languages - by doing things one piece at a time as small prototypes.

I have a small building created. no NPCs or anything.

It has a candle on the back wall. It is unlit.

When you walk up to it and examine it, it tells you it is unlit and asks if you want to light it.

If you say yes, it says the candle is now lit, sets a flag, and does:

Script Control: Apply Together
Effect: Double Flames Event
Data: Flag: Flag261 On
Script Control: Force Script End

This works great.

When you examine it again, it reads that the flag is set, tells you it is lit, and asks if you want to blow it out.

If you say yes, it should stop the Double Flames event. However, it does not.

This is where i'm stuck.

My candle event is the same as the default one except the following options:

Name: Candleunlit
Motion: -None-
Start: Examine
Apply: CandleA

CandleA is a content script.

Instead of stopping the Double Flames event, it seems to do things with the actual candle model. I can get it to hide the candle, for example. But, the flames still exist even with a hidden candle.

Have I done this whole process wrong? Or is there a command I'm missing to stop the Double Flames event?

dean1012
04-03-2008, 03:06 AM
I've gotten one step closer...

I used:

Effect: Clear All Effects

However, this blows out ALL candles not just the one being examined.

Is there anything like a Clear *this* event?

Thanks

dean1012
04-03-2008, 03:46 AM
Without those two commands, the script never stops executing and freezes the game lol

dean1012
04-03-2008, 04:06 AM
I figured it out. I was making it way too complicated.

Nje789
04-03-2008, 12:27 PM
The best I could come up with for not using a repeat script was to set a warp, then warp in place, and then you could change pages this way, which would clear just one effect.
Repeat scripts can make effects flicker, and put more strain on the system.
The best way to use repeat scripts is probably to just use one master repeat script that acts as a 1Frame-waiting timer that checks variables that incrementally decrease with each 1frame wait repeat, or some other flag/variable checks, and then apply together call a script, then apply in order.

How did you do your way?

Dungeon Warden
04-03-2008, 05:13 PM
One way to do it is have a called script that only runs when you want to clear an effect. What it does is clear all the effects and then checks all the flags and restarts all the effects that are still supposed to be on. This has the advantage of avoiding the flicker effect and is only a load on the system when an effect is being turned off. This works better if you only have a few effects on a map.

The other method is to place the visual effect in a repeat and have the effect only last 1 F (2F might work better, you'll need to experiment). The condition of the repeat is that the [candle] flag is on, so when the flag goes off the effect stops. This will all need to be inside another repeat so you can check if the flag turns back on again. Place this in the motion script slot so it runs when the player stops interacting with the event. (This idea was mentioned above but I though I'm make it clearer how it works)

dean1012
04-03-2008, 09:08 PM
I had to rework how I did it.

Essentially, I have a single event: CandleA

It has 2 pages.

first page checks if CandleAFlag is off
on examine, it runs CandleAUnlit

CandleAUnlit does the asking and whatnot and if conditions are met, it sets CandleAFlag to on

second page checks if CandleAFlag is on
if it is, it has motion set to Candle and runs CandleALit on examine

CandleALit asks about blowing it out and if conditions are met, sets CandleAFlag to off

It works perfectly.