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

Job class alteration script

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Fri Sep 12, 2003 3:35 am    Post subject: Job class alteration script Reply with quote

In trying to work through FF3H and set up a job class script, I've run into more problems than it's worth. Here's the lowdown...

I have 4 items in my inventory that when used will run a script (I know how to do this already). The script (which I have no clue on how to run) will save the player's X and Y coordinates on that map, warp them to a special selection screen for that specific character (in this case, the human character uses their item, and they go to his map to change into a certain class). Once on the selection map, a handy pointer NPC will appear next to a list of up to 10 classes the player can choose from, and depending on the pointer's location, it will change that hero into that class, drop or add certain abilities, equip certain items, and then return the player BACK to the map they originally came from. I can do the minor things, but the NPC moving and selecting things on the player's control is something I cannot do with my limited knowlege of plotscripting, nor can I do the remember where the hero was bit.

-----------------------
|-> Onion H |
| Knight |
| Theif |
| Etc... |
------------------------

To prevent the player from screwing this up, I may have to remove the four class items from their inventory, then return them later. This may actually have to get split into two different scripts, one to get them to this map, and the second would change their class and return them. I'm not sure on that yet, but that's the situation as best as I can describe it.

The lowdown, I need the functions to remember where the hero was, and another to make an NPC move in the direction the hero does and remotely activate NPCS when the cursor is next to them.
Back to top
View user's profile Send private message
Aethereal
SHUT UP.
Elite Designer
Elite Designer



Joined: 04 Jan 2003
Posts: 928
Location: Gone! I pop in on occasion though.

PostPosted: Fri Sep 12, 2003 4:44 am    Post subject: Reply with quote

Hmm, I don't have enough time to completely write a script for you, but I can tell you how to do those things.

For remembering your hero's X and Y and map location, simply record them in variables:
Code:

set variable (herox, hero x (me))
set variable (heroy, hero y (me))
set variable (heromap, current map)

Now, you can use teleporttomap() with those variables and it will place your hero where he last was.

As for the second one, I wouldn't use NPCs (well, except as graphical representations, but you can do that with maptiles too, if you want), and what I would do is teleport your party to a section of map that has overhead tiles so they are hidden there, and use a while() loop in conjunction with keyispressed() to move the pointer, which is an NPC, and when the player hits enter, based on where the pointer is, it will change their job to the appropriate class. For example, let's say that the spot that the pointer is on where it points to Black Mage is 30, 35, and the spot where it sits next to White Mage is 30, 36. The hand will be NPC 0.
Code:

set variable (loop, true)
while (loop)
do(
        if(key is pressed(80)) #down
        then(
                walk NPC (0, down, 1)
               )
        #repeat that for left, right, and up
        if(key is pressed(57)) #spacebar
        then(
                if (NPC Y (0)==35)
                then(
                           #insert stuff to change to Black Mage
                           set variable (loop, false)
                           end
               if (NPC Y (0)==36)
               then(
                           #insert stuff to change to White Mage
                           set variable (loop, false)
                           end
               end
end
end

Try something like that.
_________________
Back to top
View user's profile Send private message Send e-mail AIM Address
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Fri Sep 12, 2003 4:45 am    Post subject: Reply with quote

Okay, to remember where the hero is, you'll want a few globals, one for the hero's X, one for the Y, and one for the current map. When the script is called through the item, the first thing you do is set each of those variables to the hero's current X (function: herox(who), I believe), Y (heroy(who)), and the map (current map).
To move the NPC and activate the other ones . . . I would use an on-keypress script that checks what key is pressed and changes the NPC's position or activates the appropriate NPC based on the pointer NPC's position.This would all be contained in one script which is set as the on-keypress script for the job selection map.
When you want to get back to the normal map, you would check for the "back" key being pressed, and teleport to map(map global, x global, y global). I'm pretty sure those are the functions you'll need, but I would check in the Plotscript Dictionary just to make sure. The Plotscript Dictionary is your god when it comes to scripts like this, so use it to death.
_________________
UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START
Back to top
View user's profile Send private message AIM Address
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Fri Sep 12, 2003 7:47 am    Post subject: Reply with quote

Granted a job system has been done before... but not with more than one character, so this could probably get pretty sticky. I'll post what I have thus far in case any corrections need to be made:

Code:
global variable(6,hero map)
global variable(7,me X)
global variable(8,me Y)


script,humancrystal,begin
 set variable(me X,hero X(0))
 set variable(me Y,hero Y(0))
 set variable(hero map,current map)
 wait (5)
 fade screen out (63,63,63)
 wait (5)
 teleport to map (2,0,0)
 fade screen in
 wait (2)
end


Following the insructions I've received from many people, here is the end result for one specific character. It the moment, the only thing that's actually special about this is that it's used specifically for one character. If I needed to do another, here's another script as an example.

Code:
global variable(6,hero map)
global variable(7,me X)
global variable(8,me Y)


script,elfcrystal,begin
 set variable(me X,hero X(0))
 set variable(me Y,hero Y(0))
 set variable(hero map,current map)
 wait (5)
 fade screen out (63,63,63)
 wait (5)
 teleport to map (4,0,0)
 fade screen in
 wait (2)
end


Both actually use the same three global variables, the difference being that one takes the player to a different map where the selection would change that character's class, and not the other's. The system in theory works, though there's a few minor bugs to work out.

And while I'm not sure if this one works or not, it appears sound. Credit to Aetherial on this one.

Code:
script,humanjob,begin
 set variable (loop, true)
 while (loop)
 do(
        if(key is pressed(80)) #down
        then(walk NPC (0, down, 1))

 
        #repeat that for left, right, and up
        if(key is pressed(57)) #spacebar
        then(
                if (NPC Y (0)==0)
                then(
                           #insert stuff to change to Onion
                           set variable (loop, false)
                           end
               if (NPC Y (0)==1)
               then(
                           #insert stuff to change to Knight
                           set variable (loop, false)
                           end
               if (NPC Y (0)==2)
               then(
                           #insert stuff to change to Theif
                           set variable (loop, false)
                           end
#Repeat with a slightly different Y for each class on the list
 end
end


This is what I'm not entirely sure about. The player is actually concealed under overhead tiles, and prevented from moving by ipassable tiles. Meanwhile there's a selector (a hand or crystal or whatever) which when spacebar is pressed should change that specific character's sprites, abilities, and anything else into whatever would change them into, say, a Knight or whatever, THEN sets them back at the location they were at before they called up the job select screen. I'm not too keen on the loop thing, since it may eventually lock up the script and cause some serious buffer overflows or something.
Back to top
View user's profile Send private message
Flamer
The last guy on earth...




Joined: 04 Feb 2003
Posts: 725
Location: New Zealand (newly discovered)

PostPosted: Fri Sep 12, 2003 5:23 pm    Post subject: Reply with quote

try this, it just came to me...
but you'll need to set the textboxes to set tags on.
like if the player used the elf crystal, the textbox saying using elf crystal will display and set tag on before the script starts.


Code:
global variable(6,hero map)
global variable(7,me X)
global variable(8,me Y)

script,crystal,begin
set variable(me X,hero X(0))
set variable(me Y,hero Y(0))
set variable(hero map,current map)
wait (5)
fade screen out (63,63,63) 
if(check tag(tag:elf)==on) then(
teleport to map (4,0,0) )
if(check tag(tag:species2)==on) then(
teleport to map (3,0,0) )
#keep going....
set tag(tag:elf,off)
set tag(tag:species2,off)
wait (5) #personally put the wait here, it's just in case game teleports in a messy way.
fade screen in
wait (2)
end


Edit: damn code... anyway hope this goes well
_________________
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 Raspberry!
(no offense to anyone that was mentioned)


Last edited by Flamer on Wed Sep 17, 2003 2:21 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Aethereal
SHUT UP.
Elite Designer
Elite Designer



Joined: 04 Jan 2003
Posts: 928
Location: Gone! I pop in on occasion though.

PostPosted: Fri Sep 12, 2003 10:17 pm    Post subject: Reply with quote

As long as you add a wait (1) at the very end of the loop before the end declaration, you should have no script buffer problems. Yes, I didn't add that, but I didn't think I needed to, as I thought that was implied, but I guess I was wrong.
_________________
Back to top
View user's profile Send private message Send e-mail AIM Address
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Fri Oct 17, 2003 1:28 am    Post subject: Reply with quote

My Halloween contest entry uses the Job Class script (didn't want it to go to waste, and I needed to test it out anyway). It worked fine, that is until I decided to make it so it would add/remove spells depending on the class you switched to and the items you had. Now it won't compile at all.
Code:
script,classchange1,begin

 set hero picture (find hero (hero:Dart),0,inside battle)
#The next three spells are technically 'command abilities'
#which are gained after the character reaches a certain level.
#There's no problem compiling them at all.

 write spell (find hero (hero:Dart),0,0,99)

 if((get hero level (hero:Dart))>=15) then(write spell (find hero (hero:Dart)),0,1,101) else(write spell (find hero (hero:Dart),0,1,0))

 if((get hero level (hero:Dart))>=30) then(write spell (find hero (hero:Dart)),0,2,103) else(write spell (find hero (hero:Dart),0,2,0))

#Now the next few series is where it gets tricky.
#In game, you purchase an item that when you have it,
#anyone who turns into certain classes can cast the spells
#that go along with that item.  Think of how FF5 handled it's magic #system.  Same way, in theory.

 if(check tag (tag:K1,on)) then(write spell (find hero (hero:Dart)),0,3,74) else(write spell (find hero (hero:Dart)),0,3,0))

 if(check tag (tag:K2,on)) then(write spell (find hero (hero:Dart)),0,4,75) else(write spell (find hero (hero:Dart)),0,4,0))

 if(check tag (tag:K3,on)) then(write spell (find hero (hero:Dart)),0,5,76) else(write spell (find hero (hero:Dart)),0,5,0))

 if(check tag (tag:K4,on)) then(write spell (find hero (hero:Dart)),0,6,77) else(write spell (find hero (hero:Dart)),0,6,0))

end


Once it gets to the individual spell checks to add or remove them, I get errors saying it expected a 'top level declaration, but found flow control if', then it suggests that there's an extra end or ) somewhere in the file. It's copied EXACTLY from the script file, so what you see above is EXACTLY what I have written.

What I want is to make it so that it checks for the presence of 12 tags (K1 - K12), then adds or deletes the spell in those slots whether that tag is on or off. How do I do that though?
Back to top
View user's profile Send private message
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Fri Oct 17, 2003 1:33 am    Post subject: Reply with quote

Never mind. Thellos, who knows literally NOTHING about plotscripting pointed out the extra ")" after looking through it after about 30 seconds.

Thellos: You revived a thread for THIS?

Well, I like to conserve space, and opening a new thread for more or less the same topic seemed pointless.
Back to top
View user's profile Send private message
Flamer
The last guy on earth...




Joined: 04 Feb 2003
Posts: 725
Location: New Zealand (newly discovered)

PostPosted: Fri Oct 17, 2003 4:44 am    Post subject: Reply with quote

at least we know that the script is running okay now...

let's see how it turns out, i can't wait to see it to be honest.
_________________
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 Raspberry!
(no offense to anyone that was mentioned)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Sat Oct 18, 2003 3:37 pm    Post subject: Reply with quote

I got a job class system for multiple characters working for my latest
game... but it probably wouldn't help you because of the way jobs work
in my game.

... So I guess I had no reason to reply, really. XD
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mr B




Joined: 20 Mar 2003
Posts: 382

PostPosted: Mon Oct 20, 2003 11:16 am    Post subject: Reply with quote

Booty? Theif?

*sing-song voice*: 'I' before 'e', except after 'c', or when sounding like 'ay' as in 'neighbor' and 'weigh'. ... Except for 'weird' 'cause it's weird.

I'm afraid that I can't add much more to the conversation than that. But yes; use the plotscript dictionary..! It will save you major grief.

Good luck! I eagerly await the fruit(s) of your labor(s). Happy
Back to top
View user's profile Send private message
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