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 1:07 pm Post subject: Reset Map State |
|
|
I'm having trouble getting this command to work. Here is the code:
Code: | script,resetmine,begin
suspend player
reset map state (mapstate:all)
wait for all
resume player
end |
Supposed to be simple and to the point. The player can walk over an infinite use npc and it triggers this script, which in turn resets all of the npcs on the map.
However, it does NOTHING. What am I doing wrong? _________________ MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Sep 04, 2007 9:36 pm Post subject: |
|
|
I just tested your script, and it works for me. Check that it's actually being triggered. And if it is... testcase?
Also why suspend player, resume player and wait for all. They probably won't do anything. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
Posted: Wed Sep 05, 2007 6:59 am Post subject: |
|
|
The Mad Cacti wrote: | I just tested your script, and it works for me. Check that it's actually being triggered. And if it is... testcase?
Also why suspend player, resume player and wait for all. They probably won't do anything. |
I don't know why I have that stuff in there. I took it out.
The script still isn't working for me. Maybe I am doing wrong. Here is how I am testing it:
On the map that needs reset is an npc that shows "Test" textbox and then is supposed to run the resetmine script. I am assuming that that would bring back all of the npcs on the map, even if they were one time use npcs, but it doesn't do anything. _________________ MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Sep 05, 2007 7:26 am Post subject: |
|
|
Meatballsub wrote: | On the map that needs reset is an npc that shows "Test" textbox and then is supposed to run the resetmine script. I am assuming that that would bring back all of the npcs on the map, even if they were one time use npcs, but it doesn't do anything. |
there is the problem. No, it will not bring back one-time-use NPCs.
One-time-use NPCs actually have a tag which gets changed when you use them. Resetting the map state will have no effect on tags. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Wed Sep 05, 2007 7:31 am Post subject: |
|
|
You can of course reset that tag yourself. The NPC has not actually been deleted, so clearing the tag will cause it to reappear.
Which tag exactly should be cleared is displayed on the NPC editing page. The one-time NPC tags start at 1000 and go up. _________________
|
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Sep 05, 2007 7:43 am Post subject: |
|
|
Hmmm...
I just realized that "alter NPC" and "read NPC" are capable of accessing NPC tag data, but there are no pre-defined constants for it, so you have to use the numbers 9 and 10 for the regular tags, and 11 for the one-time-usability tag
Code: |
script, respawn onetime NPCs, begin
variable(i, tag)
for(i, 0, 35) do, begin
tag := read NPC(i, 11)
if (tag >> 1) then, begin
set tag(tag, OFF)
end
end
end
|
The above code should re-generate all the one-time-usable NPCs on the current map. Try it, and let me know how it works. |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Wed Sep 05, 2007 8:12 am Post subject: |
|
|
Tag 1 is always off (I think, maybe it's on). _________________
|
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Wed Sep 05, 2007 8:20 am Post subject: |
|
|
Gosh, I just got the thing mixed up. Do NOT use my suggestion, I was thinking that the variable tag was being set as the value of the tag in question (as in, true or false) and we were checking to set it false if it were true. Now I see that tag is just being set as the tag number, and this all makes much more sense. I'm sorry for the confusion.
I wonder if game would explode if a script tried to turn tag 1 off... _________________ 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 |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Wed Sep 05, 2007 8:27 am Post subject: |
|
|
You might also have to refresh the map. Calling reset map state after James' script has run through might be what you need. _________________ 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 |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
Posted: Wed Sep 05, 2007 8:46 am Post subject: |
|
|
Don't know if this is exactly what you meant but I tried this and it didn't work:
Code: | script,resetmine,begin
variable (i,tag)
for (i,0,35) do,begin
tag:=read npc(i,11)
if (tag >=1000) then, begin
set tag (tag,on)
end
end
reset map state (mapstate:all)
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 9:53 am Post subject: |
|
|
Hmm, that is what I meant. Right now the only thing I can think of is that maybe James is forgetting something, and 11 is the wrong number for read NPC? Could it be an off-by-one thing?
Actually I just looked at plotscr.hsd, and 11 seems like it should be the right number. But now I'm realizing that there may be a chance that the number in that data slot is not the actual tag number, but may be 1000 less (thus allowing 0 or whatever to mean no tag, but pressing left increments the data to 1 which corresponds to tag 1001). Try this. In that script, add the line
show value (tag)
wait(15)
right before the if check. This will show us what data the script is getting from reading the NPC's info. We might need to add 1000 (or possibly 999) to this number to get the actual tag we are trying to turn off. Tell us what kinds of numbers show up when you call the script, and what tag numbers custom says for the one-time NPCs on the current map.
PS: This is all just guesswork on my part, James is the real person to ask about this. _________________ 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 |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Sep 05, 2007 10:43 am Post subject: |
|
|
msw's guesswork is good. use a "show value" tag to find out what numbers we are actually dealing with here.... the tag number might actually be a negative, now that I think about it, so you might need to say:
Code: |
tag := read NPC(i, 11) * -1
|
Also, you should not need reset map state. NPCs should automatically re-appear in response to tag changes (unless I implemented one-time-usable tags very differently than I implemented regular tags, which is possible, although a bit unlikely) |
|
Back to top |
|
 |
Meatballsub Divine Bovine

Joined: 16 Jun 2003 Posts: 437 Location: Northwest Georgia
|
Posted: Wed Sep 05, 2007 1:03 pm Post subject: |
|
|
Okay, so it said:
0
-11
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-27
0
Or something close to that. When I removed the -1 it would say the same thing just in positive numbers. _________________ MOCBJ Software - My Games
The Hamster Wheel - OHRRPGCE Information Database
Last edited by Meatballsub on Wed Sep 05, 2007 1:05 pm; edited 1 time in total |
|
Back to top |
|
 |
|