Pysk Posted January 30, 2014 Posted January 30, 2014 Hallo. Ich wollte mir einen NPC mit 6 Random Warps machen. Dieser Funktioniert auch, aber nicht immer. Manschmal warpt er und manschmal bleibt er einfach stehen. Der Server gibt aber keinen Fehler aus. next; mes "^ff0000[Warper]^000000"; mes "Okay, dann bringe ich dich jetzt dahin."; switch(rand(5)) { case 1: savepoint "eot_1",52,2; warp "eot_1",52,2; end; case 2: savepoint "eot_2",52,2; warp "eot_2",52,2; end; case 3: savepoint "eot_3",52,2; warp "eot_3",52,2; end; case 4: savepoint "eot_4",52,2; warp "eot_4",52,2; end; case 5: savepoint "eot_5",52,2; warp "eot_5",52,2; end; case 6: savepoint "eot_6",52,2; warp "eot_6",52,2; end; }} Das ist der Part davon und eigentlich sollte das so laufen. Anfangs hatte ich das so als Random Warp Portal das machte auch keine Problme nur im NPC kommt das vor. Quote
Netsrot Posted January 31, 2014 Posted January 31, 2014 (edited) Moin Moin ^^ Dein switch(rand(5)) gibt an und zu mal ne NULL raus und Du hast keinen case 0 im Script switch(rand(1,6)) sollte das problem beheben. Bin mir mit der Syntax nicht 100% sicher, guck am besten nochmal in scriptcommands.txt nach. Mfg Netsrot Edited January 31, 2014 by Netsrot Quote
Jey Posted January 31, 2014 Posted January 31, 2014 ^ Scheint korrekt zu sein. *rand(<number>{,<number>});This function returns a number ...(if you specify one) ... randomly positioned between 0 and the number you specify -1.(if you specify two) ... randomly positioned between the two numbers you specify. Ansonsten ist es manchmal auch sinnvoll sowas wie "default: close;" zu machen ^^ Quote
Netsrot Posted January 31, 2014 Posted January 31, 2014 @Jey: Jupp und ein break am Ende eines case ist auch nützlich Mfg Nets Quote
Pysk Posted January 31, 2014 Author Posted January 31, 2014 (edited) Danke ihr 2 hat so geklapptt. Beim Warp Portal gings halt so. Ich habe es jetzt mit switch(rand(5)) gemacht. Wobei ich überlegt habe obs nicht auch gegangen wäre case 0, statt 1 zu machen. Ist aber nun auch egal. Edited January 31, 2014 by Pysk Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.