 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
jabbercat Composer

Joined: 04 Sep 2003 Posts: 823 Location: Oxford
|
Posted: Sun Feb 01, 2004 10:42 am Post subject: Zelda-esque attack script |
|
|
When used , its doesn't create the npc . Any help would be greatly appreciated .
Code: |
script,theattack,who,begin
variable(attackage,hx,hy,inpcx,inpcy,d)
if(keyispressed(key:z))then , begin , else , end
if(attackage==0)then,begin,else,end
if(d==north)then(decrement(hy))
if(d==south)then(increment(hy))
if(d==west)then(decrement(hx))
if(d==east)then(increment(hx))
inpcx:=npcx(35)
inpcy:=npcy(35)
d:=herodirection(me)
attackage:=1
createnpc(35,hx,hy,d)
walknpc(35,d,20)
if(walknpc(35,d)==false)then(destroynpc(35),attackage:=0)
if(npcatspot(inpcx,inpcy,who))then ,begin, hitenemy
if(npciswalking(35)==false)then(destroynpc(35),end
end
end
|
It is based loosely on Lord Paige's |
|
Back to top |
|
 |
MultiColoredWizard Come back, baby! The Breastmaster

Joined: 01 Feb 2003 Posts: 1232
|
Posted: Sun Feb 01, 2004 10:53 am Post subject: |
|
|
Yopu've got to make the hNPC firs, or else you'll never get it. Put NPC35 as a sword or whatever. I don't remember if you have to put it on the map or not. |
|
Back to top |
|
 |
T-Master
Joined: 10 Dec 2003 Posts: 74
|
Posted: Sun Feb 01, 2004 1:08 pm Post subject: |
|
|
You code like Bobby Blade.
MCW is correct. |
|
Back to top |
|
 |
Flamer The last guy on earth...

Joined: 04 Feb 2003 Posts: 725 Location: New Zealand (newly discovered)
|
Posted: Sun Feb 01, 2004 2:33 pm Post subject: Re: Zelda-esque attack script |
|
|
jabbercat wrote: |
Code: |
if(keyispressed(key:z))then , begin , else , end
if(attackage==0)then,begin,else,end
|
|
one question, is "else" an autonumbered script... coz it looks confusing like it was going to execute an else factor the if statement... _________________ If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch
(no offense to anyone that was mentioned) |
|
Back to top |
|
 |
jabbercat Composer

Joined: 04 Sep 2003 Posts: 823 Location: Oxford
|
Posted: Sun Feb 01, 2004 2:41 pm Post subject: |
|
|
No , its only an else command , I probalby don't really need it . |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Feb 01, 2004 9:08 pm Post subject: |
|
|
Yes, I have to ask, what on earth
if(keyispressed(key:z))then , begin , else , end
supposed to do? The first step to firsting you step is probably to re-read the dictionary concerning flow control. THat line will simply not work.
And, why are you using hx, hy, and d if you haven't initailised them yet? Finally, what is
walknpc(35,d)
meant to do? _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
jabbercat Composer

Joined: 04 Sep 2003 Posts: 823 Location: Oxford
|
Posted: Mon Feb 02, 2004 12:48 am Post subject: |
|
|
ah , yeah , abit of the script got cut out it apperes .
Code: |
script,theattack,who,begin
variable(attackage,hx,hy,inpcx,inpcy,d,r)
if(keyispressed(key:z))then , begin
if(attackage==0)then,begin
hx:=herox(me)
Hy:=heroy(me)
d:=herodirection(me)
r:=12
if(d==north)then(decrement(hy))
if(d==south)then(increment(hy))
if(d==west)then(decrement(hx))
if(d==east)then(increment(hx))
inpcx:=npcx(35)
inpcy:=npcy(35)
attackage:=1
createnpc(35,hx,hy,d)
walknpc(35,d,20)
if(walknpc(35,d,r)==false)then(destroynpc(35),attackage:=0)
if(npcatspot(inpcx,inpcy,who))then ,begin, hitenemy
if(npciswalking(35)==false)then(destroynpc(35),end
end
end
|
|
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Feb 02, 2004 1:20 pm Post subject: cleaned-up and commented |
|
|
script,theattack,who,begin
variable(attackage,hx,hy,inpcx,inpcy,d,r)
if(keyispressed(key:z))then , begin
if(attackage==0)then,begin
hx:=herox(me)
Hy:=heroy(me)
d:=herodirection(me)
r:=12
if(d==north)then(decrement(hy))
if(d==south)then(increment(hy))
if(d==west)then(decrement(hx))
if(d==east)then(increment(hx))
# this part looks like a problem. You are getting the X and Y
# of the first instance of NPC 35... but does NPC 35 even exist
# on the map yet?
inpcx:=npcx(35)
inpcy:=npcy(35)
attackage:=1
# only now is NPC 35 created, using the position of... NPC 35?
createnpc(35,hx,hy,d)
walknpc(35,d,20)
# here is another problem. walknpc is not a function.
# it does not return a value, and should never be used
# in an "if". walknpc(35,d,r) is ALWAYS equal to false,
# so the NPC will always be destroyed.
if(walknpc(35,d,r)==false)then(destroynpc(35),attackage:=0)
# it is important to understand that this script, everything
# happening inside the "if(keyispressed(key:z))" block
# is all happening in a single game tick. NO TIME PASSES!
# I am guessing that this following command is intended to
# check if the shot NPC touches an enemy NPC, but this cannot
# be done here. Instead, you need to do the check in a
# separate script that loops continuously in the background.
if(npcatspot(inpcx,inpcy,who))then ,begin, hitenemy
# by this time, the NPC has already been destroyed,
# Oh, and using a "(" followed by a n "end" works, but can be
# confusing to read.
if(npciswalking(35)==false)then(destroynpc(35),end
end # attackage
end # keyispressed
|
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Feb 02, 2004 1:28 pm Post subject: from not-formatted-correctly department |
|
|
Grrr! [code] won't let me use color, and <pre> adds a million spaces! oh well... |
|
Back to top |
|
 |
Fenrir-Lunaris WUT

Joined: 03 Feb 2003 Posts: 1747
|
Posted: Mon Feb 02, 2004 2:02 pm Post subject: |
|
|
While we're back on the subject of zelda-attack scripts...
Would it be possible to actually script an OHR "Gradius"?
It's definately possible to make a lazer script, since it's been done in "Startrek Cheapskate" (sp?). I'm pretty sure modifying the Zelda attack script is the key, though I've tried it with limited results. The best I've been able to accomplish is to make the 'attack' appear a certain set distance away from the player, since making the attack actually move will only kill an NPC if it stops right when an NPC walks or stops on it. Not very effective. Also, adding extra things like missiles, etc is just a simple manipulation of checking if a certain tag is on, then firing that attack along with the normal fire.
I don't believe that making a automatic-sidescrolling script is realistically possible. You'd somehow or other have to keep the Vic Viper/HAM Hamster/Zig moving only within the limits of the screen and still be able to move around that screen.
It's also possible to make certain enemies be able to withstand more than one hit, since it's been done in at least one game I've seen.
So what's the verdict? |
|
Back to top |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Mon Feb 02, 2004 3:32 pm Post subject: |
|
|
For the auto screen scrolling, just make an npc that you have walk in one direction to the end of the stage, and center the camera on that npc. Then add in some if-thens to move the hero if they are sitting on the edge of the screen.
For a laser, I'd probably check the pixel location of the laser beam and if it was in a certain area around the enemy kill it. _________________ UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START |
|
Back to top |
|
 |
planethunter Lost In Emotion

Joined: 07 Jul 2003 Posts: 258 Location: Éire
|
Posted: Tue Feb 03, 2004 11:50 am Post subject: |
|
|
it would be much simpler to set the laser npc created to 'pace' and add a delay to the npc's deletion... that way the npc created would travel in the intended direction for a while. Though obviously, if the laser npc hits a wall then it would change direction, but this could even be a positive factor, if your considering to make something similar to the bomerang used in the early zelda games. _________________ ~PH
 |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Feb 03, 2004 10:02 pm Post subject: |
|
|
It doesn't matter. You can easily turn off npc walls with no effect on the baby-bob side scrolling script.
FL, you need to add a section to the side scrolling script that checks every tick :
Whether a laser shot has been fired
Check whether any of the laser shots have collided with anything, be it wall or enemy
Destroy if so, plus take health/destroy enemies
Destroy a laser shot once it has reached its age limit
You should have a separate piece of code that interprets keypresses and creates a laser shot if possible. Use walk npc to make it move. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|