Post new topic    
Page «  1, 2, 3, 4, 5, 6  »
Liquid Metal King Slime
Send private message
 
 PostThu Feb 10, 2011 4:20 pm
Send private message Reply with quote
mjohnson092088 wrote:
james, you were right. the first use shows a value of -10. the second shows it at 0.


Two questions. Do you have any "destroy NPC" commands anywhere in any of your scripts?

Second, is this vehicle NPC be disabled with a tag check? If so, which tag, and in what situations does the tag get turned on and off?

mjohnson092088 wrote:
... however, a strange glitch occasionally occurs where instead of boarding the vehicle, the player steps through it and is unable to board it. not only that, but the player also becomes able to walk through walls and is not affected by harm tiles, as if they were flying with the spell! im using the nightly build of the OHR, if that makes any difference.


Strange. I am not sure if this is related to the problem you mentioned before, or a separate problem. This seems complicated enough that I might need to see the whole script.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 4:47 pm
Send private message Reply with quote
James Paige wrote:
Two questions. Do you have any "destroy NPC" commands anywhere in any of your scripts?

Second, is this vehicle NPC be disabled with a tag check? If so, which tag, and in what situations does the tag get turned on and off?

Strange. I am not sure if this is related to the problem you mentioned before, or a separate problem. This seems complicated enough that I might need to see the whole script.


1st answer: no, even i know that much. lol Grin
2nd answer: yes. it is tag 144. first of all, the script looks like this:

Code:
plotscript, flight activate, begin
if (checktag(18)) then( <=checks if player is on world map
set tag (144,on) <=just switched this to here. it was underneath "use npc"
set npc position (9,hero x (me),hero y (me))
use npc(9)
set harm tile damage (0)
set harm tile flash
close menu (top menu)
close menu (top menu)
)else(
show text box (552) <=displays a text box saying "you can't fly here"
close menu (top menu)
close menu (top menu)
)
end


...and as i type this, I FIXED IT YAAAAAYYYY!!!

turns out i needed to put the "set tag" command first, before repositioning the npc. i realized this when you asked if the npc was disabled by a tag. so i switched it, and tested it, and it works! as for the last problem i had, it doesn't matter now that this works, as the player now automatically boards the vehicle when used, cutting that problem out entirely.

thanks man, i owe you one for all your help!
Liquid Metal Slime
Send private message
 
 PostThu Feb 10, 2011 4:49 pm
Send private message Reply with quote
What does Tag 144 do? Is that just a conditional that signifies that the player is in flight, or does it physically turn on the cloud? I keep thinking your problem has to do with Tag 144's placement in the script. If it's the tag that puts the cloud back on the map, then you'll want to set it before you set npc position. Otherwise the script won't move it.

That's the only thing that comes to my mind about this.

EDIT: Oh, you figured this out on your own. Congratulations.
Place Obligatory Signature Here
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 6:20 pm
Send private message Reply with quote
yup, now the flight spell works correctly.

i have another question for another script. what is the difference between a global plotscript variable and a normal variable? is a normal variable defined and used in a certain script, while a global variable is defined outside of a script and can be used by any script?

i'm trying to create an alternate means to revive a hero aside from using an item. my idea was was to use the formula (hero level x 20 = cost for ressurection) and have the cost displayed in a text box when the hero is selected from the revive menu after setting the variable to the cost. but, the text box says that the ${V#} option is a global variable. would this variable be defined by the script that calls the text box, or is this a different kind of variable?
Liquid Metal King Slime
Send private message
 
 PostThu Feb 10, 2011 6:30 pm
Send private message Reply with quote
mjohnson092088 wrote:
i have another question for another script. what is the difference between a global plotscript variable and a normal variable? is a normal variable defined and used in a certain script, while a global variable is defined outside of a script and can be used by any script?


Yes, that is exactly correct.

mjohnson092088 wrote:
i'm trying to create an alternate means to revive a hero aside from using an item. my idea was was to use the formula (hero level x 20 = cost for ressurection) and have the cost displayed in a text box when the hero is selected from the revive menu after setting the variable to the cost. but, the text box says that the ${V#} option is a global variable. would this variable be defined by the script that calls the text box, or is this a different kind of variable?


You can only display global variables in text boxes. it is not possible to display a regular (local) variable in a text box.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 6:32 pm
Send private message Reply with quote
Everything you've said about global variables is correct. So yes, you would have to define the global outside of the script, and it would then be usable in any script you choose. And yes, the text box can only access global variables, it cannot access 'normal' variables defined within the script (programmers call these "local variables" I think).
I am Srime
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 6:47 pm
Send private message Reply with quote
perfect! that's just what i needed to know to start working on this script. i'm going to assume that means i should define the variables with the include .hsi and .hsd sections? where you would also define a script to be called by other scripts? (because you can't call a plotscript by another script, right?)
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 6:53 pm
Send private message Reply with quote
Take heart, you can call a script from any other script! There used to be rules about defining scripts vs defining plotscripts, but they've been superseded by the new system where you define your scripts simply by starting them (script, name, begin) and you can call them in any other script.

I THINK you can declare the global variables anywhere outside a script as well, but I always put them next to the include hsi lines, as you say. Actually, I declare all my variables in a separate text document globals.txt, and have the line "include globals.txt" with the other includes. This is at least partially because I have a lot of globals and I need comments to keep track of what they are for.
I am Srime
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 7:00 pm
Send private message Reply with quote
msw188 wrote:
Take heart, you can call a script from any other script! There used to be rules about defining scripts vs defining plotscripts, but they've been superseded by the new system where you define your scripts simply by starting them (script, name, begin) and you can call them in any other script.

I THINK you can declare the global variables anywhere outside a script as well, but I always put them next to the include hsi lines, as you say. Actually, I declare all my variables in a separate text document globals.txt, and have the line "include globals.txt" with the other includes. This is at least partially because I have a lot of globals and I need comments to keep track of what they are for.


hmm. i had problems calling a plotscript from another plotscript before. maybe that just means i did it wrong. and i didn't know that you could include a globals file like that, i'll have to keep that in mind. thanks a lot, everyone! i think i'm pretty much all set to go now.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 7:36 pm
Send private message Reply with quote
I use various .inc files which is habit from other programming stuff. It's very handy.

I can confirm that you can define globals in those extra files.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 9:22 pm
Send private message Reply with quote
i see, i see. now if i was going to use these variables like i mentioned earlier, how would i got about doing that? would it be something like this?

Code:

plotscript, sanct revive hero, begin
variable (herolevel)
if (check tag (91)) then, begin
show text box (597)
end, else, begin
set variable (herolevel,get hero level (0))
set variable (herocost,herolevel*20)
show text box (598)
end
end


i've never tried doing anything mathematical in a script yet, so i'm not sure exactly how i use the commands, or if i have to only use numbers when using these lines. if not, how else would i go about doing it? i'm looking through the Vikings of Midgard scripts to see if i can figure it out myself, but any help is appreciated.
Liquid Metal King Slime
Send private message
 
 PostThu Feb 10, 2011 10:01 pm
Send private message Reply with quote
yes that would work, but I recommend not using the old "set variable" syntax... Actually, where did you see an example of that? I thought I had revised all of the example scripts that use set variable to use := instead.

Code:

plotscript, sanct revive hero, begin
  variable (herolevel)
  if (check tag (91)) then(
    show text box (597)
  )else(
    herolevel := get hero level (0)
    herocost := herolevel*20
    show text box (598)
  )
end


Also, be aware that "get hero level(0)" is getting the level of the hero in battle slot 0, which might be empty if the leader is in a different slot. (see this article for more info)
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 10:22 pm
Send private message Reply with quote
James Paige wrote:
yes that would work, but I recommend not using the old "set variable" syntax... Actually, where did you see an example of that? I thought I had revised all of the example scripts that use set variable to use := instead.

Code:

plotscript, sanct revive hero, begin
  variable (herolevel)
  if (check tag (91)) then(
    show text box (597)
  )else(
    herolevel := get hero level (0)
    herocost := herolevel*20
    show text box (598)
  )
end


Also, be aware that "get hero level(0)" is getting the level of the hero in battle slot 0, which might be empty if the leader is in a different slot. (see this article for more info)


i saw "set variable" in the plotscripting dictionary. i like to use words instead of symbols so i know what i'm looking at quicker.

also, in my game, the formation cannot be altered, so the heros are always in the same places throughout the game. it shouldn't be an issue.
Metal Slime
Send private message
 
 PostTue Feb 15, 2011 9:08 pm
Send private message Reply with quote
so here's my new issue:

Code:
plotscript, load game, begin
if (check tag(115)) then, begin
show text box (99)
wait for text box
set tag (115,off)
end
else,begin
wait (1)
end
if (check tag(69)) then, begin
set battle wait mode (off)
end, else, begin
set battle wait mode (on)
end
end


if you save at a sanctuary, a text box pops up when you load the game. if you save using the commune spell, nothing is supposed to happen. however, nothing happens either way!

also, the script is supposed to set the battle mode according to how you had it set last. the option itself in the menu remembers what it is set to, and the appropriate option appears in the menu. HOWEVER, the battle mode is NOT set to what it was when the player exits the game. it reverts back to Active, whether it was set to active or wait. what is going on here?
Liquid Metal King Slime
Send private message
 
 PostTue Feb 15, 2011 9:15 pm
Send private message Reply with quote
My guess is that the load game script is not being run at all.

Go to "Edit General Game Data" and then to "Preference Bitsets"

Make sure that "Don't save gameover/loadgame script IDs" is turned ON. This should be on for almost all games, and the ability to turn it off only exists for backcompat with old games.

If that doesn't fix it (or wasn't a problem) then try adding a "show text box" at the beginning of the load game script before any of the tag checks. That way you can prove that the load game script is really being run.
Display posts from previous:
Page «  1, 2, 3, 4, 5, 6  »