View previous topic :: View next topic |
Author |
Message |
AdrianX ..yeah.

Joined: 13 Feb 2003 Posts: 286 Location: Batangas City,Philippines
|
Posted: Wed Mar 10, 2004 3:23 am Post subject: pick hero.. |
|
|
..hello.i was wondering, how do we use the "pick hero" plotscript command?someone please explain and put a very short and simple example on when to use it?..
..also,i've asked this question two or three times before, gets an answer,but always forget about it:how can i use the "multiple ifs"?i mean,something like,if () and if () then..hope you know what i mean..
thanx!! |
|
Back to top |
|
 |
Aethereal SHUT UP. Elite Designer


Joined: 04 Jan 2003 Posts: 928 Location: Gone! I pop in on occasion though.
|
Posted: Wed Mar 10, 2004 6:51 am Post subject: |
|
|
I can answer both of your questions.
The pickhero() function pulls up a box that lets the player select a hero and the hero that they picked is returned by the function. Let's say you were scripting some kind of minigame that only one hero can participate in, but you want the player to be able to choose which hero will participate in it, and you have three heroes in your party. This is how you would use pickhero():
Code: |
if (pickhero == 0)
then(
#Do stuff so that hero 0 is the hero in the minigame
end
if (pickhero == 1)
then(
#Do stuff so that hero 1 is the one in the minigame
end
if (pickhero == 2)
then(
#Blah blah hero 2
end
end
|
As for multiple Ifs, it would be accomplished like this. Let's say you want something to happen only if tags 3 and 4 are both on. This is what you would write:
Code: |
if (checktag(3))
then(
if (checktag(4))
then(
#Do stuff
end
end
end
|
_________________
 |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Wed Mar 10, 2004 10:43 am Post subject: |
|
|
Or, for the second question, you could just do:
Code: |
if(checktag(3),and,checktag(4)) then
(
#do stuff
) |
|
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Mar 10, 2004 12:31 pm Post subject: a problem with this example |
|
|
Aethereal wrote: |
Code: |
if (pickhero == 0)
then(
#Do stuff so that hero 0 is the hero in the minigame
end
if (pickhero == 1)
then(
#Do stuff so that hero 1 is the one in the minigame
end
if (pickhero == 2)
then(
#Blah blah hero 2
end
end
|
|
There is a problem with this example. It would pop up the hero picking box three times, once for each use of the "pick hero" command. To pop the hero picker box up only once, you should store the result of "pick hero" in a variable.
Code: |
variable(who)
who:=pickhero
if (who == 0)
then(
#Do stuff so that hero 0 is the hero in the minigame
end
if (who == 1)
then(
#Do stuff so that hero 1 is the one in the minigame
end
if (who == 2)
then(
#Blah blah hero 2
end
end
|
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Wed Mar 10, 2004 10:41 pm Post subject: |
|
|
I further point out that when Aeth wrote
Code: | if (checktag(3))
then(
if (checktag(4))
then(
#Do stuff
end
end
end
|
He stuck an extra 'end' in there. Remove the first end. Personally, I think it looks nicer to use )'s with ('s and end's with then's.
Also, something you might more commonly use nested ifs for (as opposed to combining them like Mr B said) would be in something like this:
Code: |
if (checktag(3))
then (
if (hero hp <= 0)
then (
#Do stuff
)
if (hero hp >> 0, and, hero hp <= 10)
then (
#Do stuff
)
if (hero hp >> 10)
then (
#Do stuff
)
)
|
_________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Aethereal SHUT UP. Elite Designer


Joined: 04 Jan 2003 Posts: 928 Location: Gone! I pop in on occasion though.
|
Posted: Thu Mar 11, 2004 6:36 am Post subject: |
|
|
I put in the extra end to signify the end of the script, not the end of a block of if-then code. Thanks for pointing out my mistake though, James. _________________
 |
|
Back to top |
|
 |
junahu Custom Title: 45 character limit

Joined: 13 Jan 2004 Posts: 369 Location: Hull, England
|
Posted: Thu Mar 11, 2004 7:39 am Post subject: |
|
|
I was wondering about pick hero for a while. Like maybe I could use it to make more complicated choices (rather than the pathetic 2 choices a text box provides) _________________
 |
|
Back to top |
|
 |
Shineyest What I say is what I am

Joined: 10 Mar 2004 Posts: 21 Location: Here
|
Posted: Thu Mar 11, 2004 9:25 am Post subject: |
|
|
That might not be a good idea because you could do a script working on a text box and then you press a number to pick a choice _________________ I am making a game about thieves |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Mar 11, 2004 9:45 pm Post subject: |
|
|
Well, Aeth, you didn't make it very clear. If you had put in a script header I would know what the extra end was for.
Using 'key is pressed' is indeed an easy way to get the player to select a choice. Using 'pick hero' would look much nicer.. but it's so annoying to swap out all the heros with icon graphics... : \ _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|