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

Altering foemap with scripting
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Meatballsub
Divine Bovine




Joined: 16 Jun 2003
Posts: 437
Location: Northwest Georgia

PostPosted: Tue Sep 04, 2007 5:14 pm    Post subject: Altering foemap with scripting Reply with quote

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
View user's profile Send private message Visit poster's website
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 5:17 pm    Post subject: Reply with quote

'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
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Sep 04, 2007 6:05 pm    Post subject: Reply with quote

(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
View user's profile Send private message Send e-mail
Meatballsub
Divine Bovine




Joined: 16 Jun 2003
Posts: 437
Location: Northwest Georgia

PostPosted: Tue Sep 04, 2007 6:13 pm    Post subject: Reply with quote

Would it be easier to make it so certain enemies don't drop items depending on if a tag is set on or not? That would be another option.
_________________
MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database
Back to top
View user's profile Send private message Visit poster's website
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 6:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Meatballsub
Divine Bovine




Joined: 16 Jun 2003
Posts: 437
Location: Northwest Georgia

PostPosted: Tue Sep 04, 2007 6:53 pm    Post subject: Reply with quote

Works great thanks for the help! Except...

Regardless of what I put in random, it cancels all battles on that entire map....wonder why?
_________________
MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database
Back to top
View user's profile Send private message Visit poster's website
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 7:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Sep 04, 2007 7:51 pm    Post subject: Reply with quote

(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
View user's profile Send private message Send e-mail
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 7:57 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Meatballsub
Divine Bovine




Joined: 16 Jun 2003
Posts: 437
Location: Northwest Georgia

PostPosted: Wed Sep 05, 2007 6:22 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Wed Sep 05, 2007 6:38 am    Post subject: Reply with quote

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
View user's profile Send private message
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Wed Sep 05, 2007 6:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
Meatballsub
Divine Bovine




Joined: 16 Jun 2003
Posts: 437
Location: Northwest Georgia

PostPosted: Wed Sep 05, 2007 7:47 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Wed Sep 05, 2007 8:00 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Wed Sep 05, 2007 8:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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