Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   Delta Force (https://novahq.net/forum/forumdisplay.php?f=101)
-   -   [DFX2] PL00P ya G00P's (3) (https://novahq.net/forum/showthread.php?t=46768)

MERMITE 07-10-2012 01:52 PM

PL00P ya G00P's (3)
 
Gloop I use very very rarely, but the Ploop is a whole different matter, this time 'THE MAGIC HAPPENS TO THE THE PLAYER"

PLOOP:

The ploop is a procedure that will cause a looping sequence within the
code. The syntax of a ploop will start with the keyword ploop and
conclude with the keyword end. It is used in conjunction with the
keyword player to either check a players status in a condition or to modify an
attribute of a player in an action statement.

When a ploop is reached any conditions and statements within the ploop
will cycle through for each of the players in the game until all have been
checked and/or acted upon, before the sequential continuation of the wac
code. In other words, the wac codes linear progression through the code is
broken as though a subroutine that must check each member of the group
before returning back to the remainder of the wac codes linear sequence.

Syntax:

ploop
if conditions containing player then
actions containing player
endif
end

Example: (a favourite)

ploop

if ssnnearssn(1234,player,3) then
ssnhp(player,150)
endif
end

If the ssn#1234 represented a medic, this code will check to see if any
player is within 3 meters of the medic and if that condition is met, then
that player would have his hit points set to 150 (which is full health).

What the loop does is replace the actual internal number of the player and
use the keyword player to hold that number as a variable would hold a
number, then check the condition to see if that player fits the criteria of
the condition, and if true the same internal number represented by player
in the action part of the statement will cause any activity designated there
to be applied to that player.

This is very strong magic, note esp. the use of end and endif,
like the old RND or doseq you gotta lock the sucker up with END.

Don't be like pvt. Harry Potter and run around with his wand
exposed all over the place, better to make a small separate map
one each Pl00p or Gl00p, and experiment.

"M"

Oscarmike247 05-10-2018 06:59 AM

Why is ploop necessary though? The command without ploop would work just the same.

if ssnnearssn(1234,player,3) then
ssnhp(player,150)
endif

Guest001 05-10-2018 07:03 PM

Quote:

Originally Posted by Oscarmike247 (Post 389561)
Why is ploop necessary though? The command without ploop would work just the same.

if ssnnearssn(1234,player,3) then
ssnhp(player,150)
endif

What if you had more than one player?

Guest001 05-11-2018 08:09 PM

Looking into it without any reference to any particular scenario I've found you can probably break them up into 3 main categories of influence.

Loop - Local - load from mission wac (on mission load) corresponds to local vars V

Gloop - Global - load from game wac (on game load) corresponds to global vars G

Ploop - Player - load from server wac or game wac (on game load) corresponds to player vars P

Oscarmike247 05-12-2018 12:18 PM

Quote:

Originally Posted by stompem (Post 389570)
Looking into it without any reference to any particular scenario I've found you can probably break them up into 3 main categories of influence.

Loop - Local - load from mission wac (on mission load) corresponds to local vars V

Gloop - Global - load from game wac (on game load) corresponds to global vars G

Ploop - Player - load from server wac or game wac (on game load) corresponds to player vars P

Make more sense. Thanks Stomp.

What are some examples of P variables?

Guest001 05-13-2018 01:05 PM

There may be more...Note - experimentation is the order of the day here...

onptick
pconsol
ptext
Pisvar
PisKills
psetvar
pisteam
ploop

Guest001 05-13-2018 01:45 PM

server.wac

Code:

ploop
        if onptick 10 then
                ptext "<cf8932>[GSP] Garden Shed Productions<-co>"
        end

        if piskills(1) and never then
                if pisteam(1) then
                        text "First Kill - <cfc0000FF>Blue Team<-co>"
                else
                        text "First Kill - <cfcFF0000>Red Team<-co>"
                end
                ptext "Congrats on the first kill of the game!'
                psetvar(2)
        end

        if piskills(1) and not pisvar(2) then
                psetvar(2)
                ptext "Congrats on your first kill!"
                if pisteam(1) then
                        ptext "Take your Team to Victory!"
                else
                        ptext "Take your Team to victory!"
                end
        end
end


Guest001 05-13-2018 01:51 PM

mission_name.wac

I posted an old script here but looking at it now I reckon it was in error.

Will check things out and post another example later...


All times are GMT -5. The time now is 02:46 PM.

Powered by vBulletin®