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

Show custom list of stats on screen

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Thu Aug 07, 2008 5:03 am    Post subject: Show custom list of stats on screen Reply with quote

Ok, so, I'm working on a custom stat screen, which allows the player to raise any stats with 3 Stat Points per level.
I've figured out some of the scripting and I have a general idea of how it should work
( If hero's current level increases,
give hero 3xSP item.
Send to stats screen
If player selects stat (ex: STR)
then add current stat +1,
remove 1xSP
etc....)

But my problem is how to actually show the player the stats he is selecting and what level they're at. As in:
-Show current player stats on screen in form of a list
-Replace hero by cursor
-If cursor selects a stat, shows that 1 point is added in that stat, so the number representing that current stat raises by 1.
I'm not sure I made myself very clear, it's kinda hard to describe what I'm trying to get.
if this helps: I'm not trying to make the hero's status screen pop-up.
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Thu Aug 07, 2008 5:30 am    Post subject: Reply with quote

It's not too complicated to work out.

You will be using strings. Many, many strings.
'Strings'
Back to top
View user's profile Send private message Send e-mail AIM Address
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Thu Aug 07, 2008 5:42 am    Post subject: Reply with quote

TwinHamster wrote:
It's not too complicated to work out.

You will be using strings. Many, many strings.
'Strings'


Dam strings >_<
My only (not really only) weakness T_T

I guess I'm gonna have to learn to use strings...
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Thu Aug 07, 2008 10:44 am    Post subject: Reply with quote

Hmm...I've read about the strings and stuff, I think I got it, but I'm not 100% sure, could someone exaplin setting the string IDs to me?
Examples of what I thought of:
Code:
$1 ="get hero stat (0, stat:Atk)"
#Problem is: not sure how to use that "$1" in the string...
Show string at (ID, 4, 2)
# replace "ID" by "$1"?


Atfer I'm done figuring that out I set the get hero stat to add +1 and then I remove 1 SP from hero's inventory.

help?/corrections?/explanations?
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Thu Aug 07, 2008 11:07 am    Post subject: Reply with quote

By doing that, you'll be setting String #1 as "get hero stat (0, stat:Atk)", rather than the stat itself.

What you should try is:

Code:
Append Number (1, getherostat(0, stat:atk, current stat))


Which sets the Atk stat of the leader to String #1, which you can display with:

Code:
Show string at (1, 4, 2)


Which will show string #1 at Pixel 4 x-wise and Pixel 2 Y-wise.

There's no need to call it $1 unless you want to redefine it.

Also remember that when you finish up, you should use:

Code:

Clear string (1)
#So that the new value is not stuck to the old one
Hide String (1)
#So that the strings are invisiible.


So that you don't have any floating words or numbers floating around after the script ends.

Personally, at the end of scripts that use strings, I use a loop that nicely clears/hides all of them.

Code:

variable (count)

set variable (count, 30)

#In this case, I'm using 30 Strings.

while(Count>>0)
do(
hide string (count)
clear string (count)
set variable (count, count--1)
)

#Will clear strings until the variable Count is equal to 0.

Back to top
View user's profile Send private message Send e-mail AIM Address
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Thu Aug 07, 2008 12:29 pm    Post subject: Reply with quote

Awesome! Thanks a lot twinhamster!
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Thu Aug 07, 2008 2:32 pm    Post subject: Reply with quote

Ok, so, now I'm trying to make the game check the hero's level and save that before every battle, and after the battle it checks if the hero's current level is equal to the one before the battle. If it's greater, then it loads the stat script. I'm thinking of having it check the level for each character in the caterpillar, and then setting the "get hero level" for every hero in the caterpillar an after-battle script.
Help on how to make the script save the hero's level before battle?
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Thu Aug 07, 2008 3:21 pm    Post subject: Reply with quote

Use the command 'Hero Levelled(Hero ID)' instead.

It checks to see if the hero's level changed after the last giving of experience (through battle or plotscripting).

The command returns the number of levels that a hero has gained and can also be used to check for a level up.

See: 'How do I get it to run a script when I level up a certain hero (me)?'
Back to top
View user's profile Send private message Send e-mail AIM Address
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Fri Aug 08, 2008 9:34 am    Post subject: Reply with quote

Ok, so, I've written about 400 lines of script for this stat system and everytime I add something, it reminds me of something else I forgot to do and it's driving me insane. Could I ask for some help from anyone? I don't want to post the script on here, but I can send it to you through PM (or mail as a .txt document)
Here's what I've managed to do so far:
-All the strings are done
-I was trying to make it so that it teleports to a new map with the stat screen onto it but I then changed my mind since I don't know how to make the hero reappear at his previous spot in the map he was in originally. So I made it so that it sets the maptiles all black and hides the hero.
-I've done all the scripting for whatever stats are added for whatever hero on whatever slot after he/she levels up.
-I'm kinda stuck at the point where the arrow is an npc controlled by the player and when enter is pressed next to whatever stat it starts up the add that stat script.
-It's very messy. Very.

I was hoping to have someone help me with the last part and to polish the messiness/whatever I could of messed up (I always mess up somewhere).

It would be greatly appreciated.
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Aug 08, 2008 9:47 am    Post subject: Reply with quote

I'd rather not have to redo one of these, but I can provide a few more tips.

Quote:
-I was trying to make it so that it teleports to a new map with the stat screen onto it but I then changed my mind since I don't know how to make the hero reappear at his previous spot in the map he was in originally. So I made it so that it sets the maptiles all black and hides the hero.


Global Variables are your friends!
Before you teleport, try using something akin to:
Code:

set variable (My X, herox(me))
set variable (My Y, heroy(me))
set variable (My Map, current map)

This will save the map and x/y coordinates of your hero, making for an easty teleport to map (My Map, My X, My Y) when you want to get back.

I've got a messy old script for this from my previous version of Detelamane here, but it's pretty sick to read through.

Code:

#-------------------------------------------------------------------------------------------------------------------------------------

script, Level Up Stats, begin
suspend player


fade screen out (0,0,0)

#Distribute Stats!

#Bring Up Menu


teleport to map (1,15,0)

#Alter Existing NPC on map to match hero's image

#$1="Den"
show string at (1, 5, 13)

$2="Level Up!"
show string at (2, 5, 4)

$3="Distribute Points:"

#$4=

append number (4, Level Points)
3 $+ 4
show string at (3,126,6)



$5="Health    +"
$6="Stamina   +"
$7="Strength  +"
$8="Dexterity +"
$9="Wisdom    +"

show string at (5,6,27)
show string at (6,6,47)
show string at (7,6,67)
show string at (8,6,87)
show string at (9,6,107)

#Show Points added after the +!"

Append Number (20, Health Points)
Show String at (20, 96, 27)

Append Number ( 21,Stamina Points)
Show String at (21, 96, 47)

Append Number ( 22,Strength Points)
Show String at (22, 96, 67)

Append Number (23,Dexterity Points)
Show String at (23, 96, 87)

Append Number ( 24,Wisdom Points)
Show String at (24, 96, 107)



#Visuals are all set up to here.
#UI RIGHT NOW

set npc position (1, 5,1)

#Moving Cursor will be a keypress script
wait(5)
fade screen in

end



############################################################################



script, select stats, begin

if(
key is pressed (77)
)

then(
wait(1)

Add One Stat Point




)

if(
key is pressed (80)
)

then(
wait(1)
Cursor go down
)



if(
key is pressed (75)
)

then(
wait(1)
Point Unadded

)

if(
key is pressed (72)
)

then(
wait(1)
Cursor go up

)




#------------------------------------------------SPACE BAR IS FINISH---------------------------

if(
key is pressed (57)
)
then(


   if(Level Points<<1)
   then(

clear string (0)
clear string (1)
clear string (2)
clear string (3)
clear string (4)
clear string (5)
clear string (6)
clear string (7)
clear string (8)
clear string (9)
clear string (10)
clear string (11)
clear string (12)
clear string (13)
clear string (14)
clear string (15)
clear string (16)
clear string (17)
clear string (18)
clear string (19)
clear string (20)
clear string (21)
clear string (22)
clear string (23)
clear string (24)
clear string (25)

#Stat Distribution!!!
set variable (Stat 0, 0)
set variable (Stat 1, 0)
set variable (Stat 2, 0)
set variable (Stat 3, 0)
set variable (Stat 4, 0)
set variable (Stat 5, 0)
set variable (Stat 6, 0)
set variable (Stat 7, 0)
set variable (Stat 8, 0)
set variable (Stat 9, 0)
set variable (Stat 10, 0)
set variable (Stat 11, 0)

if(Leveled Hero==find hero (3), and, Den Level Token>>0)
then(

set variable (stat 0, 10*Health Points)
set variable (Stat 0, Stat 0+ Strength Points*2)

set variable (stat 1, 7*Stamina Points)
set variable (stat 1, stat 1+ wisdom points*2)

set variable (stat 2, strength points)
set variable (stat 2, stat 2+ 2*dexterity points)

set variable (stat 3, 2*Dexterity points)

set variable (stat 4, 2*Strength Points)

set variable (stat 5, Dexterity points)

set variable (stat 6, Wisdom Points)
set variable (stat 7, 2*Wisdom Points)

Pointer



)

if(Leveled Hero==find hero (4), and, Jonas Level Token>>0)
then(

set variable (stat 0, 13*Health Points)
set variable (Stat 0, Stat 0+ Strength Points*3)

set variable (stat 1, 5*Stamina Points)
set variable (stat 1, stat 1+ wisdom points*1)

set variable (stat 2, 2*strength points)
set variable (stat 2, stat 2+ dexterity points)

set variable (stat 3, Dexterity points)

set variable (stat 4, 3*Strength Points)

set variable (stat 5, Dexterity points)

set variable (stat 6, Wisdom Points)
set variable (stat 7, 2*Wisdom Points)
Pointer
)





# THIS WILL ALWAYS BE WRONG AS LONG AS DEN LEVELS AT SAME TIME AS JONAS.

if(leveled Hero==find hero (3), and, Den Level Token>>0)

then(
set variable (Den Level Token, 0)
Check Jonas Levelled
)

else(

#if(leveled Hero==find hero (4), and, Jonas Level Token<<1)

#then(


#THIS WILL BE CHANGED IN THE FUTURE

fade screen out (0,0,0)
teleport to map (my map, my x, my y)
set hero direction (me, my face)
wait (5)
fade screen in
resume player

set variable (Jonas Level Token, 0)
set variable (Den Level Token, 0)

)


)
)

end


script, cursor go down, begin

if(npcy(1)==1, or, npcy(1)==2, or, npcy(1)==3, or, npcy(1)==4)
then(
walk npc (1, down, 1)
wait for npc (1)
)

else(

if (npcy(1)==5)
then(
set npc speed (1, 10)
walk npc (1, up, 4)
wait for npc (1)
set npc speed (1, 4)
))
end


script, cursor go up, begin

if(npcy(1)==5, or, npcy(1)==4, or, npcy(1)==3, or, npcy(1)==2)
then(
walk npc (1, up, 1)
wait for npc (1)
)

else(

if (npcy(1)==1)
then(
set npc speed (1, 10)
walk npc (1, down, 4)
wait for npc (1)
set npc speed (1, 4)
)
)
end





##########################################################################################




Okay, this is essentially two scripts:

* A Setup script, which gets all of the initial strings and stuff displayed.
* A KeyPress script, which moves an NPC that'll let you distribute stats.

If you are able to read through all of this, I guess you deserve to ask questions.
Back to top
View user's profile Send private message Send e-mail AIM Address
MADSOFT Games
Representing more than 80% of the internet!




Joined: 06 Nov 2004
Posts: 221
Location: AWESOME land

PostPosted: Fri Aug 08, 2008 9:58 am    Post subject: Reply with quote

Hmm...the variable part is kinda what I really needed.
Thanks a lot twinhamster, also, I didn't really want someone to re-write my whole script, it makes me feel like I'm a noob who didn't go through the effort of actually trying to write it all myself. D=

But yeah, I read through yours and half of the stuff I didn't understand. Some things resemble mine, except mine looks more complicated and longer >_>;

And dam, I didn't think of what would happen if 2 chars leveled at the same time >_<

Question:
If I set a variable in one script can it be used in a different script? Or does it erase at the end of the script where it was created?
_________________
http://www.madsoftgames.net/
http://www.madsoftgames.org/
http://www.andrewdavid.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Aug 08, 2008 10:21 am    Post subject: Reply with quote

Quote:
Question:
If I set a variable in one script can it be used in a different script? Or does it erase at the end of the script where it was created?

Local variables can only be used in the script they were created in.
Code:

variable (Variable Name)
#Make one like this


Global Variables, on the other hand, are created outside of scripts and can be used anywhere.

Code:

Global Variable (ID, NAME)
#Create a Global Variable like this
Back to top
View user's profile Send private message Send e-mail AIM Address
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