Jump to content

Photo

NPC Scripts Nearly Done


  • Please log in to reply
1 reply to this topic

#1 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 27 November 2018 - 07:26 AM

ZC Win Alpha 3


npc_script_slots.png
 

Script


npc script N
{
	void run(){TraceToBase(64,10,2); this->X = 16;}
	
}

Assembly
 


N
 SETV d2,0
 SETR d3,REFNPC
 PUSHR d3
 SETR d4,SP
 PUSHR d4
 SETV d2,0.0015
 PUSHR d2
 SETV d2,64
 PUSHR d2
 SETV d2,10
 PUSHR d2
 SETV d2,2
 PUSHR d2
 GOTO 32
 POP d4
 SETV d2,16
 PUSHR d4
 SETV d3,0.0028
 PUSHR d3
 PUSHR d2
 SETR d6,d4
 ADDV d6,0
 LOADI d2,d6
 POP d3
 PUSHR d2
 PUSHR d3
 GOTO 37
 POP d4
 SETV d3,0
 POP d3
 QUIT
 TRACE5
 POP d3
 POP d3
 POP d3
 RETURN
 POP d2
 POP d3
 SETR REFNPC,d3
 SETR NPCX,d2
 RETURN

Remains to Do

  • Save the slot code in the quest file.
  • Allow npcs to access it and set the script slot (Enemy Editor)
  • Call the script in the ZC game loop.
  • Hope that it works.

Perhaps once these are done, someone will adapt ghost.zh to use them, instead of ffcs, so that ghost scripts can be easily converted to proper npc scripts.
 
 
I also fixed item scripts, so that their stacks don't become corrupted across multiple calls to the same stack index.


  • ShadowTiger likes this

#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 30 November 2018 - 09:07 AM

Updated, above.

npc-script-enemy-editor.png


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users