Plotscripts and Vehicles...

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
Master K
King Slime
Posts: 1899
Joined: Sat Jun 11, 2011 9:40 pm
Location: A windswept rock in the Atlantic Ocean

Plotscripts and Vehicles...

Post by Master K »

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?
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Re: Plotscripts and Vehicles...

Post by Bob the Hamster »

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: Select all

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")
User avatar
Master K
King Slime
Posts: 1899
Joined: Sat Jun 11, 2011 9:40 pm
Location: A windswept rock in the Atlantic Ocean

Post by Master K »

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: Select all

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.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

Have you considered not using a vehicle, but simply changing the hero's walkabout and walking speed?
User avatar
msw188
Metal Slime
Posts: 783
Joined: Tue Oct 16, 2007 1:43 am
Location: Los Angeles, CA

Post by msw188 »

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: Select all

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
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Code: Select all

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: Select all

check tag(tag:Hydra Attack == OFF)
When you meant to write:

Code: Select all

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)
Last edited by Bob the Hamster on Wed Aug 17, 2011 7:23 pm, edited 3 times in total.
Post Reply