nasagnilac Posted September 27, 2019 Group: Members Topic Count: 89 Topics Per Day: 0.02 Content Count: 232 Reputation: 15 Joined: 11/02/13 Last Seen: December 19, 2024 Share Posted September 27, 2019 I have this code that should walk the character when he/she is in the same map. When I tried it nothing happens. Any tips for this? Quote void auto_newbie_move(struct map_session_data* sd) { if(mapindex_id2name(sd->bl.m) == "new_1-1"){ unit_walktoxy(&sd->bl, 135, 113, 0); } return; } Quote Link to comment Share on other sites More sharing options...
0 Naruto Posted September 27, 2019 Group: Members Topic Count: 20 Topics Per Day: 0.01 Content Count: 416 Reputation: 74 Joined: 05/16/19 Last Seen: January 24, 2021 Share Posted September 27, 2019 why cant you just use an npc script for that? not sure try recompiling Quote Link to comment Share on other sites More sharing options...
0 Zell Posted September 27, 2019 Group: Members Topic Count: 53 Topics Per Day: 0.01 Content Count: 412 Reputation: 266 Joined: 04/25/12 Last Seen: 2 hours ago Share Posted September 27, 2019 Breakpoints are your friend Quote Link to comment Share on other sites More sharing options...
0 nasagnilac Posted September 27, 2019 Group: Members Topic Count: 89 Topics Per Day: 0.02 Content Count: 232 Reputation: 15 Joined: 11/02/13 Last Seen: December 19, 2024 Author Share Posted September 27, 2019 if(!target_id && battle_config.player_dummy_move){ if (map_getmapdata(sd->bl.m)->name == "new_1-1" && !pc_isdead(sd)) { unit_walktoxy(&sd->bl, 135, 113, 0); }else{ unit_walktoxy(&sd->bl, sd->bl.x + (rand() % 2 == 0 ? -1 : 1)*(rand() % battle_config.player_dummy_move_cell), sd->bl.y + (rand() % 2 == 0 ? -1 : 1)*(rand() % battle_config.player_dummy_move_cell), 0); } } I am working on auto attack but don't know the right code to compare it with map name like new_1-1. Quote Link to comment Share on other sites More sharing options...
0 Naruto Posted September 27, 2019 Group: Members Topic Count: 20 Topics Per Day: 0.01 Content Count: 416 Reputation: 74 Joined: 05/16/19 Last Seen: January 24, 2021 Share Posted September 27, 2019 well I remember having issues trying to automatically move characters using that script when trying to move outside the what... 12 cell range? With mobs you have to keep refreshing it, and stuff, super annoying gl Quote Link to comment Share on other sites More sharing options...
0 Seravy Posted September 27, 2019 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 176 Reputation: 60 Joined: 01/11/19 Last Seen: March 12, 2021 Share Posted September 27, 2019 As far as I remember, in C languages you can't use == for strings because it compares the pointers instead of the contents. You have to use something else, strcmp maybe? Quote Link to comment Share on other sites More sharing options...
0 nasagnilac Posted September 28, 2019 Group: Members Topic Count: 89 Topics Per Day: 0.02 Content Count: 232 Reputation: 15 Joined: 11/02/13 Last Seen: December 19, 2024 Author Share Posted September 28, 2019 11 hours ago, Seravy said: As far as I remember, in C languages you can't use == for strings because it compares the pointers instead of the contents. You have to use something else, strcmp maybe? I tried it but still working and I adjust the code to this base on unitwalk scriptcommand. If you are going to use unitwalk its working. if (strcmp("new_1-1", map_getmapdata(sd->bl.m)->name)) { int x = 135; int y = 113; add_timer(gettick()+50, unit_delay_walktoxy_timer, sd->bl.id, (x<<16)|(y&0xFFFF)); // Need timer to avoid mismatches } Quote Link to comment Share on other sites More sharing options...
0 nasagnilac Posted September 28, 2019 Group: Members Topic Count: 89 Topics Per Day: 0.02 Content Count: 232 Reputation: 15 Joined: 11/02/13 Last Seen: December 19, 2024 Author Share Posted September 28, 2019 Look like the wall cause the issue. Quote Link to comment Share on other sites More sharing options...
Question
nasagnilac
I have this code that should walk the character when he/she is in the same map.
When I tried it nothing happens. Any tips for this?
Link to comment
Share on other sites
7 answers to this question
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.