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

Plotscript Help

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
efgeise
the pissed off consumer




Joined: 20 Feb 2003
Posts: 16

PostPosted: Wed Jun 11, 2003 2:45 am    Post subject: Plotscript Help Reply with quote

I need help in writting a script to check to see how many heros are in the party and then do damage to each one. I've racked my brain over this problem for a day and a half. Please help me Crying
Back to top
View user's profile Send private message
Cube
Dimensional Traveller




Joined: 02 Feb 2003
Posts: 294

PostPosted: Wed Jun 11, 2003 3:08 am    Post subject: Reply with quote

Quote:
variable (num)

variable (hero)
variable (stat)
for (num, 0, 3, 1) do (
set variable (hero, hero by slot (num))
if (hero <> -1) then (
set variable (stat, get hero stat (find hero (hero), stat:HP, current stat))
set hero stat (find hero (hero), stat:HP, stat--1, current stat)
)
)



Rename the variables if you need to. Big grin

Now, I'm also going to teach you what's going on, heh. Firstly, we define 3 variables which will hold information for us. Num is the slot number we check which is used in the following FOR loop. Hero is to store the hero found in the slot we check. It will return -1 if no hero is found. Finally Stat holds the hero's current HP.

Now with the for loop, the first in the argument is the variable we use. The second one is the number we start at. The third argument is the number we stop at, and the last one is the amount of numbers the variable will increase. So that being said, we start at 0 and will continue until we hit 3. This will check slots 0, 1, 2, and 3. All four of them. Just for the record, if I made the last slot of the for loop a 2, it would only check 0, and 2.

Now, inside the for loop (The DO section), we set hero by using "hero by slot". For the argument in that command, we use "Num" which is the current number the for loop is on. Then a "If" statement to check "hero". If the number isn't equal to -1, then it does the commands within the if statement. It first sets the variable "stat" to the current HP the hero has. Then it changes the hero's current HP by subtracting 1 (Or any other number you feel like using). If you don't know what going on with the "get hero stat" and "set hero stat" commands, check them out here, and here.

And that's it! I hope you understand, heheh. If you have any more questions, be sure to ask.


Last edited by Cube on Wed Jun 11, 2003 8:43 am; edited 1 time in total
Back to top
View user's profile Send private message
efgeise
the pissed off consumer




Joined: 20 Feb 2003
Posts: 16

PostPosted: Wed Jun 11, 2003 3:17 am    Post subject: Reply with quote

I get it. I really had no clue what I would use the for( for. But now I know.
Thanks alot. :>
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