I'll bet nobody's surprised to see me here. Well, here's what I have to say:
Is the raygun supposed to fire the bolt? I assumed it did.
Well, here's my thoughts on the Raygun.
Click here to view the secret text
×Here's the code for reference.
Label Loop
Each use Here
Go to End
Label Here
If ...
Wait until var "_REP" < 1
Speech "I don't have enough ammo!",Normal,Player,0,.
Go to Loop
If End
Set var "BoltGo" = 1
Set var "_REP" - 1
Wait 0
Go to Loop
Label End
One suggestion for simplicity: You can take away Label Loop and instead just have those Go to's point to End, like this:
Click here to view the secret text
× Each use Here
Go to End
Label Here
If ...
Wait until var "_REP" < 1
Speech "I don't have enough ammo!",Normal,Player,0,.
Go to End
If End
Set var "BoltGo" = 1
Set var "_REP" - 1
Label End
Of course, if you ever do plan to add anything to the beginning of the code that you want to be repeated when it gets used, you should keep it the way it is.
That's all I have to say for the Raygun alone.
Now the Bolt.
Click here to view the secret text
×Here's the code with some areas marked.
Label Loop
Each use Use (1)
Go to Loop
Label Use
If ...
Wait until var "BoltGo" = 1
Set var "BoltGo" = 0 (2)
Go to Loop
If End
Appear
Set var "_MyX" = _X (3)
Set var "_MyY" = _Y
[Begin code repeated for each direction]
If ...
Label North (4)
Wait for player to face North
Move 0,1,0,0
Set var "North" + 1 (5)
If ...
Wait until var "North" = 6
Set var "North" = 0
Disappear
Go to Loop
If End
Wait 0
Go to North
If End
[End code repeated for each direction]
Wait 0
Go to Loop
Label End
(1)
Why would this be used? It's not equipment.
(2)
I don't understand this. Please explain.
(3)
Beware, moving around by changing the _My coordinates is still buggy. Until RPG gets its bugs fixed, it's better to do this if you want to move in one turn:
Disappear
Set var "_MyScriptX" = _X
Set var "_MyScriptY" = _Y
Move to (0,0)
Set var "_MyScriptX" = -9999
Set var "_MyScriptY" = -9999
Appear
(4)
This would cause a strange effect that once the bolt is generated, it will only move when the faces that direction, and stay put while he faces other directions. Place the label after the Wait command.
(5)
Hmm, a variable for each direction? I have a suggestion. Instead of having 8 labels, I'll try using my XComponent and YComponent formulae from my Orientation reference to tell it where to move. Try simplifying those 8 sections into just this:
Label Move
Set var "MyScriptX" = _O % 3 - 1
Set var "MyScriptY" = _O / 3 - 1
Move 0,0,0,0
Set var "MyScriptX" = -9999
Set var "MyScriptY" = -9999
Set var "BoltDist" + 1
If ...
Wait until var "BoltDist" = 6
Set var "BoltDist" = 0
Disappear
Go to Loop
If End
Wait 0
Go to Move
And as for communications between the two:
Click here to view the secret text
×I like how you use a variable like "
BoltGo"
to read whether or not to fire the Bolt. Unfortunately, as soon as the Bolt's code runs, it sets this var to 0 and starts over.
Here's how I think you should change your code to allow for interaction (I have my other suggestions in here too):
Label Loop
Each use Use
Go to Loop
Label Use
If ...
Wait until var "BoltGo" = 1
Set var "BoltGo" = 0
Go to Loop
If End
If ...
Wait for var "BoltGo" = 1
Appear
Set var "_MyX" = _X
Set var "_MyY" = _Y
[Begin code repeated for each direction]
If ...
Label North
Wait for player to face North
Move 0,1,0,0
Set var "North" + 1
If ...
Wait until var "North" = 6
Set var "North" = 0
Disappear
Go to Loop
If End
Wait 0
Go to North
If End
[End code repeated for each direction]
Label Move
Set var "MyScriptX" = _O % 3 - 1
Set var "MyScriptY" = _O / 3 - 1
Move 0,0,0,0
Set var "MyScriptX" = -9999
Set var "MyScriptY" = -9999
Set var "BoltDist" + 1
If ...
Wait until var "BoltDist" = 6
Set var "BoltDist" = 0
Set var "BoltGo" = 0
Disappear
Go to Loop
If End
Wait 0
Go to Move
If End
Go to Loop
Label End
This version doesn't fix all the problems, since it only allows for one bolt, and I'm having a hard time testing it in my mind with all this marked text. I don't think it will really work yet in this state.
A comment on Nuntar's suggestion: That won't work completely, because it modifies a variable shared by bolts. Make it use _MyREP and stuff like that instead of hold variables. Yours has a good base structure and is much simpler than 12th A's code, though, and is pretty much how I would program it if I weren't trying to keep mine based off of 12th A's code.
Edit: Also, in your code the bolt turns with the player. Make the loop not extend that far back; just make a label after the bolt figures out its direction and go there when the bolt moves.
However, I would prefer to make it an Invisible NPC with Ghost Display, so that it can move onto enemies. Scripted Enemies would constantly check to see if the bullet's coords match theirs, and if they do, they'll take damage and set BoltGo to 0 (hopefully telling the bullet to destroy itself). But only one bullet should be allowed at a time in this scenario, and it would use hold variables to store its coordinates for this. But then again, I don't know how else to let the bullet hurt enemies.
Some of your code does remind me a lot of how I generate and move the thing created by the Knife of Time in the script I'm about to release.
____________________________
Also known as ExpHP everywhere else.
[Last edited by Kwakstur at 01-12-2009 02:51 AM]