View previous topic :: View next topic |
Author |
Message |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
Posted: Tue Sep 04, 2007 5:14 pm Post subject: Altering foemap with scripting |
|
|
Is it possible? I am working on a potential stat system for my game which would benefit the most if I could somehow cancel out random battles in particular areas after certain events have taken place.
Is this possible at all? _________________ MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Tue Sep 04, 2007 5:17 pm Post subject: |
|
|
'Instead of battle' script that calls up a custom-made random battle system which is dependent on a tag/variable.
Ask me to clarify if you don't catch the drift, but it's pretty simple to implement. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Sep 04, 2007 6:05 pm Post subject: |
|
|
(The foemap isn't modifiable because historically it was not loaded into memory but read from harddisk every time you took a step to save memory. Maybe it'll be modifiable in future.) _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Tue Sep 04, 2007 6:17 pm Post subject: |
|
|
Really, I don't think you can go wrong with the custom random battles method:
Code: |
if(checktag(x)==off) # x is whatever condition this is based on (story event)
then
(
variable(ctr)
ctr:=random(y,z) # y = lowest battle formation ID in the set, z = highest
fightformation(ctr)
#Add anything else you want here
)
|
And you set that as the 'instead of battle' script. It should behave like any other formation set.
I dunno about that item thing; that requires some trickier plotscripting (IMO) involving editing rewards OR using more battle formations, which is a waste of space and time. Your call. |
|
Back to top |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Tue Sep 04, 2007 7:01 pm Post subject: |
|
|
Oh, are you using multiple formation sets on one map? Dang. Uh... I'm not sure how to fix that up. It would be great if the instead of battle script passed the formation set's number as a variable, but I seriously doubt that it does...
Well, you might have to go for your other method after all, unless someone else has a better idea. The only thing I can think of is to check the hero's coordinates and have different sets to randomize through, but that's pretty complex and prone to errors. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Sep 04, 2007 7:51 pm Post subject: |
|
|
(From 'Plotscripting_Tutorial#Other Ways to Start a Script')
Instead of battle scripts get two arguments. The first is the formation, and the second is the formation set, that would have been triggered. Just check whether the tag is on, and the formation set is the one you want to block.
Code: | plotscript, insteadofbattles, form, formset, begin
# x is whatever condition this is based on (story event)
# y is the formation set to block
if (not (checktag(x) && formset == y)) then (
fight formation (form)
)
end |
(We need a command to fight a random formation from a formation set) _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Tue Sep 04, 2007 7:57 pm Post subject: |
|
|
Aha! Then you should be able (If I'm not mistaken) to use the above script if it's defined with two arguments.
ie:
Code: |
definescript(battlescript,2,0,0)
|
up top (though I think you don't have to define scripts anymore)
and then in the body of the script:
Code: |
script, battlescript, useless, num, begin
|
Use the 'num' variable to determine which formation set you are working with and create the fake random battle scripts for each one. |
|
Back to top |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
Posted: Wed Sep 05, 2007 6:22 am Post subject: |
|
|
This all looks great, but i'm having a hard time figuring out exactly how to start it. I don't understand how to make it so it recognizes different formsets. I'm still learning how to do more complex scripts like this.
Would you mind elaborating a little more on this? _________________ MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database |
|
Back to top |
|
 |
Camdog
Joined: 08 Aug 2003 Posts: 606
|
Posted: Wed Sep 05, 2007 6:38 am Post subject: |
|
|
When Game calls an instead of battle plotscript, it automatically passes that script two arguments, the formation number and the formation set number, in that order. That's what JSH was describing when he defined the two arguments in the battlescript as "useless" (the formation number, which, presumably you don't need) and "num" (the formation set number, which, presumably is what you want). So...
Code: | script, battlescript, form, formset, begin
if (formset == 1) then(
#do what you want to do if the player is dealing with formset 1, such as:
if (check tag(x)) then(fight formation(1))
else (fight formation(2))
)
else (
if (formset == 2) then(
#do what you want for formset 2, etc...
)
)
end |
By the way... does hamsterspeak have a switch statement yet? I feel like I remember someone talking about it, but it isn't documented on the wiki. |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Wed Sep 05, 2007 6:49 am Post subject: |
|
|
Quote: | By the way... does hamsterspeak have a switch statement yet? I feel like I remember someone talking about it, but it isn't documented on the wiki. |
Try one thread down :p |
|
Back to top |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
Posted: Wed Sep 05, 2007 7:47 am Post subject: |
|
|
Okay i've done a little testing with it and it seems to work okay (so far). Here is what I came up with. I am so confused right now that i'm sure half of this stuff is unneccessary:
Code: | script,battlescript,useless,formset,begin
variable(form1)
form1:=random(1,6)
variable(form2)
form2:=random(8,12)
variable(form3)
form3:=random(13,18)
variable(form7)
form7:=random(38,43)
if (formset == 1) then(
if (checktag(18)==off) then (fight formation(form1))
)
else (
if (formset == 2) then(
if (checktag(18)==off) then (fight formation(form2))
))
else (
if (formset == 3) then(
if (checktag(18)==off) then (fight formation(form3))
))
else (
if (formset == 7) then(
if (checktag(19)==off) then (fight formation(form7))
)))
end |
_________________ MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Wed Sep 05, 2007 8:00 am Post subject: |
|
|
I think you've got the idea okay. There may be shorter-looking ways to do this, but they'd all accomplish exactly what you've done I'm pretty sure. (example - using a switch statement instead of multiple ifs)
It doesn't really matter, but do you know that you do not have to define variables one at a time? You could use the line
Code: | variable(form1, form2, form3, form7) |
to define all of your variables at once. Oh, and if you would like to make certain formations more likely than others (the way you do in custom by putting some formations into the set more than once), we can explain how to do that as well.
This thread also makes me think that it might be real nice to have a plotscripting command to read formation set data. Something like:
getenemyformation (set #, slot #) _________________ 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 |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Wed Sep 05, 2007 8:49 am Post subject: |
|
|
I would do it this way, but you have the idea:
Code: |
script,battlescript,useless,formset,begin
variable(form,upbound,lowbound,thetag)
thetag:=18
switch(formset)
do(
case(1) do( upbound:=6, lowbound:=1 )
case(2) do( upbound:=12, lowbound:=8 )
case(3) do( upbound:=18, lowbound:=13 )
case(7) do( upbound:=43, lowbound:=38, thetag:=19 )
)
form:=random(lowbound,upbound)
if(checktag(thetag)==off )
then(fightformation(form))
end
|
Most effecient method I can think of (And it's all small and purdy) |
|
Back to top |
|
 |
|