Request a Random NPC Look, Designated X Y script.

安赫尔

New member
Messages
163
Points
0
Location
Shanghai
Github
stacksnet
Emulator
I need to put some random npc in a arena map like follow

The NPC audience are in red line.

3.jpg

Finally looks like the image below

2.jpg

I think it maybe to use freeloop like below. This thing is currently a bit difficult for me

freeloop(1); set .@size, getargcount(); for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
Can someone make a examples

 
Can't detailedly do this at the moment, but should be enough if you make a whitelist of NPCs you want to go to the arena and use the setnpcdisplay script command.

Sample:

- script voidscript -1,{end;}arena,100,100,0 duplicate(voidscript) #spectator0 -1arena,101,100,0 duplicate(voidscript) #spectator1 -1arena,102,100,0 duplicate(voidscript) #spectator2 -1arena,103,100,0 duplicate(voidscript) #spectator3 -1- script rotatespectators -1,{OnInit: setarray .safeids[0],46,47,48,49,50,51,52,53,54,55,56,57,58,59,60; .spectators = 4; end;OnChangeSpectators: for (.@i = 0; .@i < .spectators; .@i++){ if (setnpcdisplay("#spectator0" + .@i, .safeids[rand(getarraysize(.safeids))])) { // Returns 1 if there are problems debugmes "SOMETHING WENT WRONG WITH NPC "#spectator0" + .@i + " "!"; // Note it } } end;}

Or if you think you won't be having problems with your spectator NPCs, you can simplify the latter one if you trust your setnpcdisplays will work like this:

- script rotatespectators -1,{OnInit: setarray .safeids[0],46,47,48,49,50,51,52,53,54,55,56,57,58,59,60; .spectators = 4; end;OnChangeSpectators: for (.@i = 0; .@i < .spectators; .@i++){ setnpcdisplay("#spectator0" + .@i, .safeids[rand(getarraysize(.safeids))]); } end;}


You can see NPC sprite IDs at http://nn.nachtwolke.com/dev/npclist/ (beware some aren't available on a regular data folder installation).

It's not a complete response, but I'm sure you'll at least get the gist of it.

 
Last edited by a moderator:
Back
Top