fiction 14 Posted June 6, 2017 (edited) Hi, I need some help to make a mob change the appareance every 25 sec, and store the previous HP and position. Is similar to Facewrom, This is that i have currently, but have error when i try to spawn the mob in the previous position. 1@def01,50,50,4 script asdasd 4_NFWISP,{ donpcevent("fff#Start::OnStart"); } 1@def01,0,0,0 script fff#Start HIDDEN_NPC,{ OnStart: .@GID = monster ("1@def01", 50, 55, _("--ja--"), 3500, 1, "DarkThanatos::OnDead"); initnpctimer "fff#Start"; initnpctimer; end; OnTimer6000: killmonsterall "1@def01"; .@max_hp = getmonsterinfo( 3500,UDT_MAXHP ); .@hp = getmonsterinfo( 3500,UDT_HP ); .@element = rand( 3501,3504 ); // TODO: required mob controller script commands or other alternatives workaround. getmapxy(@mapname$, @mapx, @mapx, UNITTYPE_MOB); .@GID = monster( @mapname$,@mapx,@mapx,"--ja--",.@element,1,"DarkThanatos::OnDead" ); setunitdata( .@GID,UDT_HP,.@hp ); setunitdata( .@GID,UDT_MAXHP,.@max_hp ); initnpctimer; switch ( .@element ) { case 3501: mapannounce "1@def01","MOB changed to Fire element!",bc_map; break; case 3502: mapannounce "1@def01","MOB changed to Earth element!",bc_map; break; case 3503: mapannounce "1@def01","MOB changed to Water element!",bc_map; break; case 3504: mapannounce "1@def01","MOB changed to Wind element!",bc_map; break; } end; OnMyMobDead: end; OnDead: end; } [Error]: script_rid2sd: fatal error ! player not attached! [Debug]: Function: monster (7 parameters): [Debug]: Data: variable name='@mapname$' index=0 [Debug]: Data: variable name='@mapx' index=0 [Debug]: Data: variable name='@mapx' index=0 [Debug]: Data: string value="--ja--" [Debug]: Data: variable name='.@element' index=0 [Debug]: Data: number value=1 [Debug]: Data: string value="DarkThanatos::OnDead" [Debug]: Source (NPC): DarkThanatos2#Start at 1@def01 (0,0) [Warning]: script_get_val: cannot access player variable '@mapname$', defaulting to "" [Error]: script_rid2sd: fatal error ! player not attached! [Debug]: Function: monster (7 parameters): [Debug]: Data: string value="" [Debug]: Data: variable name='@mapx' index=0 [Debug]: Data: variable name='@mapx' index=0 [Debug]: Data: string value="--ja--" [Debug]: Data: variable name='.@element' index=0 [Debug]: Data: number value=1 [Debug]: Data: string value="DarkThanatos::OnDead" [Debug]: Source (NPC): DarkThanatos2#Start at 1@def01 (0,0) [Warning]: script_get_val: cannot access player variable '@mapx', defaulting to 0 [Error]: script_rid2sd: fatal error ! player not attached! [Debug]: Function: monster (7 parameters): [Debug]: Data: string value="" [Debug]: Data: number value=0 [Debug]: Data: variable name='@mapx' index=0 [Debug]: Data: string value="--ja--" [Debug]: Data: variable name='.@element' index=0 [Debug]: Data: number value=1 [Debug]: Data: string value="DarkThanatos::OnDead" [Debug]: Source (NPC): DarkThanatos2#Start at 1@def01 (0,0) [Warning]: script_get_val: cannot access player variable '@mapx', defaulting to 0 [Debug]: mapindex_name2id: Map "" not found in index list! [Warning]: buildin_monster: Attempted to spawn monster class 3502 on non-existing map '' [Debug]: Source (NPC): DarkThanatos2#Start at 1@def01 (0,0) Greetings.- Edited July 18, 2017 by fiction Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted June 8, 2017 1. You're using a npctimer, so there aren't players attached. getmapxy("<variable for map name>", <variable for x>, <variable for y>, <type>{, "<search parameter>"}) 2. You need to specific the search parameter, in this case the monster GID, if you don't specific this, getmapxy will take as PC Character invoked. 3. Also, you've used PC variables (@). 4. Replace .@GID temporal variable for .GID permanent variable (you need to store this). 5. For HP/SP see 'getunitdata'. 1@def01,0,0,0 script fff#Start HIDDEN_NPC,{ OnStart: .GID = monster ("1@def01", 50, 55, _("--ja--"), 3500, 1, "DarkThanatos::OnDead"); initnpctimer "fff#Start"; initnpctimer; set .temp, getcharid(0); set @temp, getcharid(0); end; OnTimer6000: // Utiliza 'getunitdata' en vez de 'getmonsterinfo' .@max_hp = getmonsterinfo( 3500,UDT_MAXHP ); .@hp = getmonsterinfo( 3500,UDT_HP ); //Mob 3500 + rand(1,4) .@element = rand( 1,4 ); //Array de los 4 elementos setarray(.@element$[1], "Fire", "Earth", "Water", "Wind"); // TODO: required mob controller script commands or other alternatives workaround. getmapxy(.@mapname$, .@mapx, .@mapx, UNITTYPE_MOB, .GID); // Mata al monstruo después de obtener su posición killmonsterall "1@def01"; .GID = monster( .@mapname$,.@mapx,.@mapx,"--ja--",3500+.@element,1,"DarkThanatos::OnDead" ); setunitdata( .GID,UDT_HP,.@hp ); setunitdata( .GID,UDT_MAXHP,.@max_hp ); initnpctimer; // Simplificar el uso de 'switch' mapannounce "1@def01","MOB changed to "+.@element$[.@element]+" element!",bc_map; end; OnMyMobDead: end; OnDead: end; } Quote Share this post Link to post Share on other sites
0 fiction 14 Posted July 1, 2017 On 8/6/2017 at 4:03 AM, Easycore said: 1. You're using a npctimer, so there aren't players attached. getmapxy("<variable for map name>", <variable for x>, <variable for y>, <type>{, "<search parameter>"}) 2. You need to specific the search parameter, in this case the monster GID, if you don't specific this, getmapxy will take as PC Character invoked. 3. Also, you've used PC variables (@). 4. Replace .@GID temporal variable for .GID permanent variable (you need to store this). 5. For HP/SP see 'getunitdata'. Hide contents 1@def01,0,0,0 script fff#Start HIDDEN_NPC,{ OnStart: .GID = monster ("1@def01", 50, 55, _("--ja--"), 3500, 1, "DarkThanatos::OnDead"); initnpctimer "fff#Start"; initnpctimer; set .temp, getcharid(0); set @temp, getcharid(0); end; OnTimer6000: // Utiliza 'getunitdata' en vez de 'getmonsterinfo' .@max_hp = getmonsterinfo( 3500,UDT_MAXHP ); .@hp = getmonsterinfo( 3500,UDT_HP ); //Mob 3500 + rand(1,4) .@element = rand( 1,4 ); //Array de los 4 elementos setarray(.@element$[1], "Fire", "Earth", "Water", "Wind"); // TODO: required mob controller script commands or other alternatives workaround. getmapxy(.@mapname$, .@mapx, .@mapx, UNITTYPE_MOB, .GID); // Mata al monstruo después de obtener su posición killmonsterall "1@def01"; .GID = monster( .@mapname$,.@mapx,.@mapx,"--ja--",3500+.@element,1,"DarkThanatos::OnDead" ); setunitdata( .GID,UDT_HP,.@hp ); setunitdata( .GID,UDT_MAXHP,.@max_hp ); initnpctimer; // Simplificar el uso de 'switch' mapannounce "1@def01","MOB changed to "+.@element$[.@element]+" element!",bc_map; end; OnMyMobDead: end; OnDead: end; } Thank you for the response and sorry for the delay of my answer. I've tried your tips, and the only problem that i continue having is the HP storage of the mob. Now the change are working perfectly, but the transfer of the previous HP of the mob isn't working. For example, 1.- The monster 3500 has 1 milion of HP. 2.- Recive 100,000 damaged. The HP now is 900,000 3.- The monster changed its element (Mob 3501). 4.- The new monster obtain 900,000 HP, because it was the previous HP of the mob (3500), and so on. Here is the script: 1@def01,50,50,4 script asdasd 4_NFWISP,{ donpcevent("#fff::OnStart"); } 1@def01,1,5,3 script #fff CLEAR_NPC,{ OnStart: .GID = monster ("1@def01", 50, 55, _("--ja--"), 3500, 1, "DarkThanatos::OnDead"); initnpctimer "fff#Start"; initnpctimer; set .temp, getcharid(0); set @temp, getcharid(0); end; OnTimer6000: // Utiliza 'getunitdata' en vez de 'getmonsterinfo' .@max_hp = getunitdata( .GID,UDT_MAXHP ); .@hp = getunitdata( .GID,UDT_HP ); //Mob 3500 + rand(1,4) .@element = rand( 1,4 ); //Array de los 4 elementos setarray(.@element$[1], "Fire", "Earth", "Water", "Wind"); // TODO: required mob controller script commands or other alternatives workaround. getmapxy(.@mapname$, .@mapx, .@mapx, UNITTYPE_MOB, .GID); // Mata al monstruo después de obtener su posición killmonsterall "1@def01"; .GID = monster( .@mapname$,.@mapx,.@mapx,"--ja--",3500+.@element,1,"DarkThanatos::OnDead" ); setunitdata( .GID,UDT_HP,.@hp ); setunitdata( .GID,UDT_MAXHP,.@max_hp ); initnpctimer; // Simplificar el uso de 'switch' mapannounce "1@def01","MOB changed to "+.@element$[.@element]+" element!",bc_map; end; } Big thanks in advance !. Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted July 26, 2017 2 hours ago, fiction said: jolaperras Tonto culiao, mándame un PM. x'D Quote Share this post Link to post Share on other sites
Hi,
I need some help to make a mob change the appareance every 25 sec, and store the previous HP and position.
Is similar to Facewrom,
This is that i have currently, but have error when i try to spawn the mob in the previous position.
Greetings.-
Edited by fictionShare this post
Link to post
Share on other sites