Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battleground script command expansion #1534

Merged
merged 12 commits into from Sep 12, 2016
Merged

Battleground script command expansion #1534

merged 12 commits into from Sep 12, 2016

Conversation

secretdataz
Copy link
Member

This PR allows the script engine to create an instance of battleground group and attach a player to a battleground group without depending on chat room.
I think this will open possibilities for many ideas.

* bg_join - join battleground without npc chat room
* bg_create - create a battle group without npc chat room
@secretdataz secretdataz added component:core A fault that lies within the main framework of rAthena server:map status:code-review Pull Request that requires reviewing from other developers before being pushed to master labels Sep 3, 2016
if( (bg_id = bg_create(mapindex, x, y, ev, dev)) == 0 )
{ // Creation failed
script_pushint(st,0);
return SCRIPT_CMD_SUCCESS;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bonus tab?

if(script_hasdata(st,6))
dev = script_getstr(st,6); // Die Event

if (ev[0] != '\0')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be removed since it's done inside the function

Jittapan Pluemsumran added 5 commits September 5, 2016 18:37
if (script_hasdata(st, 3)) {
map_name = script_getstr(st, 3);
if ((mapindex = mapindex_name2id(map_name)) == 0)
return SCRIPT_CMD_SUCCESS; // Invalid Map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script_pushint missing here

y = bg->y;
}

if ((sd = script_charid2sd(6, sd)) == NULL) {
Copy link

@Darkelfen Darkelfen Sep 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this while compiling:

script.c: In function 'buildin_bg_join':
script.c:18801:10: warning: assignment makes pointer from integer without a cast [enabled by default]

Also, bg_join crashes the map server, probably it is caused by this.

This is the code that I've been using to test the new commands:

prontera,155,180,0  script  bg#bg_join  666,{
OnInit:
    waitingroom "BG Test",2;
    end;
}

bat_room,1,1,0      script  Flavius Init    -1,{
OnInit:
    bindatcmd "bgjoin","Flavius Init::OnBGJoin";
    bindatcmd "bgcreate","Flavius Init::OnBGCreate";
    bindatcmd "bgleave","Flavius Init::OnBGLeave";
    bindatcmd "bgdestroy","Flavius Init::OnBGDestroy";
    bindatcmd "bgwp","Flavius Init::OnBGWp";
    bindatcmd "bgchatjoin","Flavius Init::OnBGChatJoin";
    end;
OnBGJoin:
    bg_join($@FlaviusBG1_id1,"bat_b01",390,10,getcharid(0));
    end;
OnBGCreate:
    $@FlaviusBG1_id1 = bg_create("bat_b01",390,10);
    end;
OnBGLeave:
    bg_leave;
    end;
OnBGDestroy:
    if ($@FlaviusBG1_id1){
        bg_destroy ($@FlaviusBG1_id1);
    }
    end;
OnBGWp:
    bg_warp $@FlaviusBG1_id1,"bat_b01",390,10;
    end;
OnBGChatJoin:
    waitingroom2bg_single($@FlaviusBG1_id1,"bat_b01",390,10,"bg#bg_join");
    end;
}

bg_create successfully creates the BG group and attach the respawn coordinates to the battle group, I've tested this by waitingroom2bg_single since bg_join crashes map server.

y = bg->y;
}

if ((script_charid2sd(6, sd)) == NULL) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script.c: In function 'buildin_bg_join':
script.c:18801:32: warning: comparison between pointer and integer [enabled by default].

Works fine though 👍

@secretdataz secretdataz removed the status:code-review Pull Request that requires reviewing from other developers before being pushed to master label Sep 12, 2016
@secretdataz secretdataz merged commit 33cda97 into master Sep 12, 2016
@secretdataz secretdataz deleted the feature/bg_commands branch September 12, 2016 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:core A fault that lies within the main framework of rAthena
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants