Getting NPC ref from their script

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

Getting NPC ref from their script

Post by SwordPlay »

Say I want to run a script through an NPC that returns its reference.
How would I go about doing this?

How can I get a reference to the NPC that is running the script?
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Actually, any script triggered by an NPC can automatically get a reference to the NPC who triggered it.

http://rpg.hamsterrepublic.com/ohrrpgce ... PC_Scripts

Code: Select all

plotscript, npc activation script, arg, ref, begin
  #arg will be filled with the script argument from the NPC editor.
  #ref will be filled with a reference to this specific NPC.
end
Post Reply