Main Menu
  • Welcome to The RPG Maker Resource Kit.

Moving Projectile script?

Started by Bewaffled1, May 26, 2007, 05:27:07 AM

0 Members and 1 Guest are viewing this topic.

Bewaffled1

Ok I have a script for this but it doesn't seem to be working.... it should kill\hit the enemy
on contact with the projectile but, it only hits the enemy when your right in front of it...

If anyone knows a way to fix this or has a script for a moving projectile i'd appreciate the script\help... I'll post the script for the projectile if you need it...

A Few things I can tell you about it... Are... It's an abs for a Zelda game (=]) which I'm working
on.

The projectile DOES FIRE AND MOVE ACROSS THE SCREEN FROM YOUR POSITION just when it
hits the enemy it goes right through unless it's right up on you...

The projectile is an arrow...

If you need more info just ask =$....
I'm only a newb on Tuesdays xD.....
---------------Bewaffled1---------------

kid27

I would know how to do this in events. PM me if you need it.

But in RGSS, I have no clue. Sorry.

FIRIN MAH LAZARR!! since 1994.

Bewaffled1

That would be awesome because, the one i have now is in events xD it just doesn't work right...

I'd appreciate it!
I'm only a newb on Tuesdays xD.....
---------------Bewaffled1---------------

Kokowam

Fadark asked for this before. Couldn't you just use events and Event Touch/Collision or Hero Touch?

Bewaffled1

#4
You know to be honest with you I don't even understand how this system works xD... ERM... Since these scripted events are in the zelda project anyway I guess it wouldn't hurt to post them..

(I DID NOT MAKE THESE)

1.) This Has to be on all maps with enemies (Hp SET)
[spoiler]

(Event Name: ENEMY HP CONTROL)

Control Switchs: [0100: Enemy Hp Done Setting = OFF]
Control Variables: [0076: Enemy Hp 1 = 1]
Control Switchs: [0100: Enemy Hp Done Setting = On]

Erase Event

[/spoiler]

2.)THE PROJECTILE EVENT (Umm..)
[spoiler]

(PAGE1)
(EVENT SWITCH FUNCTIONS)
Parallel = CHECKED

Comment: SET PROJECTILE TO UNREACHABLE PLACE
Control Variables:[0026 Projectile X -=1]
Control Variables:[0027 Projectile Y -=1]
Comment: Ensures the projectile isn't fired without being set up first.
Control Self Switch: a =OFF

(More Switches that turn off the some stuff that aren't important here)
EG: Boomerang return = off etc..

(PAGE2)
(Switch Functions)
Move Animation = Checked
Through = Checked
PROJECTILE FIRE MUST = ON

Sets up the place for the projectile to be fired <-

Comment: Ensures the projectile isn't fired without being set up first.
Control Self Switch: a =OFF

Comment: Sets projectile coordinates to Link's coordinates.
Control Variables:[0026 Projectile X ] = Player's Map X
Control Variables:[0027 Projectile Y ] = Player's Map Y

(Now functions that set the projectile 1 tile infront of link)
(to long to type and those are unimportant..)

(Page 5)
(Switch Functions)
Bow and Arrows MUST = ON
PROJECTILE FIRED MUST = ON
SELF SWITCH A MUST = ON
THROUGH = CHECKED
Parallel = CHECKED

This is the actual projectile <-

Control Variables:[0026  Projectile X ] = This Event's Map X
Control Variables:[0027  Projectile Y ] = This Event's Map Y
Control Variables:[0026  Projectile Screen X ] = This Event's Screen X
Control Variables:[0027  Projectile Screen Y ] = This Event's Screen Y
Control Variables:[0027  Projectile's Tiles Terrain ] = This Event's Terrain Tag

(IF THE PROJECTILE HITS TERRAIN 1 it will stop firing)
(Not important this feature works)

(IF THE PROJECTILE Goes of screen it will disappear)
(not important this feature works)

[/spoiler]

3.)THIS STUFF HAS TO DO WITH IF THE PROJECTILE HITS THE ENEMY which is in the enemy's
event pages....
[spoiler]

(PAGE 6) - ALL OTHER STUFF IS SET FINE THIS IS COLLISION WITH THE ARROW ONLY

Comment: Make sure the projectile has been fired...
Conditional Branch: Switch [0015: Projectile Fired ] == ON

Comment: Checks if the projectile's coordiantes are equal to this
events coordinates.

Conditional Branch: Script:
$game_map.events[@event_id].x == $game_variables[26] and  $game_map.events[@event_id].y == $game_variables[27]

Comment: Projectile's coordinates are equal to this event's
coordiantes.
Comment: Stops Projectile from moving
Conditional Branch: Switch [0015: Projectile Fired ] == OFF

Comment: Does damage to enemy.  Change the last number in this
script to the number of damage this weapon does to this
enemy.

Script:
Event_Name =
$game_map.events[@event_id].event.name
$game_variables[75+Event_Name.to_i] =
$game_variables[75+Event_Name.to_i] -1

Comment: Checks to see the hp has been set
Conditional Branch: Switch [0010: Done Setting Hp ] == ON

Script:
Event_Name =
$game_map.events[@event_id].event.name

Comment: Enemy health is less than or equal to 0.
Conditional Branch: Script: $game_variables[75+Event_Name.to_i] <= 0

Comment: Turn on death switch
control self switch: D =OFF

ELSE
(The enemy was hit but has more than hp than the hit specified
Not important)

BRANCH END
>
BRANCH END
>
BRANCH END
>
BRANCH END
>

Control self switch: C = OFF

[/spoiler]

WELL after all that typing xD I hope someone can help me =\.... The pages between the page 5 on the enemy are other weapons 1 and 2 set Collision with link and chasing link
which both work fine (sticky switches).

If you need more info tell me what you need and I'll try to find it for you =$...

Kid directed me to the link for this this script which is entirely to confusing for me
lol.....

[spoiler]

Alrighty ppl I teach you now howto do a shooting system... I was borrred to all the crap up in the Forums, "How do I make a shooting system?" about 1000 topics like that... So now I fulfill my peasant responsibility or something and release this tutorial (a note to the Staff Members: Please put up this topic, Im really borrred to all those topic ;_;).

A STEP BY STEP STYLE!

1. Make these events:

-An event called "Shooting System". Make it invisible, "Paraller Process" and "Below Hero".

-An event called "Bullet". Make it invisible, "On Hero Touch" and "Over Hero". Make it somewhere where it cant be reached. Make its movement "Step Forward" and repetitive.

-An event called "Hit or not?". Make it invisible, "Paraller Process" and "Below Hero".

-Of course, you need enemies. Since this tutorial tells only howto make shooting and hitting work, Im not going to waste time about preaching howto make monsters hit you.

2. The command lines:

-"Shooting System":
->Enter password: ENTER COMMAND (Action Key)
->Fork Condition: If variable: ENTER COMMAND: Is 5
-::>Fork Condition: If variable: BulletsLeft: Is greater than 0
-::::>Memorize Position: Variables: X, Y, & MapID
-::::>Set Event Place: "Bullet": Variables: X, Y, & MapID
-::::>Fork Condition: If Event: Hero: Face Up
-::::::>Move Event: "Bullet": Face Up, Change Graphic: (Your bullet graphic)
-::::>END Case
-::::>Fork Condition: If Event: Hero: Face Right
-::::::>Move Event: "Bullet": Face Right, Change Graphic: (Your bullet graphic)
-::::>END Case
-::::>Fork Condition: If Event: Hero: Face Down
-::::::>Move Event: "Bullet": Face Down, Change Graphic: (Your bullet graphic)
-::::>END Case
-::::>Fork Condition: If Event: Hero: Face Left
-::::::>Move Event: "Bullet": Face Left, Change Graphic: (Your bullet graphic)
-::::>END Case
-::::>Play Sound Effect: (Your shooting voice)
-::::>Flash Screen: (Mild, but able to see) For 0.3 Time
-::::>Change Variable: BulletsLeft: Decrease by: 1
-::::>Change Variable: ENTER COMMAND: Set 0
-::>END Case
->END Case

-Bullet does not need a codeline

-"Hit or not?":
->Change Variable: BulletX: Set Event: Bullet X Pos
->Change Variable: BulletY: Set Event: Bullet Y Pos
->Change Variable: Monster1X: Set Event: Monster1 X Pos
->Change Variable: Monster1Y: Set Event: Monster1 Y Pos
->Change Variable: Monster2X: Set Event: Monster2 X Pos
->Change Variable: Monster2Y: Set Event: Monster2 Y Pos
->Change Variable: Monster3X: Set Event: Monster3 X Pos
->Change Variable: Monster3Y: Set Event: Monster3 Y Pos
->Change Variable: Monster4X: Set Event: Monster4 X Pos
->Change Variable: Monster4Y: Set Event: Monster4 Y Pos
->Fork Condition: If variable: BulletX is Monster1X
-::>Fork Condition: If variable: BulletY is Monster1Y
-::::>Move event: "Bullet": Change Graphic (Invisible), FaceAnyDir
-::::>Set Event Place: "Bullet": (Somewhere where it cant be reached
-::::>Play Sound Effect: (Hitting sound)
-::::>Flash Event: Monster1 (Red) For 0.3 Time
-::::>Fork Condition: If variable: Monster1HP: Is 0 or below
-::::::>Play Sound Effect: (Dying Sound)
-::::::>Flash Event: Monster1: (Red) For 0.3 Time
-::::::>Change Switch: Monster1Dead: On
-::::>END Case
-::>END Case
->END Case
->Fork Condition: If variable: BulletX is Monster2X
-::>Fork Condition: If variable: BulletY is Monster2Y
-::::>Move event: "Bullet": Change Graphic (Invisible), FaceAnyDir
-::::>Set Event Place: "Bullet": (Somewhere where it cant be reached
-::::>Play Sound Effect: (Hitting sound)
-::::>Flash Event: Monster2 (Red) For 0.3 Time
-::::>Fork Condition: If variable: Monster2HP: Is 0 or below
-::::::>Play Sound Effect: (Dying Sound)
-::::::>Flash Event: Monster2: (Red) For 0.3 Time
-::::::>Change Switch: Monster2Dead: On
-::::>END Case
-::>END Case
->END Case
->Fork Condition: If variable: BulletX is Monster3X
-::>Fork Condition: If variable: BulletY is Monster3Y
-::::>Move event: "Bullet": Change Graphic (Invisible), FaceAnyDir
-::::>Set Event Place: "Bullet": (Somewhere where it cant be reached
-::::>Play Sound Effect: (Hitting sound)
-::::>Flash Event: Monster3 (Red) For 0.3 Time
-::::>Fork Condition: If variable: Monster3HP: Is 0 or below
-::::::>Play Sound Effect: (Dying Sound)
-::::::>Flash Event: Monster3: (Red) For 0.3 Time
-::::::>Change Switch: Monster3Dead: On
-::::>END Case
-::>END Case
->END Case
->Fork Condition: If variable: BulletX is Monster4X
-::>Fork Condition: If variable: BulletY is Monster4Y
-::::>Move event: "Bullet": Change Graphic (Invisible), FaceAnyDir
-::::>Set Event Place: "Bullet": (Somewhere where it cant be reached
-::::>Play Sound Effect: (Hitting sound)
-::::>Flash Event: Monster4 (Red) For 0.3 Time
-::::>Fork Condition: If variable: Monster4HP: Is 0 or below
-::::::>Play Sound Effect: (Dying Sound)
-::::::>Flash Event: Monster4: (Red) For 0.3 Time
-::::::>Change Switch: Monster4Dead: On
-::::>END Case
-::>END Case
->END Case

Kthx, bye!

[/spoiler]

AND NOW for no apparent reason I'm having save file issues ugh.... I'm begining to wonder if this is even worth the time =[.... I don't even know why they aren't working now and I know that they did indeed WORK at one time...
I'm only a newb on Tuesdays xD.....
---------------Bewaffled1---------------