Jump to content


Question about START_STATE


  • Please log in to reply
11 replies to this topic
BainIhrno BainIhrno

Hand of Avadon

  • Moderator
    • Member ID: 3,311
  • 1,312 posts

Posted 03 February 2013 - 10:58 PM #1 Question about START_STATE

In my translation of Of Good and Evil to Blades of Avernum, I'm programming the friendly towns to (1) end the scenario if you steal something (doesn't count as winning) and (2) kill you if you attack the town.

I know that's probably not what some BoA players want to hear, but I feel when translating the plot over to BoA, being able to attack the friendly towns and the response only being the standard "town becomes hostile" wouldn't make sense in this storyline.

So I have programmed this with the START_STATE command, but I'm worried that having the game check the crime level every turn will cause the game to slow down.

So I guess my question is, does START_STATE slow the game down if used in certain ways?

Ishad Nha Ishad Nha

Hand of Avadon

  • Member
    • Member ID: 4,773
  • 2,366 posts

Posted 03 February 2013 - 11:32 PM #2 Question about START_STATE

I have used it for creating timers, in Shadow of the Stranger you need it to know when the day ends. (Some towns have separate versions for both day and night.) It seemed to work okay, no slowing down.
I don't think it will make much difference but I don't really know. IIRC crime is handled only one way, via the crime_level functions. Offhand I don't know if you can give players banishment rather than death.

Niemand Niemand

Hand of Avadon

  • Moderator
    • Member ID: 3,580
  • 2,138 posts
  • LocationWisconsin

Posted 03 February 2013 - 11:41 PM #3 Question about START_STATE

Quote

I know that's probably not what some BoA players want to hear, but I feel when translating the plot over to BoA, being able to attack the friendly towns and the response only being the standard "town becomes hostile" wouldn't make sense in this storyline.

The default behavior isn't very useful, since it can easily put a game into an un-winnable state. I, for one, see no problem with your choice to alter it.

Quote

So I guess my question is, does START_STATE slow the game down if used in certain ways?

Absolutely. Avernumscript is very slow, as can be seen when designers ask it to do too much. (See for example, A Visit to the Madhouse, which accumulated a fair number of complaints because of frequently running creature scripts.) However, in this case I think you're probably fine, since you're only putting in a single conditional. If you really feel paranoid, you could factor out the body of the conditional into another state and brach to it with set_state_continue() so that there's very little code actually in the START_STATE. (Assuming the interpreter in the game works as the pieces of it leftover in the editor do, even when the body of a conditional is skipped the skipping takes time proportional to the amount of code skipped.)
Possibly you suppose that [he] is a harmless fellow, who with vacant mind recites some empty formula,
traces a wandering sign in the air, and with palsied hand shakes a wand the while he gibbers his insanity at the yawning moon.

Ishad Nha Ishad Nha

Hand of Avadon

  • Member
    • Member ID: 4,773
  • 2,366 posts

Posted 03 February 2013 - 11:47 PM #4 Question about START_STATE

Come to think of it, this will work for the current town:
short town_status(short which_town)
2- party has entered, town hates
Town goes hostile due to the crime level being reached, then this is evaluated, you can then end the scenario.
You need to distinguish between possible causes of hostility. If a PC attacks someone a flag can be set...

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 04 February 2013 - 02:16 PM #5 Question about START_STATE

View PostNiemand, on 03 February 2013 - 11:41 PM, said:

However, in this case I think you're probably fine, since you're only putting in a single conditional.
This.

I did something like this in Exodus, with each of the expedition towns having a crime level and flag check in the START_STATE. It runs fine.
VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!

BainIhrno BainIhrno

Hand of Avadon

  • Moderator
    • Member ID: 3,311
  • 1,312 posts

Posted 04 February 2013 - 02:22 PM #6 Question about START_STATE

Thanks everyone.

For stolen items, I may set up the coding to lower your reputation for doing so rather than ending the scenario, under further consideration (OG&E in BoE had a reputation system).

BainIhrno BainIhrno

Hand of Avadon

  • Moderator
    • Member ID: 3,311
  • 1,312 posts

Posted 20 March 2013 - 07:46 PM #7 Question about START_STATE

I've started alpha-testing the scenario now, and this is the configuration I used to check the crime level


beginstate START_STATE;



if (get_crime_level(ME) > 0 && < 5)
set_state_continue(53);

if (get_crime_level(ME) >= 5)
set_state_continue(54);

State 53 will decrease the party's reputation via SDF by 1.
State 54 will kill the party.

However, right now the scenario is calling state 53 on every turn in the town, and attacking the town doesn't call 54. What am I doing wrong?

Iffy Iffy

The Dough is Rising

  • Member
    • Member ID: 4,897
  • 2,628 posts
  • Locationinside my comfortable box

Posted 20 March 2013 - 09:44 PM #8 Question about START_STATE

View PostBainIhrno, on 20 March 2013 - 07:46 PM, said:

I've started alpha-testing the scenario now, and this is the configuration I used to check the crime level


beginstate START_STATE;



if (get_crime_level(ME) > 0 && < 5)
set_state_continue(53);

if (get_crime_level(ME) >= 5)
set_state_continue(54);

State 53 will decrease the party's reputation via SDF by 1.
State 54 will kill the party.

However, right now the scenario is calling state 53 on every turn in the town, and attacking the town doesn't call 54. What am I doing wrong?
START_STATE get's called every turn, so every turn it checks with the if statement. That's why it's calling 53 every turn. If you want 53 to only be called once the first time the party does something to raise the crime level and no more, then you'll need to add a flag condition. And my memory may be a bit fuzzy on this, but I think killing someone simply raises the crime level by 3. Though more importantly, there's a mistake in the syntax:

if (get_crime_level(ME) > 0 && < 5)
I believe should be
if (get_crime_level(ME) > 0 && get_crime_level(ME) < 5)

(19:01:38) Tyran: There is a time and a place for unfunny idiocy?
(19:01:56) nikki: Yes, Tyran: http://spiderwebforu...orum/3-general/

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 21 March 2013 - 06:52 AM #9 Question about START_STATE

The call get_crime_level() doesn't take arguments, so get rid of those ME arguments. Also, fix the && syntax as Iffy described. Finally, you'll want to have a flag in state 53 that makes it a one-time for each increase in the crime level. So, for example, you could check if the crime level equals the flag at the beginning of the state (and end the state if it does), and then set the flag equal to the crime level at the end of the state. Something like:
if (get_crime_level() == get_flag(100,0)) // assume that flag 100,0 is just tracking whether this state has been called
end();

inc_flag(100,1,get_crime_level() - get_flag(100,0)); // assume that flag 100,1 is the reputation flag — this decreases the reputation by the additional amount of the crime level

set_flag(100,0,get_crime_level());

VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!

BainIhrno BainIhrno

Hand of Avadon

  • Moderator
    • Member ID: 3,311
  • 1,312 posts

Posted 21 March 2013 - 11:44 AM #10 Question about START_STATE

Thanks. As long as I'm on this subject, can SDFs have a value below 0 in BoA? The current configuration has two SDFs for reputation that supplement one another, one keeps track of good deeds and one of bad deeds. Is it possible, in other words, to do with one SDF?

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 21 March 2013 - 12:15 PM #11 Question about START_STATE

I believe the answer is no on the negative value but yes on the one SDF. The way Jeff handles that in Geneforge is by setting the SDF to 100 to begin with, so instead of dealing with negative numbers, he just deals with values below 100.
VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!

Ishad Nha Ishad Nha

Hand of Avadon

  • Member
    • Member ID: 4,773
  • 2,366 posts

Posted 21 March 2013 - 05:00 PM #12 Question about START_STATE

Have to be careful that a party does not increment their reputation SDF below 0 or above 255, that will cause a crash. Make alterations only happen if SDF is above A and less than (255 - A), where A is the largest possible increment for reputation.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users