Post new topic    
Page «  1, 2, 3, 4, 5, 6  »
Metal King Slime
Send private message
 
 PostSat Dec 03, 2011 9:52 pm
Send private message Reply with quote
It sounds like what you actually want is this:
Quote:
i want to store the position of the NPC that runs the script into a variable

and not this:
Quote:
is there some way to return the NPC last used by the player in a script?


The second is not easy to do, but the first is trivial: the reference of the activated NPC is passed as the second argument to an 'on use' NPC script. The first argument is the 'script argument' you can set in the NPC editor. So you can get the NPC position like so:

Code:
plotscript, my npc script, my arg, npc ref, begin
  something something (npc X (npc ref))
  something something (npc Y (npc ref))
end
Metal Slime
Send private message
 
 PostTue Dec 06, 2011 6:28 pm
Send private message Reply with quote
what of there were multiple instances of the npc? (i wrote the script, and it still does not seem to be working.)
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Liquid Metal King Slime
Send private message
 
 PostTue Dec 06, 2011 6:46 pm
Send private message Reply with quote
The second argument to an NPC activation script is an NPC reference, which is not the same as an NPC ID number. Every NPC reference on a map is unique, even if there are more than one copy of the same NPC
Metal Slime
Send private message
 
 PostTue Dec 06, 2011 8:49 pm
Send private message Reply with quote
here's what i have:

Code:

plotscript, placing world map kayak,arg,npc ref, begin
suspend obstruction
suspend player
stop song
set tag (~,on)
set npc position (11,npc x (npc ref), npc y (npc ref))
use npc (~)
play song (song:kickass kayaking song)
resume obstruction
resume player
end


the music changes, but the kayak (an npc vehicle) does not move to where the npc that activated the script is. what is missing here? is the vehicle being blocked by this npc, preventing it from changing location and being used?

also, what exactly is an argument? i've never actually used them in scripts before.
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Super Slime
Send private message
 
 PostTue Dec 06, 2011 10:00 pm
Send private message Reply with quote
mjohnson092088 wrote:
also, what exactly is an argument? i've never actually used them in scripts before.


This is pretty funny in light of the code you just posted. "arg" and "npc ref" are the arguments to your script (just like "~" and "on" are arguments for set tag).
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Metal Slime
Send private message
 
 PostWed Dec 07, 2011 5:45 pm
Send private message Reply with quote
Mogri wrote:

This is pretty funny in light of the code you just posted. "arg" and "npc ref" are the arguments to your script (just like "~" and "on" are arguments for set tag).


okay, okay mister smart guy! Hurr i should have said "script" arguments. i've never used those arguments for any reason before. i'm a little confused as to what they are for. (except for the second argument, which was explained to me earlier.)
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Liquid Metal King Slime
Send private message
 
 PostWed Dec 07, 2011 6:18 pm
Send private message Reply with quote
Your script seems pretty close to being correct.

I don't know where the ~ in your script came from. It should not even compile with those ~ symbols in there. i think what you want is this:

Code:

plotscript, placing world map kayak, arg, npc ref, begin
  suspend obstruction
  suspend player
  stop song
  set tag (tag:tagname,on)
  set npc position (11, npc x (npc ref), npc y (npc ref))
  use npc (npc ref)
  play song (song:kickass kayaking song)
  resume obstruction
  resume player
end


I put tag:tagname because I didn't know the actual name of the tag.
Super Slime
Send private message
 
 PostWed Dec 07, 2011 7:02 pm
Send private message Reply with quote
I'm pretty sure the tildes were placeholders.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Metal Slime
Send private message
 
 PostWed Dec 07, 2011 8:48 pm
Send private message Reply with quote
Mogri wrote:
I'm pretty sure the tildes were placeholders.


they were, i was just placing them there for the sake of showing the code. i prefer use numbers for tags, rather than constants.


edit: so i figured out why the script wasn't working, and i'm almost too embarrassed to tell you guys why.

almost.

the script was working just fine. the boat was set to appear when the tag was OFF, not ON.

you may commence the poking of the fun at me. Zombie
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Metal Slime
Send private message
 
 PostThu Feb 02, 2012 1:35 am
Send private message Reply with quote
i have one little question about death scripts... if i have an on-death script, then have another script call a formation that the player loses, will that script continue to run, or will the on-death script cancel out said script?
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Metal King Slime
Send private message
 
 PostThu Feb 02, 2012 3:06 am
Send private message Reply with quote
Death-triggering of scripts is exactly the same as triggering any other kind of script. So whatever was running before is suspended until the death script finishes running. Once it does, the script that called "fight formation" can check the return value to see whether you won or lost/ran from the battle*

*Minor engine bug: if the death script or something else causes a second battle before the original script is resumed, then the return value from "fight formation" will be the result of the most recent battle.
Metal Slime
Send private message
 
 PostThu Feb 02, 2012 6:43 pm
Send private message Reply with quote
perfect, just what i needed to know, thanks.
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Super Slime
Send private message
 
 PostFri Feb 03, 2012 12:22 am
Send private message Reply with quote
TMC wrote:
*Minor engine bug: if the death script or something else causes a second battle before the original script is resumed, then the return value from "fight formation" will be the result of the most recent battle.


That's the expected behavior, though. If you really need the original value, stuff it into a variable at the start of your script.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Metal King Slime
Send private message
 
 PostFri Feb 03, 2012 5:41 am
Send private message Reply with quote
While the bug itself isn't surprising and could even be expected, I think that behaviour is definitely a bug.
Metal Slime
Send private message
 
 PostWed Feb 08, 2012 9:56 pm
Send private message Reply with quote
not sure if this was asked somewhere before, but is there some way to script changes to elemental resistances? i don't see a command like that in the plotscript dictionary, so i'm assuming there isn't. it would be great if you could, though...
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Display posts from previous:
Page «  1, 2, 3, 4, 5, 6  »