View previous topic :: View next topic |
Author |
Message |
Chaotix Has a fan!

Joined: 03 Oct 2006 Posts: 205 Location: That one place
|
Posted: Sat Feb 17, 2007 9:54 am Post subject: On Keypress vehicles? |
|
|
Is it possible to use an on keypress script, to get your character to use a vehicle? I am wanting my game to have it to whee my character changes to a different sprite when he jumps into the water, to make it look like he is swimming, giving easy access to get into water any where the is water that you can stand next to. I also plan on my characters to hopefully be able to eventually fly when ever they wish to, instead of havening to go to an NPC.
I think this could benefit most of the ohr community to be able to do this! _________________ I drew my Icon!
My forums:
http://www.freeforum101.com/*coming soon* |
|
Back to top |
|
 |
Newbie_Power

Joined: 04 Sep 2006 Posts: 1762
|
Posted: Sat Feb 17, 2007 11:25 am Post subject: |
|
|
I think instead of a vehicle for water, you can just use a plotscript that changes your character sprite into a swimming one and you just walk across the water with a swimming animation. No vehicles required.
You just need to have this script activated at the inner edges of the water (use an invisible NPC that you can walk on), and remove all passability surrounding said water since you are able to freely swim in it anyway.
Oh, and when your character gets out of the water, have a second invisible NPC on the grass that changes your walkabout animation back to normal. |
|
Back to top |
|
 |
Chaotix Has a fan!

Joined: 03 Oct 2006 Posts: 205 Location: That one place
|
Posted: Sat Feb 17, 2007 12:17 pm Post subject: |
|
|
what would happen though, if you stepped on an npc on the grass, if you are already walking on the grass.
I do like the idea though! _________________ I drew my Icon!
My forums:
http://www.freeforum101.com/*coming soon* |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Sat Feb 17, 2007 12:23 pm Post subject: |
|
|
Quote: | what would happen though, if you stepped on an npc on the grass, if you are already walking on the grass. |
A single tag could easily solve that problem. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Feb 17, 2007 4:36 pm Post subject: |
|
|
That method has pitfalls though: there's a 300 NPC limit which might not be enough to coat all your beaches with a 2 NPC thick layer.
An on-footstep script could check whether the hero is entering water or leaving it and change the sprite accordingly. The problem would be that you would walk onto the water tile and swim onto the beach tile before the script is triggered and the sprite changed. That in turn can be solved with even more complicated scripting, or going back to the on keypress idea. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Chaotix Has a fan!

Joined: 03 Oct 2006 Posts: 205 Location: That one place
|
Posted: Sat Feb 17, 2007 4:42 pm Post subject: |
|
|
This should work, since my game will not have an over world. My game is going more along the lines of a secrets of mana world. Where every thing is connected, and not by an over world. _________________ I drew my Icon!
My forums:
http://www.freeforum101.com/*coming soon* |
|
Back to top |
|
 |
FyreWulff Still Jaded

Joined: 02 Apr 2005 Posts: 406 Location: The Internet
|
Posted: Sun Feb 18, 2007 3:23 pm Post subject: |
|
|
A script that changes the walkabout and modifies the passability of the map would be a lot better than trying to use vehicles in their current form, since I believe you would need to make the vehicle NPC for every single map and set it to the same NPC (to prevent having to make a big if/then switch). This also makes you lose 1 NPC for all maps that have water on them.
Here's my psuedocode..
requires a global variable named "heromode" (hero locomotion mode)"
and 3 constants
heroswimming
herowalking
heroflying
(just make them different numbers. 0, 1, 2 will work just fine)
(This is a lot more effiecent than checking tags)
The Code wrote: |
script, changelocomode, begin
check the key
if key is swim key then
check which tile is in front of hero
if tile is water
if global variable heromode equals herowalking
animate jump into water
change hero picture to swimming
change other things like speed, music if you want to
set global variable heromode to heroswimming
end global variable if
end tile is water if
else then
# we can assume every other tile is ground
if global variable heromode equals heroswimming
animate jump out of water
change hero picture to walking
change other things like speed, music
set global variable heromode to herowalking
end global variable if
end the else
end swim key if
|
|
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Tue Feb 20, 2007 7:00 am Post subject: |
|
|
The every-step script will work, but it may look weird graphically since the game will wait until you are done stepping to see whether or not you are in the water. Thus you will swim onshore for a bit. It may be be better to use a keypress script (I'm assuming this gets called earlier than an every-step script). I'm not sure if you will want to check your current tile or the tile one unit away in the direction you are facing.
In my game I have the party able to fly anytime they wish on the overworld map near the end. I do it with a vehicle and an item attached to a textbox then attached to a script. Since we have the command 'Use NPC' we can make the party board any vehicle we want as long as it is on the map. This takes care of elevation, walls, a shadow, and dismounting rather than having to plotscript them all myself. I think I'd recommend the same to you for the flying part, but again you will need to reserve one NPC in every map, preferably the same one (I'd use NPC 35). _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
Back to top |
|
 |
|