Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

How do I make an event happen at a certain X and Y on a mapâ

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Mon Feb 20, 2006 6:37 pm    Post subject: How do I make an event happen at a certain X and Y on a mapâ Reply with quote

…with and/or without any NPCs? Possibly having it to where at different X,Y coordination combos, different things happen. Like, if a hero was standing in the middle of a 16×10 map (7,5 being the X,Y combo), if the player pressed the Use Key (Ctrl, Enter/Return or Space), the hero would get warped to a specific X,Y on another map. Of course, if the hero was somewhere else (say, 12,2 as the X,Y), and he pressed something like the 'R' key, then the script would be set to make him/her run around in a circle three times, fade the screen out to black, play a short song, then fade the screen back in, where the hero would discover his HP and MP fully restored.

Is it possible to do something like that?

P.S.: soory if you can't understand my babbling. -.-;
Back to top
View user's profile Send private message Yahoo Messenger
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Mon Feb 20, 2006 11:29 pm    Post subject: Reply with quote

If it helps, it's for this Map Engine I'm working on that emulates the Final Fantasy: Mystic Quest (or Mystic Quest Legend, in Europe) world-map style.

I've managed to finish the main stuff, but I can't figure out how to get into 'towns' without using more NPCs, or even worse, having to use doors and auto-enter the different places on the map.

Any help on this would be fantastic.

TiA! Happy

Kizul
Back to top
View user's profile Send private message Yahoo Messenger
Gizmog1
Don't Lurk In The Bushes!




Joined: 05 Mar 2003
Posts: 2257
Location: Lurking In The Bushes!

PostPosted: Tue Feb 21, 2006 5:03 pm    Post subject: Reply with quote

You could probably do it all with one npc. Just put an instance of that npc everywhere you want something to happen and run an "If "Heroat "X,Y" type thing. I didn't look at the file, and I'm not 100% sure what you're talking about, but if that fails, you could probably use a while loop to do the same thing, although that'd interfere with other stuff, and it'd be running nigh constantly. Just a thought.
Back to top
View user's profile Send private message Send e-mail AIM Address
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Tue Feb 21, 2006 7:27 pm    Post subject: Reply with quote

Gizmog1 wrote:
You could probably do it all with one npc. Just put an instance of that npc everywhere you want something to happen and run an "If "Heroat "X,Y" type thing. I didn't look at the file, and I'm not 100% sure what you're talking about, but if that fails, you could probably use a while loop to do the same thing, although that'd interfere with other stuff, and it'd be running nigh constantly. Just a thought.


Thank you, I'll try that right now. :3
Back to top
View user's profile Send private message Yahoo Messenger
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Wed Feb 22, 2006 3:37 pm    Post subject: Reply with quote

You could also use an "On Keypress Script" like this:

Code:
script, do stuff, begin
  if(hero X(me) == 7, and, hero Y(me) == 5, and, key is pressed(key:ctrl)) then, begin
    #do whatever
  end
  if(hero X(me) == 2, and, hero Y(me) == 8, and, key is pressed(key:X)) then, begin
    #do something else
  end
end

_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Thu Feb 23, 2006 10:43 am    Post subject: Reply with quote

Thanks, I got it working. Took me a while to figure out where in my scripts to put it, but I got it figured out eventually. :3

Download 2.0!

…say, do you think I should add this to the Game List here on CP? O.o

Edit: just added it. The download link now points to that page. :3


Last edited by Kizul Emeraldfire on Thu Feb 23, 2006 11:50 am; edited 1 time in total
Back to top
View user's profile Send private message Yahoo Messenger
Jack
the fool




Joined: 30 Jul 2004
Posts: 773

PostPosted: Thu Feb 23, 2006 11:07 am    Post subject: Reply with quote

Quote:
…say, do you think I should add this to the Game List here on CP? O.o


that is what it's there for.
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Tue Mar 28, 2006 12:56 am    Post subject: Reply with quote

Note: I have put this reply into this thread to help reduce clutter in the HamsterSpeak Suggestion Thread, as this is more of a "Help Me!" post than a "Hey, can you add this? :D" post. :) I am sorry that it's so long. :(

The Mad Cacti wrote:
I had a look at your demo, and it is pretty cool but I noticed another bug: as you move from house to house the scripts don't terminate and it keeps stacking on more scripts. Try pressing F10 while running it. The problem is in animatearrows not quiting. Your options include handling the arrow animation either by animated tiles (would need a stepon npc as well though), npcs animating as they spin in a trapped space, or having animatearrows check if the player moves and quit (this would probably be best).


Actually, the arrow NPCs just change their frame from 0 to 1 in a loop. I took your advice and hit F10 while running it, and it takes about 100-150 triggerings of the NPCs on top of the 'towns' to overload the script buffer. I don't know how to get any of the scripts to deactivate, though. -_-; I'm not a very advanced scripter. How do I terminate scripts? :( Is there a plotscripting command to do it? In fact, I don't even really know exactly why the Town × scripts just keep piling up. All that's in them is basically this:
Code:
set hero direction (me,south)
wait

delete arrow paths
wait

draw flashy arrows for townA
resume player
draw path arrows for townA
animate arrows
wait

end


You're probably right, it may just be something in Animate Arrows, but again, there's not much in that, either:

Code:
variable (loop)
for (loop,1,2,0) do (
   set NPC frame (0,0)
   set NPC frame (1,0)
   set NPC frame (2,0)
   set NPC frame (3,0)
   wait (3)
   set NPC frame (0,1)
   set NPC frame (1,1)
   set NPC frame (2,1)
   set NPC frame (3,1)
   wait (3)
   )
)


The Mad Cacti wrote:
As for suspending a key, see what I just posted in http://www.castleparadox.com/ohr/viewtopic.php?t=4054 about doing that with current commands. You could have 4 tags, tag:suspendupkey, etc, and an onkeypress handler that checks the tags and blocks whichever keys are needed. You could possibly put it in animatearrows rather than an onkeypress script.


For some reason, when I tried using what you'd suggested in that thread (though I used different keys), it didn't work. What I mean is, the keys still worked, even though I'd "disabled" them. :/ I haven't done the other two methods you suggested yet, though. I'll try those and see if one of them works. :)
Back to top
View user's profile Send private message Yahoo Messenger
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Tue Mar 28, 2006 11:59 am    Post subject: Reply with quote

Which keys did you use? TMC's script only applies to the default interface keys (Select, Cancel, etc.), not to any random keys.

So, to prevent the menu from showing up (i.e. the Cancel key), you need to screen for Escape and Alt.
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Kizul Emeraldfire
Type: Cyber Dragoon




Joined: 26 Mar 2004
Posts: 229

PostPosted: Tue Mar 28, 2006 3:22 pm    Post subject: Reply with quote

Mike Caron wrote:
Which keys did you use? TMC's script only applies to the default interface keys (Select, Cancel, etc.), not to any random keys.

So, to prevent the menu from showing up (i.e. the Cancel key), you need to screen for Escape and Alt.


Well, I use the arrow keys on the keyboard to move, so I tried to get 'key:up' and so on frozen, but HSpeak kept complaining that they weren't defined as anything. So I did the scancodes 80, 75, and so on for the arrow keys. That didn't work, either. :/
Back to top
View user's profile Send private message Yahoo Messenger
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Tue Mar 28, 2006 6:50 pm    Post subject: Reply with quote

Code:
include, scancode.hsi


Add that somewhere near the top of the file (probably underneath "include, plotscr.hsd")
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Apr 01, 2006 10:16 pm    Post subject: Reply with quote

I've heard some people report a bug inTirgoviste where that technique fails to work. It should - and used to.


Anyway, that's not the version of animate arrows in your scripts file

Code:
script, animate arrows, begin

variable (loop)
for (loop,1,10000,0) do (
   set NPC frame (0,0)
   set NPC frame (1,0)
   set NPC frame (2,0)
   set NPC frame (3,0)
   wait (3)
   set NPC frame (0,1)
   set NPC frame (1,1)
   set NPC frame (2,1)
   set NPC frame (3,1)
   wait (3)
   )
)


Now I've sort of forgotten how exactly your scripts worked, so I'm going by what I said at the time. I assume that the player moves a hero in a direction, and they step on an npc and it triggers a script which walks to another town. So you could make the animate arrows script quit when the player hits a move key (so it should quit BEFORE the npc is tirggered):


Code:
script, animate arrows, begin

variable (stop, loop)
for (loop, 0, 9999) do (
        if (loop, mod, 6 == 0) then (
           set NPC frame (0,0)
           set NPC frame (1,0)
           set NPC frame (2,0)
           set NPC frame (3,0)
        )
        if (loop, mod, 6 == 3) then (
           set NPC frame (0,1)
           set NPC frame (1,1)
           set NPC frame (2,1)
           set NPC frame (3,1)
        )
        if (key is pressed(key:left), or, key is pressed(key:right), or, key is pressed(key:up), or, key is pressed(key:down)) then (loop := 10000)
   wait (1)
)
end

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
JC




Joined: 25 Mar 2006
Posts: 8

PostPosted: Sun Apr 02, 2006 1:22 am    Post subject: Reply with quote

Yikes, you should set it to 9999, not 10000... I believe For loops wait for that number to be EQUAL to the chosen value, since you can also make it count DOWN (by saying, for example, For(i,10,1,-1) or such).

It might get stuck going forever, if you do it that way.

It's even better to just make it a while loop that quits if either it's gone through so many loops, or the player presses a key. That way, you can quit it easily, with a boolean, rather than with a comparison with an integer. o_O;
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Apr 02, 2006 6:15 am    Post subject: Reply with quote

JC wrote:
Yikes, you should set it to 9999, not 10000... I believe For loops wait for that number to be EQUAL to the chosen value, since you can also make it count DOWN (by saying, for example, For(i,10,1,-1) or such).


Not true:

Code:
     tmpnow = readscriptvar(tmpvar)
     IF (tmpnow > tmpend AND tmpstep > 0) OR (tmpnow < tmpend AND tmpstep < 0) THEN
      scrat(nowscript, curargn) = 6
     ELSE
      scrat(nowscript, scrstate) = stdoarg'---execute the do block
     END IF


(scrat(nowscript, curargn) = 6 meaning "break loop")

Yeah, I was being a little lazy and let the for take care of variable incrementing for me. Feel free to change it. I got sort of part way there, adding the stop variable which I forgot about. What we really need is a break statement.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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