Post new topic    
Page 1, 2, 3, 4, 5, 6  »
Metal Slime
Send private message
stupid scripts! 
 PostThu Feb 10, 2011 12:43 am
Send private message Reply with quote
so here's my problem. i'm trying to create a couple of scripts, and surprise surprise, they're not working right. Mad

here's the first one:
plotscript, flight activate, begin
if (checktag(18)) then, begin
suspend obstruction
set npc position (9,hero x (me),hero y (me))
set tag (144,on)
resume obstruction
end, else, begin
show text box (552)
end
end

the idea is that this script activates when the flight spell is used from the menu. tag 18 checks to see that the player is on the world map, otherwise text box 552 shows up. this much works. the npc, which is the vehicle, appears with tag 18, and is moved onto the player, and is set to automatically be used when the player touches it, which should be instant considering it is placed right on top of the hero. it almost works... however, it does NOT automatically work. is there any way to force the player to mount a vehicle? the player is also hurt by passing over swamps
on the cloud. is there a way to disable harm tiles? (i just noticed this now, so i haven't looked yet.)

also, this:

plotscript, check for items, begin
if (check tag(28)+check tag(32)+check tag(108)) then, begin
delete item (36,1)
delete item (91,1)
delete item (100,1)
show text box (517)
wait for text box
end, else, begin
show text box (516)
wait for text box
end
end

the idea here is that the player hands over three items to someone in exchange for an item or two... in this case, three actually. BUT only one of the items gets removed, the first one, so i am assuming there is a problem with the "if" command. is this the way you combine commands?

advice, anyone?
Liquid Metal King Slime
Send private message
 
 PostThu Feb 10, 2011 1:03 am
Send private message Reply with quote
The first script isn't working because touch npc activation isn't triggered by "set npc position", it will happen only on the next turn when either the NPC or the hero moves. There is a much easier way to write this script

(also, I suggest using parenthesis instead of begin and end. They are interchangeable, and parenthesis tend to be much more readable.)

Code:

plotscript, flight activate, begin
  if (checktag(18)) then(
    set npc position (9,hero x (me),hero y (me))
    use npc(9)
    set tag (144,on)
  )else(
    show text box (552)
  )
end


Also notice that I got rid of your "suspend obstruction" stuff. That only applies to normal NPC walking, and has no effect on instantly moving an NPC using set npc position

Also, you can use the command set harm tile damage to disable the harm tiles. Personally I would do that in a separate pair of scripts and set them as the vehicle's on-mount and on-dismount scripts.

I think the problem with your second script is that you can't use + that way. + is always used for math, so you were actually adding together the results of the check tag commands when I suspect that you wanted to check all three tags, so you should use the logical and operator &&

Code:

plotscript, check for items, begin
  if (check tag(28) && check tag(32) && check tag(108)) then(
    delete item (36,1)
    delete item (91,1)
    delete item (100,1)
    show text box (517)
    wait for text box
  )else(
    show text box (516)
    wait for text box
  )
end


However, this does not explain why only one of your items is getting deleted. Are you certain you have the item ID numbers correct?
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 1:19 am
Send private message Reply with quote
james:
thanks a lot, that really clears things up. i thought that the npcs couldn't be placed on top of a hero, as the hero is "obstructing" that tile. (i also never noticed the "use npc" command. duhurr.)

as for the second script, that's exactly what i meant by that. i wasn't sure if using "+" in that manner could work, as it's meant for mathmatic operations. the reason only one of the items was deleted was probably because of that reason, as the other two tags are checked AFTER the "+"s. it's probably acting as if they're not there, as i'm positive the ID nimbers of the items are correct (i checked, double-checked, and even triple-checked).

anyway, i'm going to have to test these to make sure they work. however, these scripts are SO far away from all of my saves!! it's gonna be a beeyatch... i'll test them later, maybe tomorrow. if anything goes wrong, i'll post it here. otherwise, this should pretty much solve my problems. thanks a lot! you da man!
Liquid Metal King Slime
Send private message
 
 PostThu Feb 10, 2011 1:23 am
Send private message Reply with quote
mjohnson092088 wrote:

anyway, i'm going to have to test these to make sure they work. however, these scripts are SO far away from all of my saves!! it's gonna be a beeyatch... i'll test them later, maybe tomorrow. if anything goes wrong, i'll post it here. otherwise, this should pretty much solve my problems. thanks a lot! you da man!


Are you aware of the teleportation tool? it is great for getting to a script quickly so you can test it. You have to have "debugging keys" enabled in the general bitsets menu, then you can press CTRL+F1 at any time on the map to teleport.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 1:28 am
Send private message Reply with quote
hmm, no i was not aware of that. i shy away from the debugging keys on the off-chance that i forget to disable them before releasing an update. that'll definitely make it easy. i'll give it a shot right now.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 2:18 am
Send private message Reply with quote
okay sooo... the flight spell works fine and dandy... the FIRST time you use it. however, if you land, the cloud disappears (basically the flight spell calls a cloud vehicle that you take with you, so it wouldn't stay on the map when you disembark) and will not reappear again if the player calls it with the flight spell. these are the scripts that it uses.

for calling the cloud:

Code:
plotscript, flight activate, begin
  if (checktag(18)) then(
    set npc position (9,hero x (me),hero y (me))
    use npc(9)
    set tag (144,on)
    set harm tile damage (0)
  )else(
    show text box (552)
  )
end


and when you disembark:

Code:
plotscript, flight deactivate, begin
set tag (144,off)
set harm tile damage (5)
end


i cannot for the life of me figure out why the cloud doesn't reappear on top of the player the second time it is called after being used once. it just reappears in the same spot where you get off of it. advice?
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 2:29 am
Send private message Reply with quote
Just a guess: you should put the line
Code:
wait for npc (9)

after you set its position.

I'm guessing that the vehicle NPC is set to appear if tag 144 is on?
I am Srime
Liquid Metal Slime
Send private message
 
 PostThu Feb 10, 2011 2:36 am
Send private message Reply with quote
Actually if anything you should use a standard wait (1), not wait for npc, as set npc position is instant.
My website, the home of Motrya:
http://www.jshgaming.com
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 2:55 am
Send private message Reply with quote
hmm. at the risk of sounding stupid, why exactly is that? will it not reposition if the npc is not "visible"?
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 2:56 am
Send private message Reply with quote
I've had terrible luck with vehicle scripts.

For example, there appears to be absolutely no way to force a hero in a vehicle to move (neither moving the hero nor the npc seems to do anything.)

I don't have any examples with me right now, but, good luck if you're ever trying to do anything cool with vehicles.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 3:18 am
Send private message Reply with quote
okay so i just tried adding a "wait" line and no good. the npc still reappears wherever you left it last.

oh, and mystic: i found a way to "fake" moving in a vehicle easily, by just changing the hero's sprite to a vehicle walkabout of some kind. if you have the caterpillar party bitset on, you would set the rest of the hero's walkabouts to a blank walkabout. i use that for the ferry scripts. the heros walk onto the ferry, then they disappear and change their walkabouts at the same time the ferry npc disappears. then they move... then they stop... and the heros are positioned on top of the other ferry npc, and their walkabouts change back at the same time the ferry reappears.
Liquid Metal King Slime
Send private message
 
 PostThu Feb 10, 2011 4:07 am
Send private message Reply with quote
I am confident that this has absolutely nothing to do with needing any kind of wait command. Wait commands are important for some things, but this isn't one of them.

Here is how I would debug this problem

Quote:

plotscript, flight activate, begin
variable(ref)
if (checktag(18)) then(

# If this shows a negative number, that proves the NPC is available on the map. 0 means it has vanished for some reason.
ref := NPC reference(9)
show value(ref)
wait for any key
show no value

set npc position (9,hero x (me),hero y (me))
use npc(9)
set tag (144,on)
set harm tile damage (0)
)else(
show text box (552)
)
end


Let me know what value this test shows, both on the first useage, and on subsequent usages.

@Mystic: When a hero is riding a vehicle, you cannot move the vehicle NPC. Instead you should move the lead hero. The vehicle movement will happen automatically because it has temporarily replaced the hero. If this does not work, you have found a bug, and it needs to be fixed. please let me know! No sprite-swapping workaround like the one mjohnson describes should be required!
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 5:14 am
Send private message Reply with quote
james, you were right. the first use shows a value of -10. the second shows it at 0.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 5:41 am
Send private message Reply with quote
James Paige wrote:
@Mystic: When a hero is riding a vehicle, you cannot move the vehicle NPC. Instead you should move the lead hero. The vehicle movement will happen automatically because it has temporarily replaced the hero. If this does not work, you have found a bug, and it needs to be fixed. please let me know! No sprite-swapping workaround like the one mjohnson describes should be required!


I'll try to throw a test case together when I have some time. I've tried literally everything to get it working, although this was back in November while I was working on HotOHR and to be honest I haven't done a lot of dev since then. But it was important to the next part of the game and was causing me a lot of grief.
Metal Slime
Send private message
 
 PostThu Feb 10, 2011 2:19 pm
Send private message Reply with quote
there's another part to this predicament as well:

occasionally, after the player summons the spell the first time, the player does not automatically mount the vehicle if they try to use it again, even if they call it from the same spot that they last landed on. usually the player can "use" the vehicle to board it after calling it a second time. 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.
Display posts from previous:
Page 1, 2, 3, 4, 5, 6  »