Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Scripting Help
New Topic New Poll Post Reply
Poster Message
12th Archivist
Level: Smitemaster
Avatar
Rank Points: 790
Registered: 12-07-2008
IP: Logged

File: Ray Gun For Beethro.drh (2.4 KB)
Downloaded 19 times.
License: Public Domain
icon Scripting Help (0)  
In this hold I have attached here, I have a character called a "Bolt" who supposedly appears when 1) you have enough energy to fire a bolt and 2) you are facing a certain direction does it go that way.

Please look at the code and see if you can find anything wrong out of the ordinary (and even in the ordinary if my scripting is really bad!).

____________________________
It was going well until it exploded.
~Scott Manley

Check out the DROD Wikia project here!

[Last edited by 12th Archivist at 01-12-2009 12:09 AM]
01-12-2009 at 12:06 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 3363
Registered: 02-20-2007
IP: Logged
icon Re: Scripting Help (+2)  
So, first thing. You've tried to make the bolt appear by placing the bolt as an invisible character and putting "Each use" in its script. "Each use" only works in the script of the player's current equipment -- either accessory or command equipment. It will never make anything happen in the bolt's script.

Instead, you need to make the raygun's script generate a bolt each time it is activated. To do this, add these lines in place of "Set var BoltGo", which is unnecessary:

  Set var Horiz = _O % 3 - 1
  Set var Vert = _O / 3 - 1
  Set var _MyScriptX = _X + Horiz
  Set var _MyScriptY = _Y + Vert
  Generate entity Bolt,0,0,northwest
  Set var _MyScriptX = -9999
  Set var _MyScriptY = -9999
  Set var BoltO = _O

(See Kwakstur's orientation tutorial for an explanation of why this works.)

Next, to make the bolt move, completely replace its script with this:

  Set var Move = 0
Label Start
  Set var Horiz = BoltO % 3 - 1
  Set var Vert = BoltO / 3 - 1
  Set var _MyScriptX = _MyX + Horiz
  Set var _MyScriptY = _MyY + Vert
  Move to 0,0,0,0
  Set var _MyScriptX = -9999
  Set var _MyScriptY = -9999
  Set var Move + 1
  If ... 
        Wait until var "Move" = 6
     Disappear
     End
  If End
  Go to Start

(Note that "Wait 0" is not necessary because "Move to" takes up a turn.)

One last thing. If you want the Bolt to be able to fly over pits and water (it would be more realistic that way, right?) select either "Wraithwing" or "Fegundo" from the list of character graphics. Don't worry, this won't override your custom tiles. It just makes the character be based on the correct template.

____________________________
50th Skywatcher

[Last edited by Nuntar at 01-12-2009 01:03 AM]
01-12-2009 at 12:30 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Kwakstur
Level: Smiter
Avatar
Rank Points: 384
Registered: 05-05-2006
IP: Logged
icon Re: Scripting Help (+2)  
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


Now the Bolt.
Click here to view the secret text


And as for communications between the two:
Click here to view the secret text


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]
01-12-2009 at 01:05 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Scripting Help
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.