Jump to content
  • 0

Randomizing Warps


Succubusty

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/07/13
  • Last Seen:  

Alright. One last question xD I've been using this forum alot lately. Y'all are just so good Cx

 

 

turbo_n_1,316,365,0    script    DSwitch    -1,1,1,{
OnTouch:
    if ($switch == 0){
        set $switch,1;
        if (rand(1,2) == 1)
            enablenpc "Water_Exit_1";
            enablenpc "Water_False_1";
            }
        else{
            enablenpc "Water_Exit_2";
            enablenpc "Water_False_2";
            disablenpc strnpcinfo(0);
        }
        end;
}

turbo_n_1,11,266,0    script    Water_Exit_1    45,1,1,{
OnTouch:
    mapannounce "turbo_n_1.gat",strcharinfo(0)+" has reached Room 5!",bc_map,0xf08080;
    warp strnpcinfo(4),185,227;
    announce "Run around the shell room and find the right portal. Try not to get dizzy.~",bc_self,0x7fff00;    
OnInit:
    disablenpc strnpcinfo(0);
    end;
}

turbo_n_1,114,190,0    script    Water_False_1    45,1,1,{
OnTouch:
    warp strnpcinfo(4),76,227;
OnInit:
    disablenpc strnpcinfo(0);
    end;
}

turbo_n_1,114,190,0    script    Water_Exit_2    45,1,1,{
OnTouch:
    mapannounce "turbo_n_1.gat",strcharinfo(0)+" has reached Room 5!",bc_map,0xf08080;
    warp strnpcinfo(4),185,227;
    announce "Run around the shell room and find the right portal. Try not to get dizzy.~",bc_self,0x7fff00;    
OnInit:
    disablenpc strnpcinfo(0);
    end;
}

turbo_n_1,11,266,0    script    Water_False_2    45,1,1,{
OnTouch:
    warp strnpcinfo(4),76,227;
OnInit:
    disablenpc strnpcinfo(0);
    end;
}

 

The goal of this section of my script is to randomize the exit portals for a maze. Currently, I have someone step on a switch in room 3 that activates the warp portals for room 4. This switch does a randomization of 1,2. If 1 is returned, then real warp portal 1 is activated (takes you to the next room) and fake portal 1 is activated (sends you back to starting point of that room). If 2 is returned, the other portals are opened (same locations. opposite effects). When this happens, I have $switch set to 1. When the event is ended, I have $switch set back to 0 in another NPC so that it'll reset the process. However, the script is currently not working. For some reason real warp 2 is always activated and there's no portal at all in the first spot. What am I doing wrong?

Edited by Succubusty
Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Check your curly in

turbo_n_1,316,365,0    script    DSwitch    -1,1,1,{
OnTouch:
    if ($switch == 0){
        set $switch,1;
        if (rand(1,2) == 1)
            enablenpc "Water_Exit_1";
            enablenpc "Water_False_1";
            }
        else{
            enablenpc "Water_Exit_2";
            enablenpc "Water_False_2";
            disablenpc strnpcinfo(0);
        }
        end;
}

 

 

 

 

 

I suggest .var instead of $var for

$switch

except if you use this permanent variable in another npc.

 

 

 

 

turbo_n_1,11,266,0    script    Water_Exit_1    45,1,1,{
OnTouch:

No need Ontouch with the trigger

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/07/13
  • Last Seen:  

I fixed the curlys. Thanks for catching that. Still having the same problem though.

 

I use the variable in another npc, so I'm going to leave it as $switch

 

Why wouldn't I need ontouch? How would the warp & announcement activate otherwise?

Edited by Succubusty
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/07/13
  • Last Seen:  

Is anyone able to help me out here?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  04/07/13
  • Last Seen:  

Still need this!

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Why wouldn't I need ontouch? How would the warp & announcement activate otherwise?

 

Because of the trigger part

turbo_n_1,316,365,0    script    DSwitch    -1,1,1,{

If someone is in the trigger range (here 1x1 cases near to the npc) the npc acte like if you click on it.

 

 

Without the curly error the npc seems working for me : it randomly enable the npc 1 or 2.

	if ($switch == 0){
		set $switch,1;
		if (rand(1,2) == 1) {
			enablenpc "Water_Exit_1";
			enablenpc "Water_False_1";
		}
		else {
			enablenpc "Water_Exit_2";
			enablenpc "Water_False_2";
			disablenpc strnpcinfo(0);
		}
	}
	end;
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...