Jump to content
  • 0

If statement not taking into account updated variable?


Tzuridis

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  06/19/12
  • Last Seen:  

prontera,156,168,4	script	test flag	722,{
    dispbottom "=========================";
    .@gid = getcastledata("prontera", 1);
    dispbottom "Owner of the castle : "+( ( .@gid )? "["+ getguildname(.@gid) +"]" : "<none>" );
    dispbottom "=========================";
    end;
OnInit:
    if ( agitcheck() == false && !getcastledata("prontera", 1) || agitcheck() == true )
        donpcevent strnpcinfo(0)+"::OnAgitStart";
    flagemblem getcastledata("prontera", 0);
    end;
OnAgitStart:
sleep 3000;
    if (.@gid = 1) {
    .@mobid = monster("prontera",156,194,"Bangungot Servant",2317,1,strnpcinfo(0)+"::OnMyMobDead");
    } else if (.@gid = 2) {
    .@mobid = monster("prontera",156,194,"Incantation Guardian",1542,1,strnpcinfo(0)+"::OnMyMobDead");
    }
    else if (.@gid = 3) {
    .@mobid = monster("prontera",156,194,"Imperial Construct",2691,1,strnpcinfo(0)+"::OnMyMobDead");  
    }
    else if (.@gid = 4) {
    .@mobid = monster("prontera",156,194,"Ox Guardian",2010,1,strnpcinfo(0)+"::OnMyMobDead");
    }
    else if (.@gid = 5) {
    .@mobid = monster("prontera",156,194,"Grypon Guardian",1447,1,strnpcinfo(0)+"::OnMyMobDead");
    }
    else if (.@gid = 6) {
    .@mobid = monster("prontera",156,194,"Zem Stone",2035,1,strnpcinfo(0)+"::OnMyMobDead");
    }
    else if (.@gid = 7) {
    .@mobid = monster("prontera",156,194,"SS",1786,1,strnpcinfo(0)+"::OnMyMobDead");
    }
    else {
    .@mobid = monster("prontera",156,194,"Unclaimed Stone",1907,1,strnpcinfo(0)+"::OnMyMobDead");
    }
    setunitdata .@mobid, UDT_HP, 5;
    end;
OnAgitEnd:
    killmonster strnpcinfo(4), strnpcinfo(0)+"::OnMyMobDead";
    end;
OnMyMobDead:
    announce "The Emperium has fallen", bc_map;
    SetCastleData "prontera", 1, getcharid(2);
    .@gid = getcastledata("prontera", 1);
    donpcevent "::OnRecvCastle123";
    sleep 7000;
    goto OnAgitStart;
OnAgitInit:
    requestguildinfo getcastledata("prontera", 1);
OnRecvCastle123:
    flagemblem getcastledata("prontera", 1);
    end;
OnGuildBreak:
    setcastledata "prontera", 1, 0;
    donpcevent "::OnRecvCastle123";
    end;
}

I know the .@gid is updating when a player kills the mob (emperium) and that can be tested with an announce right after the .@gid in OnMyMobDead. After that it should go through the if statements again to determine what mob to spawn but it always just spawns the first mob even though the number is not equal to 1. How do I go about writing it so it takes into account my updated variable?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  81
  • Reputation:   14
  • Joined:  11/17/17
  • Last Seen:  

Did you try to use npc variable. Change 

.@gid

To

.gid
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  06/19/12
  • Last Seen:  

On 5/31/2020 at 1:57 PM, rongmauhong said:

Did you try to use npc variable. Change 


.@gid

To


.gid

Yea I tried that, I changed every .@gid to .gid and that didn't work . The variable changes to the updated number in OnMyMobDead., just need to figure out the syntax on how to get that to run in the conditionals.

Nvm I figured it out I needed ==

Edited by Tzuridis
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...