Post new topic    
King Slime
Send private message
Plotscripts and Vehicles... 
 PostWed Aug 17, 2011 12:31 am
Send private message Reply with quote
So, I want a script to trigger when the hero steps on this certain invisible NPC script trigger point. However, the hero will be riding a vehicle. I tested it out, but no go. I can't trigger the script.

How can I trigger the script while riding the vehicle? Also, is it possible to move the hero with Walk Hero commands while he is on the vehicle?
Liquid Metal King Slime
Send private message
Re: Plotscripts and Vehicles... 
 PostWed Aug 17, 2011 3:23 pm
Send private message Reply with quote
Master K wrote:
So, I want a script to trigger when the hero steps on this certain invisible NPC script trigger point. However, the hero will be riding a vehicle. I tested it out, but no go. I can't trigger the script.

How can I trigger the script while riding the vehicle? Also, is it possible to move the hero with Walk Hero commands while he is on the vehicle?


NPCs can't be activated in the normal ways when you are riding on a vehicle. Maybe the ability to do that should be added.

For now, I think the easiest way would be to put an "each step" script on the map, and have it do something special by checking the hero's X and Y position.

Code:

plotscript, each step example, begin
  if(hero X(me) == 37 && hero Y(me) == 72) then(
    trigger some other script
  )
end


As for your other question, yes, you can move a vehicle with "walk hero" while the hero is riding it. (if you want to move the vehicle when the hero is NOT riding it, you have to use "walk NPC")
King Slime
Send private message
 
 PostWed Aug 17, 2011 5:50 pm
Send private message Reply with quote
Thank you James. But now, how do I configure it to go off if a certain tag is off, and the hero stepped on that spot? You see, this script triggers a script that has the hero fight a Hydra. Here is the way I edited it:

Code:
plotscript, hydra trigger, begin
    if (check tag(tag:Hydra Attack == OFF) and
    hero X(me) == 45 && hero Y(me) == 89) then(
    hydra attack
  )
end


It compiles, but won't work.
Liquid Metal King Slime
Send private message
 
 PostWed Aug 17, 2011 6:30 pm
Send private message Reply with quote
Have you considered not using a vehicle, but simply changing the hero's walkabout and walking speed?
Metal Slime
Send private message
 
 PostWed Aug 17, 2011 6:33 pm
Send private message Reply with quote
I think the problem is having two "and"s in a row like that. If you have 3 conditions that you need to check, I think it needs to be:

Code:
if ( (check tag (tag:Hydra Attack == OFF)) and
    (hero X(me) == 45 && hero Y(me) == 89) ) then(


I don't really know for certain though.
I am Srime
Liquid Metal King Slime
Send private message
 
 PostWed Aug 17, 2011 7:20 pm
Send private message Reply with quote
Code:
plotscript, hydra trigger, begin
    if (check tag(tag:Hydra Attack == OFF) and
    hero X(me) == 45 && hero Y(me) == 89) then(
    hydra attack
  )
end


Read the code again. The problem is in the "check tag" command. You wrote:

Code:
check tag(tag:Hydra Attack == OFF)


When you meant to write:

Code:
check tag(tag:Hydra Attack) == OFF


Also, this isn't related to your problem, but I strongly suggest using "&&" instead of "and"

"and" still works for backwards compatibility, but unless you are trying to do bitwise binary operations, && is always better.

The same goes for "||" which is better than using "or"

@msw188: two or more && in the same condition does work fine. (two or more "and" works too, but "&&" is still better)
Display posts from previous: